From:             cristian dot melendez at gmail dot com
Operating system: Windows XP
PHP version:      5.0.1
PHP Bug Type:     Regexps related
Bug description:  preg_replace() and /e modifier not working with classes

Description:
------------
i'm using preg_replace() with the /e modifier to force php code to be run
at the replacement.

preg_replace() and /e won't work if, instead of a regular function, i use
a class object.

Reproduce code:
---------------
code shown in http://www.php.net/preg_replace
<?php
preg_replace("/(<\/?)(\w+)([^>]*>)/e", 
             "'\\1' . strtoupper('\\2') . '\\3'", 
             $html_body);
?>

my code:
<?php
 $someclass = new someclass();
preg_replace("/(<\/?)(\w+)([^>]*>)/e", 
             "'\\1' . $someclass->somefunction('\\2') . '\\3'", 
             $html_body);
?>

Expected result:
----------------
preg_replace ignores $someclass->somefunction() and just returns the text.


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

Reply via email to