[TYPO3-dam-devel] RFC: Bugfix: 6766: getReferencedFiles $whereClauses as string

Peter Kuehn [wmdb] peter.kuehn at wmdb.de
Fri Feb 8 14:40:45 CET 2008


This is a svn patch request.

Type: bugfix

Description:
When $whereClauses is string, preg_replace in lib/class.tx_dam_db.php on 
line 454 fails


Solution (as described by michiel in a bugnote):
The comment of the function getReferencedFiles says:
* @param string $whereClause Extra where clause prepended with " AND "

So the function expects a where clause already prepended with "AND " 
passed in as a parameter. But then the code round line 496 appends an 
AND to an imploded where array build out of a lot of were stuf stuffed 
into the where array

The non workign code reads:
preg_replace('^AND ', trim($whereClauses))

I suspect that the code should read:
'Strip off the AND if it is passed in on a whereClauses sting.'

So that would be:
preg_replace('/^AND /', '', trim($whereClauses));


Notes:
- the suspect preg_replace-construct exists two times in the class so i 
fixed both
- im no king with regexes - just trusting michiel because
- i couldnt find a single place, where its used with an incoming string so
- change is basically untested

Bugtracker reference: http://bugs.typo3.org/view.php?id=6766
-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: 6766.fix.patch
Url: http://lists.netfielders.de/pipermail/typo3-team-dam/attachments/20080208/9cc64367/attachment.txt 


More information about the TYPO3-team-dam mailing list