contao/test — Issue #1220: Database::replaceWildcards() breaks on wildcarded search terms such as %south%
Author: importer
Created: 2011-11-29 07:32:36+00:00
State: open
Labels: Defect, Invalid

Hi Leo,

vsprintf() in Database::replaceWildcards() is breaking when we pass a wildcarded search term through the execute() method (while using the LIKE clause to perform text search on a given field). it is clear the regex is told to ignore any vsprintf wildcards such as %s, %d, etc. but then of course, this generates a "too few arguments" error which is unhandled when we search certain terms.

Line 629 in Database.php is the culprit:

`$this->strQuery = preg_replace('/%([^bcdufosxX])/', '%%$1', $this->strQuery);`

This error also occurs when attempting to build a concatenated SQL string which pre-builds the LIKE clauses into the SQL passed through the Database::prepare() method.

Related issues: #1007, #1085

--- _Originally created by fbliss on November 29th, 2009, at 08:09pm (ID 1220)_