[BUGFIX] Handle empty tags in language pack index files 02/26902/2
authorAlexander Stehlik <alexander.stehlik@googlemail.com>
Fri, 17 Jan 2014 09:46:44 +0000 (10:46 +0100)
committerStefan Neufeind <typo3.neufeind@speedpartner.de>
Thu, 30 Jan 2014 11:58:06 +0000 (12:58 +0100)
This patch adds a check to the L10n index parser to consider
whether the value of an XML tag is empty or contains only
spaces. In this case it is not included in the resulting array.

Resolves: #41450
Releases: 6.2, 6.1, 6.0
Change-Id: Ia17a430f3ab2d79e2f97b55feb9d3c4ee60bfb7e
Reviewed-on: https://review.typo3.org/26902
Reviewed-by: Stefan Neufeind
Tested-by: Stefan Neufeind
typo3/sysext/lang/Classes/Utility/Connection/Ter.php

index b214f75..92ae854 100644 (file)
@@ -111,10 +111,12 @@ class Ter extends \TYPO3\CMS\Extensionmanager\Utility\Connection\TerUtility {
                                                $current[key($current)] = $oldCurrent;
                                                unset($oldCurrent);
                                                break;
-                                               // If "complete", then it's a value. If the attribute "base64" is set, then decode the value, otherwise just set it.
+                                               // If "complete", then it's a value. Omits the tag if the value is empty.
                                        case 'complete':
-                                                       // Had to cast it as a string - otherwise it would be evaluate FALSE if tested with isset()!!
-                                               $current[$tagName] = (string) $val['value'];
+                                               $trimmedValue = trim((string)$val['value']);
+                                               if ($trimmedValue !== '') {
+                                                       $current[$tagName] = $trimmedValue;
+                                               }
                                                break;
                                }
                        }
@@ -234,4 +236,4 @@ class Ter extends \TYPO3\CMS\Extensionmanager\Utility\Connection\TerUtility {
        }
 }
 
-?>
\ No newline at end of file
+?>