Bug #17264: Cannot call a method of the local class from preg_replace with /e option.

From: Date: Thu, 16 May 2002 02:15:12 +0000
Subject: Bug #17264: Cannot call a method of the local class from preg_replace with /e option.
Groups: php.bugs 
Request: Send a blank email to php-bugs+get-7812@lists.php.net to get a copy of this message
From: sal@stodge.org Operating system: Linux PHP version: 4.2.1 PHP Bug Type: Class/Object related Bug description: Cannot call a method of the local class from preg_replace with /e option. If you use preg_replace with the /e option from within a class you may want to call a method of the current class to perform the lookup. Intuativly a user might expect this code to work: $whatever=preg_replace( $pattern,"$this->whatever('\\1')", $value ); That 2nd parameter is being evaluated outside the current class... In this context "$this" has no meaning outside the object, So a method like "$this->whatever{foo)" can never be evaluated directly by this command. The function works fine if you use it according to the instructions - that is you provide it with a globally available function it will work perfectly. To check version & config of the my offending server: http://sharesite.stodge.org/test.php -- Edit bug report at http://bugs.php.net/?id=17264&edit=1 -- Fixed in CVS: http://bugs.php.net/fix.php?id=17264&r=fixedcvs Fixed in release: http://bugs.php.net/fix.php?id=17264&r=alreadyfixed Need backtrace: http://bugs.php.net/fix.php?id=17264&r=needtrace Try newer version: http://bugs.php.net/fix.php?id=17264&r=oldversion Not developer issue: http://bugs.php.net/fix.php?id=17264&r=support Expected behavior: http://bugs.php.net/fix.php?id=17264&r=notwrong Not enough info: http://bugs.php.net/fix.php?id=17264&r=notenoughinfo Submitted twice: http://bugs.php.net/fix.php?id=17264&r=submittedtwice register_globals: http://bugs.php.net/fix.php?id=17264&r=globals

« previous php.bugs (#7812) next »