Index: t3lib/class.t3lib_db.php =================================================================== --- t3lib/class.t3lib_db.php (revision 8804) +++ t3lib/class.t3lib_db.php (working copy) @@ -828,7 +828,7 @@ * @see quoteStr() */ function escapeStrForLike($str, $table) { - return preg_replace('/[_%]/', '\\\$0', $str); + return addcslashes($str, '_%'); } /** Index: tests/t3lib/t3lib_dbTest.php =================================================================== --- tests/t3lib/t3lib_dbTest.php (revision 8804) +++ tests/t3lib/t3lib_dbTest.php (working copy) @@ -135,5 +135,19 @@ ); } + + ///////////////////////////////////////////////// + // Tests concerning escapeStringForLikeComparison + ///////////////////////////////////////////////// + + /** + * @test + */ + public function escapeStringForLikeComparison() { + $this->assertEquals( + 'foo\_bar\%', + $this->fixture->escapeStrForLike('foo_bar%', 'table') + ); + } } ?> \ No newline at end of file