Bug #51845 [Fbk->Csd]: preg_replace_callback anonymous function issue

From: Date: Sun, 08 Aug 2010 22:56:31 +0000
Subject: Bug #51845 [Fbk->Csd]: preg_replace_callback anonymous function issue
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-153252@lists.php.net to get a copy of this message
Edit report at http://bugs.php.net/bug.php?id=51845&edit=1

 ID:                 51845
 Updated by:         felipe@php.net
 Reported by:        jerry at jmweb dot net
 Summary:            preg_replace_callback anonymous function issue
-Status:             Feedback
+Status:             Closed
 Type:               Bug
 Package:            Unknown/Other Function
 Operating System:   Linux
 PHP Version:        5.3.2
-Assigned To:        
+Assigned To:        felipe
 Block user comment: N

 New Comment:

'helloWorld' is what you get on 5.3.3.

Thanks.


Previous Comments:
------------------------------------------------------------------------
[2010-05-19 15:12:40] mike@php.net

Please try using this snapshot:

  http://snaps.php.net/php5.3-latest.tar.gz
 
For Windows:

  http://windows.php.net/snapshots/

Works here.

------------------------------------------------------------------------
[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)

« previous php.bugs (#153252) next »