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
