Feature #19495
closed
memory waste with locallang
Added by Franz Holzinger about 16 years ago.
Updated over 11 years ago.
Description
If you load a locallang in an extension into the $LOCAL_LANG, then you can see, when no utf8 is used, that all default texts have been stored twice in memory. The normal texts have wrongly be used also as keys. This is a big waste of memory for big locallang.xml files.
Example:
$LOCAL_LANG Pos2
Array (4) default
String (24) mark_memo_dam_goto Go to the DAM memo list.
String (17) mark_basket_goto Go to the basket.
String (24) Go to the DAM memo list. Go to the DAM memo list.
String (17) Go to the basket. Go to the basket.
Array (2) de
String (24) mark_memo_dam_goto Gehe zur DAM Memo Liste.
String (19) mark_basket_goto Gehe zum Warenkorb.
(issue imported from #M9622)
Files
Hi Franz,
did you test/profile this? Current there's a reference "&$labelValue" used that points to the accordant array item.
Could please explain, what your "$LOCAL_LANG Pos2" example above shows us? Thanks!
olly
Hello Olly,
this example shows the debug output of the total read in locallang.xml file. This is the result returned from the function readLLXMLfile which has been called from tx_div2007_alpha::loadLL_fh001($pibaseObj,'EXT:'.TT_PRODUCTS_EXTkey.'/pi_search/locallang.xml');
which itself calls
$tempLOCAL_LANG = t3lib_div::readLLfile($basePath,$langObj->LLkey);
You can see that the default part has read in everything twice. One is too much and also useless.
Franz
in TYPO3 4.2.2 you have had:
if (is_array($LOCAL_LANG[$langKey]) && $targetCharset!='utf-8') {
foreach($LOCAL_LANG[$langKey] as $labelKey => $labelValue) {
$LOCAL_LANG[$langKey][$labelKey] = $csConvObj->utf8_decode($labelValue,$targetCharset);
}
}
which seems to be ok.
Hey Franz.
Let me know if the attached patch fixes your problem.
Not sure if this actually "resolves" something (which I doubt). So I didn't reference this bug in the "Resolves"-line.
But using references for foreach()-values is a nice cleanup anyway.
Idea used in cleanup at: http://review.typo3.org/2791
- Category set to Miscellaneous
- Status changed from Needs Feedback to Resolved
- Target version changed from 0 to 1281
- TYPO3 Version changed from 4.3 to 4.6
- PHP Version changed from 5.2 to 5.3
Resolved
Since there was no feedback for quite some time and the real problem not described pretty well, I'll close this issue.
We've however created a new issue for the foreach() reference thing with #27529.
- Status changed from Resolved to Closed
- Target version deleted (
1281)
Also available in: Atom
PDF