|  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #30709 preg_replace() and /e modifier not working with classes
Submitted: 2004-11-07 05:50 UTC Modified: 2004-11-07 08:24 UTC
From: cristian dot melendez at gmail dot com Assigned:
Status: Not a bug Package: Regexps related
PHP Version: 5.0.1 OS: Windows XP
Private report: No CVE-ID: None
View Add Comment Developer Edit
Welcome! If you don't have a Git account, you can't do anything here.
You can add a comment by following this link or if you reported this bug, you can edit this bug over here.
Block user comment
Status: Assign to:
Bug Type:
From: cristian dot melendez at gmail dot com
New email:
PHP Version: OS:


 [2004-11-07 05:50 UTC] cristian dot melendez at gmail dot com
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
             "'\\1' . strtoupper('\\2') . '\\3'", 

my code:
 $someclass = new someclass();
             "'\\1' . $someclass->somefunction('\\2') . '\\3'", 

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


Add a Patch

Pull Requests

Add a Pull Request


AllCommentsChangesGit/SVN commitsRelated reports
 [2004-11-07 08:24 UTC]
Thank you for taking the time to write to us, but this is not
a bug. Please double-check the documentation available at and the instructions on how to report
a bug at

PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Sun Mar 03 04:01:28 2024 UTC