Bug #51845 [NEW]: preg_replace_callback anonymous function issue
From:
Operating system: Linux
PHP version: 5.3.2
Package: Unknown/Other Function
Bug Type: Bug
Bug description:preg_replace_callback anonymous function issue
Description:
------------
Using an anonymous function as argument #2 in preg_replace_callback issues
the following warning:
preg_replace_callback() [function.preg-replace-callback]: Requires argument
2, '', to be a valid callback
This warning was not thrown previously using PHP 5.3.1
Test script:
---------------
echo preg_replace_callback('~-([a-z])~', function ($match) {
return strtoupper($match[1]);
}, 'hello-world');
Expected result:
----------------
helloworld
Actual result:
--------------
hello-world + warning
--
Edit bug report at http://bugs.php.net/bug.php?id=51845&edit=1
--
Try a snapshot (PHP 5.2): http://bugs.php.net/fix.php?id=51845&r=trysnapshot52
Try a snapshot (PHP 5.3): http://bugs.php.net/fix.php?id=51845&r=trysnapshot53
Try a snapshot (PHP 6.0): http://bugs.php.net/fix.php?id=51845&r=trysnapshot60
Fixed in SVN: http://bugs.php.net/fix.php?id=51845&r=fixed
Fixed in SVN and need be documented: http://bugs.php.net/fix.php?id=51845&r=needdocs
Fixed in release: http://bugs.php.net/fix.php?id=51845&r=alreadyfixed
Need backtrace: http://bugs.php.net/fix.php?id=51845&r=needtrace
Need Reproduce Script: http://bugs.php.net/fix.php?id=51845&r=needscript
Try newer version: http://bugs.php.net/fix.php?id=51845&r=oldversion
Not developer issue: http://bugs.php.net/fix.php?id=51845&r=support
Expected behavior: http://bugs.php.net/fix.php?id=51845&r=notwrong
Not enough info: http://bugs.php.net/fix.php?id=51845&r=notenoughinfo
Submitted twice: http://bugs.php.net/fix.php?id=51845&r=submittedtwice
register_globals: http://bugs.php.net/fix.php?id=51845&r=globals
PHP 4 support discontinued: http://bugs.php.net/fix.php?id=51845&r=php4
Daylight Savings: http://bugs.php.net/fix.php?id=51845&r=dst
IIS Stability: http://bugs.php.net/fix.php?id=51845&r=isapi
Install GNU Sed: http://bugs.php.net/fix.php?id=51845&r=gnused
Floating point limitations: http://bugs.php.net/fix.php?id=51845&r=float
No Zend Extensions: http://bugs.php.net/fix.php?id=51845&r=nozend
MySQL Configuration Error: http://bugs.php.net/fix.php?id=51845&r=mysqlcfg
Thread (3 messages)
- jerry at jmweb dot net