[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)
committerGeorg Ringer <mail@ringerge.org>
Sat, 24 Mar 2012 15:46:56 +0000 (16:46 +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: Ibd14796dae648195a630d520ab18d5f8689076f0
Fixes: #24248
Releases: 6.0, 4.7, 4.6, 4.5
Reviewed-on: http://review.typo3.org/9851
Reviewed-by: Philipp Gampe
Tested-by: Philipp Gampe
Reviewed-by: Oliver Klee
Reviewed-by: Markus Klein
Reviewed-by: Georg Ringer
Tested-by: Georg Ringer
t3lib/class.t3lib_iconworks.php

index 8a78110..321b8ac 100644 (file)
@@ -841,9 +841,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';
@@ -942,10 +944,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;
+                               }
                        }
                }