#33200 [Opn->Bgs]: magic_quotes_sybase switched on breaks the use of /e modifier in preg_replace

From: Date: Tue, 31 May 2005 10:43:23 +0000
Subject: #33200 [Opn->Bgs]: magic_quotes_sybase switched on breaks the use of /e modifier in preg_replace
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-79753@lists.php.net to get a copy of this message
ID: 33200 Updated by: sniper@php.net Reported By: astax_t at gorodok dot net -Status: Open +Status: Bogus Bug Type: PCRE related Operating System: Windows PHP Version: 4.3.11 New Comment: RTFM: "If magic_quotes_sybase is also on, a single-quote is escaped with a single-quote instead of a backslash." Previous Comments: ------------------------------------------------------------------------ [2005-05-31 12:36:09] astax_t at gorodok dot net Description: ------------ When magic_quotes_sybase is On, this also affects how apostrophes are escaped in preg_replace with /e modifier. See example. In example code I specifically included a string with $ inside to point why it's impossible to use double quotes around \\1 in second parameter. Reproduce code: --------------- $str = 'some \'$sample\' text'; $str = preg_replace("/(some.*text)/e", "strtoupper('\\1')", $str); echo $str; Expected result: ---------------- SOME '$SAMPLE' TEXT Actual result: -------------- Parse error: parse error in E:\test\web\a.php(4) : regexp code on line 1 Fatal error: preg_replace(): Failed evaluating code: strtoupper('some ''$sample'' text') in E:\test\web\a.php on line 4 ------------------------------------------------------------------------ -- Edit this bug report at http://bugs.php.net/?id=33200&edit=1

« previous php.bugs (#79753) next »