[BUGFIX] Empty text with non-localizable label key
authorXavier Perseguers <xavier@typo3.org>
Fri, 28 Oct 2011 06:31:23 +0000 (08:31 +0200)
committerAndreas Wolf <andreas.wolf@ikt-werk.de>
Fri, 28 Oct 2011 11:33:52 +0000 (13:33 +0200)
When method $GLOBALS['TSFE']->sL() is called with a non-localizable
label key (not starting with "LLL:"), an empty string is returned
instead of the label key itself.

This is a breaking change with previous versions of TYPO3.

Change-Id: I2847e51fd479d9636ac815c820b2e63cf449d6a7
Fixes: #31347
Releases: 4.6, 4.7
Reviewed-on: http://review.typo3.org/6364
Reviewed-by: Andreas Wolf
Tested-by: Andreas Wolf
tests/typo3/sysext/cms/tslib/class.tslib_feTest.php
typo3/sysext/cms/tslib/class.tslib_fe.php

index e9c0a75..de91301 100644 (file)
@@ -89,6 +89,19 @@ class tslib_feTest extends tx_phpunit_testcase {
        }
 
 
+       //////////////////////
+       // Tests concerning sL
+       //////////////////////
+
+       /**
+        * @test
+        */
+       public function localizationReturnsUnchangedStringIfNotLocallangLabel() {
+               $string = uniqid();
+               $this->assertEquals($string, $this->fixture->sL($string));
+       }
+
+
        //////////////////////////////////////////
        // Tests concerning roundTripCryptString
        //////////////////////////////////////////
index 72e5cca..d8a7b63 100644 (file)
@@ -4563,6 +4563,11 @@ if (version == "n3") {
         * @return      string          Label value, if any.
         */
        function sL($input)     {
+               if (substr($input, 0, 4) !== 'LLL:') {
+                               // Not a label, return the key as this
+                       return $input;
+               }
+
                        // If cached label
                if (!isset($this->LL_labels_cache[$this->lang][$input])) {
                        $restStr = trim(substr($input,4));