[BUGFIX] t3lib_iconWorks must check if array exists before using it
authorJigal van Hemert <jigal@xs4all.nl>
Fri, 23 Mar 2012 21:22:59 +0000 (22:22 +0100)
committerXavier Perseguers <xavier@typo3.org>
Tue, 16 Oct 2012 10:08:35 +0000 (12:08 +0200)
A few places in t3lib_iconWorks use variables as arrays without
checking if they are actually arrays. This leads to warnings in
the syslog.

Change-Id: Id3f2e02099669c4be7c4050d35b634c8a964f060
Fixes: #24248
Releases: 6.0, 4.7, 4.6, 4.5
Reviewed-on: http://review.typo3.org/12800
Reviewed-by: Marcus Schwemer
Reviewed-by: Wouter Wolters
Reviewed-by: Steffen Ritter
Tested-by: Steffen Ritter
Reviewed-by: Xavier Perseguers
Tested-by: Xavier Perseguers
t3lib/class.t3lib_iconworks.php

index c41642e..1d6526b 100644 (file)
@@ -843,9 +843,11 @@ final class t3lib_iconWorks {
                        }
                }
                krsort($recordType);
-               foreach ($recordType as $iconName) {
-                       if (in_array($iconName, $GLOBALS['TBE_STYLES']['spriteIconApi']['iconsAvailable'])) {
-                               return $iconName;
+               if (is_array($GLOBALS['TBE_STYLES']['spriteIconApi']['iconsAvailable'])) {
+                       foreach ($recordType as $iconName) {
+                               if (in_array($iconName, $GLOBALS['TBE_STYLES']['spriteIconApi']['iconsAvailable'])) {
+                                       return $iconName;
+                               }
                        }
                }
                return 'status-status-icon-missing';
@@ -944,10 +946,12 @@ final class t3lib_iconWorks {
                $priorities = $GLOBALS['TBE_STYLES']['spriteIconApi']['spriteIconRecordOverlayPriorities'];
 
                $iconName = '';
-               foreach ($priorities as $priority) {
-                       if ($status[$priority]) {
-                               $iconName = $GLOBALS['TBE_STYLES']['spriteIconApi']['spriteIconRecordOverlayNames'][$priority];
-                               break;
+               if (is_array($priorities)) {
+                       foreach ($priorities as $priority) {
+                               if ($status[$priority]) {
+                                       $iconName = $GLOBALS['TBE_STYLES']['spriteIconApi']['spriteIconRecordOverlayNames'][$priority];
+                                       break;
+                               }
                        }
                }
 
@@ -1002,4 +1006,4 @@ final class t3lib_iconWorks {
 
 }
 
-?>
\ No newline at end of file
+?>