Bug #51845 [Opn->Fbk]: preg_replace_callback anonymous function issue
Edit report at http://bugs.php.net/bug.php?id=51845&edit=1
ID: 51845
Updated by: mike@php.net
Reported by: jerry at jmweb dot net
Summary: preg_replace_callback anonymous function issue
-Status: Open
+Status: Feedback
Type: Bug
Package: Unknown/Other Function
Operating System: Linux
PHP Version: 5.3.2
New Comment:
Please try using this snapshot:
http://snaps.php.net/php5.3-latest.tar.gz
For Windows:
http://windows.php.net/snapshots/
Works here.
Previous Comments:
------------------------------------------------------------------------
[2010-05-17 18:30:10] jerry at jmweb dot net
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 this bug report at http://bugs.php.net/bug.php?id=51845&edit=1
Thread (3 messages)