#30709 [Opn->Bgs]: preg_replace() and /e modifier not working with classes

From: Date: Sun, 07 Nov 2004 07:24:44 +0000
Subject: #30709 [Opn->Bgs]: preg_replace() and /e modifier not working with classes
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-68772@lists.php.net to get a copy of this message
ID: 30709 Updated by: derick@php.net Reported By: cristian dot melendez at gmail dot com -Status: Open +Status: Bogus Bug Type: Regexps related Operating System: Windows XP PHP Version: 5.0.1 New Comment: Thank you for taking the time to write to us, but this is not a bug. Please double-check the documentation available at http://www.php.net/manual/ and the instructions on how to report a bug at http://bugs.php.net/how-to-report.php . Previous Comments: ------------------------------------------------------------------------ [2004-11-07 05:50:01] cristian dot melendez at gmail dot com 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 this bug report at http://bugs.php.net/?id=30709&edit=1

« previous php.bugs (#68772) next »