[BUGFIX] EmConfUtility accesses non-arrays 99/24099/2
authorMarkus Klein <klein.t3@mfc-linz.at>
Thu, 26 Sep 2013 22:37:43 +0000 (00:37 +0200)
committerChristian Kuhn <lolli@schwarzbu.ch>
Sun, 6 Oct 2013 21:41:35 +0000 (23:41 +0200)
Properly check for array-type before accessing
or counting the variable.

Resolves: #52045
Releases: 6.2, 6.1, 6.0, 4.7, 4.5
Change-Id: Id161fddadbbcadd462de36e8227278107f2e7a3a
Reviewed-on: https://review.typo3.org/24099
Reviewed-by: Christian Kuhn
Tested-by: Christian Kuhn
typo3/sysext/em/classes/tools/class.tx_em_tools.php

index 959fd2b..aafdab9 100644 (file)
@@ -386,17 +386,14 @@ final class tx_em_Tools {
         * @return      string          A simple dependency list for display
         */
        public static function depToString($dep, $type = 'depends') {
-               if (is_array($dep)) {
-                       if (isset($dep[$type]['php'])) {
-                               unset($dep[$type]['php']);
-                       }
-                       if (isset($dep[$type]['typo3'])) {
-                               unset($dep[$type]['typo3']);
-                       }
-                       $s = (count($dep[$type])) ? implode(',', array_keys($dep[$type])) : '';
-                       return $s;
+               if (!is_array($dep) || !is_array($dep[$type])) {
+                       return '';
                }
-               return '';
+
+               unset($dep[$type]['php']);
+               unset($dep[$type]['typo3']);
+
+               return implode(',', array_keys($dep[$type]));
        }
 
        /**