[BUGFIX] t3lib_iconWorks must check if array exists before using it 99/12799/2
authorJigal van Hemert <jigal@xs4all.nl>
Fri, 23 Mar 2012 21:22:59 +0000 (22:22 +0100)
committerBenjamin Mack <benni@typo3.org>
Sat, 9 Feb 2013 05:24:58 +0000 (06:24 +0100)
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: I5a7823c7d604a2960272fe7577075ed2309658bd
Fixes: #24248
Releases: 6.0, 4.7, 4.6, 4.5
Reviewed-on: https://review.typo3.org/12799
Reviewed-by: Marcus Schwemer
Reviewed-by: Wouter Wolters
Reviewed-by: Steffen Ritter
Tested-by: Steffen Ritter
Reviewed-by: Benjamin Mack
Tested-by: Benjamin Mack
t3lib/class.t3lib_iconworks.php

index c39406e..f556ef9 100644 (file)
@@ -882,9 +882,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';
@@ -983,10 +985,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;
+                               }
                        }
                }
 
@@ -1041,4 +1045,4 @@ final class t3lib_iconWorks {
 
 }
 
-?>
\ No newline at end of file
+?>