[BUGFIX] Handle empty tags in language pack index files 38/15138/6
authorAlexander Stehlik <alexander.stehlik@googlemail.com>
Fri, 17 Jan 2014 09:46:44 +0000 (10:46 +0100)
committerStefan Neufeind <typo3.neufeind@speedpartner.de>
Fri, 17 Jan 2014 14:23:36 +0000 (15:23 +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/15138
Reviewed-by: Markus Klein
Tested-by: Markus Klein
Reviewed-by: Stefan Neufeind
Tested-by: Stefan Neufeind
typo3/sysext/lang/Classes/Utility/Connection/Ter.php

index e8a20b8..63b73b1 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;
                                }
                        }