[TYPO3-team-templavoila] Caching of xml2array during rendering
Daniel Pötzinger
nospam at nospam.de
Wed May 27 08:43:02 CEST 2009
Dmitry Dulepov schrieb:
> Hi!
>
> Daniel Pötzinger wrote:
>> Sorry here is another patch - I forgot to cache the localprocessing
>
> A tiny note: I think "$cacheData=" is not necessary in the getXML2ArrayWithCache. Here:
>
> + $this->updateCacheForRow($row['uid'], $table, $fieldwithxmlCache, $cacheData=array('tstamp'=>$row['tstamp'], 'data'=>$data ));
thx - updated it
>
> The patch is a bit off the CGL with spaces but I can live with that :) In general spaces should be around all operators (i.e. $hello = 'world') and not before ')'. But that's just my rant... I think the patch is very useful. I one tried to profile the FE and xml2array is really a time eater.
>
I updated spaces where I saw it.
> I did not test the patch, only looked. I think it is good to integrate it. One thing that can be a problem is this:
>
> + $cacheData=@unserialize($row[$fieldwithxmlCache]);
> + if ($cacheData['tstamp'] == $row['tstamp']) {
>
> If I remember correctly, than this causes a PHP runtime error if $cacheData is not an array but boolean (or string). It happened in the past a lot in TCEforms when '<meta></meta>' was decoded as a string while the code expected it to be an array. It says something like "cannot use string offset as array blah-blah-blah".
>
> I suppose we need something like this:
>
> + $cacheData = @unserialize($row[$fieldWithXmlCache]);
> + if (is_array($cacheData) && $cacheData['tstamp'] == $row['tstamp']) {
I also updated this - thx.
-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: templavoila.patch
Url: http://lists.netfielders.de/pipermail/typo3-team-templavoila/attachments/20090527/decc4cf2/attachment.txt
More information about the TYPO3-team-templavoila
mailing list