[TYPO3-core] RFC: #2731: Improved caching of locallang

Frans Saris franssaris at gmail.com
Fri Feb 6 20:54:33 CET 2009


Hi core members,

2008/2/4 Martin Kutschker <Martin.Kutschker at n0spam-blackbox.net>

> Martin Kutschker schrieb:
>
>  Hello everybody!
>>
>> This is a SVN patch request.
>>
>> Type: Improvement
>>
>> Bugtracker references: http://bugs.typo3.org/view.php?id=2731
>>
>> Problem: all preprocessiing of localized strings (incl. the caching) is
>> done in the "native" character set of the language. That means that TYPO3
>> will (especially for XML files) do a constant conversion from one charset to
>> another (most likely from iso-8859-1 to utf-8). This is a performance hog.
>>
>> Solution: hold all localized strings internally (and in the cache files)
>> in the required charset. Do any conversion only once, ie when building up
>> the cache. In the BE the charset is detetmined by the language or
>> forceCharset, in the FE it's also possible to override it further via
>> config.renderCharset. t3lib_div::readLLfile() will auto-detect the charset
>> (from forceCharset and $lang), but has got an optional charset argument
>> (used in the FE for forceCharset).
>>
>> Notes: This is a change from the old internal behaviour. Now all the
>> strings are correct at once (after loading from file) without the need for
>> further processing.
>>
>> Warning: I have started this patch a long time ago for the BE. This part
>> worked well. The part for the FE I have written right now (in the night).
>> This part is not so well tested.
>>
>> As the diff is nearly unreadable please test with various setups. Use
>> languages with different charset, set and unset forceCharset, fiddle with
>> renderCharset. In typo3temp/llxml you'll find a cache file for each
>>  locallang.php, language and charset.
>>
>
>
> +       public static function readLLXMLfile($fileRef, $langKey,
> $charset='')   {
>
>                if (is_object($GLOBALS['LANG']))        {
>                        $csConvObj = &$GLOBALS['LANG']->csConvObj;
>                } elseif (is_object($GLOBALS['TSFE']))  {
>                        $csConvObj = &$GLOBALS['TSFE']->csConvObj;
> -               } else $csConvObj = NULL;
> +               } else {
> +                       $csConvObj = t3lib_div::makeInstance('t3lib_cs');
> +               }
>
> -               if (@is_file($fileRef) && $langKey &&
> is_object($csConvObj))    {
> +               $LOCAL_LANG = NULL;
>


the patch misses a check.

the is_object($csConvObj) check is missing in the new version, this results
in a fatal error when  $GLOBALS['LANG'] or $GLOBALS['TSFE'] is present but
the csConvObj not.

I now that this is commited almost a year ago, but i found the bug when I
upgraded from 4.1.* to 4.2.4 (and 4.2.5 also). Perhaps it is also releated
to some old extentions I have installed. But I think this has to be fixed
because there are more people out there that wil upgrade and have some old
extentions that they like to use.

I already reported the bug http://bugs.typo3.org/view.php?id=10367

gr. Frans
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.netfielders.de/pipermail/typo3-team-core/attachments/20090206/48ca3a54/attachment.htm 


More information about the TYPO3-team-core mailing list