[TYPO3-dev] Typo3 4.2 Cache Bug?

Klaus Hinum k_hinum at hotmail.com
Tue Apr 29 11:27:55 CEST 2008


Klaus Hinum schrieb:
> Klaus Hinum schrieb:
>> Dmitry Dulepov [typo3] schrieb:
>>> Klaus Hinum wrote:
>>>> I just stumbled upon an error (or missing feature ;)) of the page 
>>>> cache in typo3 4.2. It looks like the cache writing is aborted when 
>>>> it comes to special chars (or html entities).
>>>
>>> It means that charset of corresponding database field ("html" if I 
>>> remember correctly) in cache_pages does not correspond to the BE 
>>> charset. So MySQL cannot save your data fully. It tries but finds 
>>> that data is incompatible with column charset and aborts writing in 
>>> the middle.
>>>
>>
>> Thanks for the fast reply but both (backend and the database, also the 
>> html field) are set to UTF-8. The html field is (as most other fields, 
>> some are utf8_bin) utf8_general_ci.
>>
>> Greetings
>> Klaus
> 
> After some more research, I found out the true problem.
> We use some HTML tags in our abstract field, like <b> and <a>. For our 
> pageteaser we use the PHP substr() method to shorten the abstract for 
> teasing. It looks like there is a problem with 4.2 (did work with 4.1.5) 
> when caching the resulting pageteaser page, as it will abort inbetween 
> the shortened abstract. When adding strip_tags() before using substr() 
> everything works.
> 
> At least an error should be written in the cache entry, as it may be 
> hard to find (took me some hours today).

After some more testing I can now exactly specify the "bug". If you use 
the php function substr() on an utf-8 string, and the "cut" is exactly 
at any 2 byte encoded character (like öäü), the resulting string will 
stop typo3 from caching (only to this cut half). In 4.1.5 this was still 
working, so I think this is a bug.
Shoud I fill out a bug report on that?
Klaus




More information about the TYPO3-dev mailing list