Edit report at http://bugs.php.net/bug.php?id=51845&edit=1
ID: 51845 Updated by: fel...@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] m...@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