[BUGFIX] Skip missing icons in tceforms select options
authorPeter Niederlag(office) <netservice@niekom.de>
Wed, 28 Sep 2011 07:55:32 +0000 (09:55 +0200)
committerXavier Perseguers <xavier@typo3.org>
Mon, 17 Oct 2011 08:31:41 +0000 (10:31 +0200)
Check existance of file before adding background style url

Change-Id: I78619069090d7af64b858f93b9d7fedeb8014324
Fixes: #24591
Releases: 4.5, 4.6
Reviewed-on: http://review.typo3.org/5887
Reviewed-by: Xavier Perseguers
Tested-by: Xavier Perseguers
t3lib/class.t3lib_tceforms.php

index e0de80b..69460c8 100644 (file)
@@ -4156,6 +4156,9 @@ class t3lib_TCEforms {
                        $iconPath = substr($selIconFile, strlen($this->backPath));
                        $selIconInfo = @getimagesize(PATH_typo3 . $iconPath);
                }
+               if ($selIconInfo === FALSE) {
+                       $selIconFile = ''; // unset to empty string if icon is not available
+               }
                return array($selIconFile, $selIconInfo);
        }
 
@@ -4184,7 +4187,9 @@ class t3lib_TCEforms {
        function optionTagStyle($iconString) {
                if ($iconString) {
                        list($selIconFile, $selIconInfo) = $this->getIcon($iconString);
-
+                       if (empty($selIconFile))  {
+                               return ''; // skip background style if image is unavailable
+                       }
                        $padLeft = $selIconInfo[0] + 4;
 
                        if ($padLeft >= 18 && $padLeft <= 24) {
@@ -4206,7 +4211,9 @@ class t3lib_TCEforms {
        function optgroupTagStyle($iconString) {
                if ($iconString) {
                        list($selIconFile, $selIconInfo) = $this->getIcon($iconString);
-
+                       if (empty($selIconFile)) {
+                               return ''; // skip background style if image is unavailable
+                       }
                        $padLeft = $selIconInfo[0] + 4;
 
                        if($padLeft >= 18 && $padLeft <= 24) {