[TYPO3-core] RFC #9803: getTreeList causes duplicate entry sql error in cache_treelist

Rupert Germann rupi at gmx.li
Tue Oct 13 13:35:20 CEST 2009


hi Christian,

took me a while to get empty cache entries in the table.
The main point is that this happens only if getTreelist is called with a 
positive ID (which does not happen in the core)

your patch works, but I think you fix the problem at the wrong end. If 
empty results are not returned they should of course not be cached at all.

see attached patch where I moved the check for the empty result to the 
insert query.

greets
rupert



Christian Kuhn schrieb:
> Friendly reminder.
> 
> This bug is triggered if getTreeList() is called for pages without 
> subpages.
> 
> Thanks
> Christian
> 
> Christian Kuhn wrote:
>> This is an SVN patch request.
>>
>> Type: bugfix
>>
>> Bugtracker references:
>> http://bugs.typo3.org/view.php?id=9803
>>
>> Branches: trunk
>>
>> Problem:
>> With revision 3947 a new cache for getTreeList() was added to cache 
>> the expensive operation of finding recursive pidlists. The test for an 
>> existing cache entry fails if a page has no subpages:
>> The "select where identifier=" query returns one row and the field 
>> treelist is an empty string. The check for "if 
>> (!empty($cacheEntry[0]['treelist'])) {" fails, a new treelist is 
>> calculated and the following insert to cache fails with an "Duplicate 
>> entry" error.
>>
>> Solution:
>> Check Select result set for 0 rows instead of empty string of 
>> "treelist" field.
>>
>> Greetings
>> Christian
>>
>>
>> ------------------------------------------------------------------------
>>
>> _______________________________________________
>> Before posting to this list, please have a look to the posting rules
>> on the following websites:
>>
>> http://typo3.org/teams/core/core-mailinglist-rules/
>> http://typo3.org/development/bug-fixing/diff-and-patch/ 
>> _______________________________________________
>> TYPO3-team-core mailing list
>> TYPO3-team-core at lists.netfielders.de
>> http://lists.netfielders.de/cgi-bin/mailman/listinfo/typo3-team-core
> 



More information about the TYPO3-team-core mailing list