[TYPO3-dev] Bug in t3lib_pageSelect::storeHash()

Chris Zepernick {SwiftLizard} chris at swift-lizard.com
Tue Aug 10 17:19:07 CEST 2010


Hi,

although we discovered that a stupid Xclass caused our main problem
(overwirtten t3lib_pageSelect::getHash() which does not use the caching 
framework), I discovered a bug in the caching framework.

$this->cache->has($hash) has a Bug according to the config of the 
lifetime you just told me, and if one looks into the code.

get where clause:

.'AND (crdate + lifetime >= ' . $GLOBALS['EXEC_TIME'] . ' OR lifetime = 0)'

has where clause:

' AND crdate + lifetime >= ' . $GLOBALS['EXEC_TIME']


to my mind this is a bug because the "OR lifetime = 0" is missing,
so has() will allways return false for infinit cache.

all the other points i totally agree with you

cheers

chris



> Hi,
>
> On 10-8-2010 13:50, Chris Zepernick {SwiftLizard} wrote:
>> As far as I get it with different content this method will never be able
>> to get the same hash, right ?
>
> Well, an MD5 hash is not completely unique, but it's very unlikely to
> have identical hashes for different content in real life situations.
>
>> At the moment, if one uses the new cachingframework, this is the only
>> condition checked before the cache->set is perfomed.
>>
>> To my mind it would be more logical if we check if the hash already
>> exists (cache->has) before we perform the cache->set action. This way we
>> would prevent the delete and insert each time the page is loaded.
>
> The code which uses the cache first tries to retrieve it and if it isn't
> found in the cache it will render the content en store it in the cache.
> No need to check for duplicates, is there?
>
>> The other bug is that the method has the false lifetime default.
>> In current (4.3.5) Core the default lifetime is set to 0 instead of NULL
>> which leads to the problem that, in case of the caching framework, this
>> cache entry never lifes.
>
> 0 means unlimited lifetime, NULL means default lifetime (1 hour in the
> dbbackend). See t3lib_cache_backend_DbBackend::get() ; it specifically
> checks for lifetime=0.
>





More information about the TYPO3-dev mailing list