From:             astax_t at gorodok dot net
Operating system: Windows
PHP version:      4.3.11
PHP Bug Type:     PCRE related
Bug description:  magic_quotes_sybase switched on breaks the use of /e modifier 
in preg_replace

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 bug report at http://bugs.php.net/?id=33200&edit=1
-- 
Try a CVS snapshot (php4):   http://bugs.php.net/fix.php?id=33200&r=trysnapshot4
Try a CVS snapshot (php5.0): 
http://bugs.php.net/fix.php?id=33200&r=trysnapshot50
Try a CVS snapshot (php5.1): 
http://bugs.php.net/fix.php?id=33200&r=trysnapshot51
Fixed in CVS:                http://bugs.php.net/fix.php?id=33200&r=fixedcvs
Fixed in release:            http://bugs.php.net/fix.php?id=33200&r=alreadyfixed
Need backtrace:              http://bugs.php.net/fix.php?id=33200&r=needtrace
Need Reproduce Script:       http://bugs.php.net/fix.php?id=33200&r=needscript
Try newer version:           http://bugs.php.net/fix.php?id=33200&r=oldversion
Not developer issue:         http://bugs.php.net/fix.php?id=33200&r=support
Expected behavior:           http://bugs.php.net/fix.php?id=33200&r=notwrong
Not enough info:             
http://bugs.php.net/fix.php?id=33200&r=notenoughinfo
Submitted twice:             
http://bugs.php.net/fix.php?id=33200&r=submittedtwice
register_globals:            http://bugs.php.net/fix.php?id=33200&r=globals
PHP 3 support discontinued:  http://bugs.php.net/fix.php?id=33200&r=php3
Daylight Savings:            http://bugs.php.net/fix.php?id=33200&r=dst
IIS Stability:               http://bugs.php.net/fix.php?id=33200&r=isapi
Install GNU Sed:             http://bugs.php.net/fix.php?id=33200&r=gnused
Floating point limitations:  http://bugs.php.net/fix.php?id=33200&r=float
No Zend Extensions:          http://bugs.php.net/fix.php?id=33200&r=nozend
MySQL Configuration Error:   http://bugs.php.net/fix.php?id=33200&r=mysqlcfg

Reply via email to