[TYPO3-core] RFC #14997: Performance: t3lib_db->escapeStrForLike() is using preg_replace, which is not necessary

François Suter fsu-lists at cobweb.ch
Sat Sep 4 21:14:36 CEST 2010


REMINDER

> Hi,
>
>> Problem:
>> The function t3lib_db->escapeStrForLike() is using preg_replace to escape
>> the values '%' and '_' with a '\' for a sql-like-statement.
>> preg_replace takes a lot of recources and is not necessary for such a
>> simple replacement.
>>
>> Solution:
>> use str_replace instead.
>
> +1 after reading and testing.
>
> Attached v2 to which I have added a test case for
> t3lib_db::escapeStrForLike(). It's a very simple method, but I still
> thought it made sense to add unit testing for it since we were changing it.
>
> Cheers
>


-- 

Francois Suter
Cobweb Development Sarl - http://www.cobweb.ch


More information about the TYPO3-team-core mailing list