|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
[2008-01-28 22:57 UTC] tony2001@php.net
|
|||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Sat Oct 25 17:00:01 2025 UTC |
Description: ------------ This change of PHP Manual example results in Apache crash. Apache/1.3.27, PHP 5.2.5. PHP4 - the same. Reproduce code: --------------- <?php $arResults = array(); $text = "April fools day is 04/01/2002\n"; $text .= "Last christmas was 12/24/2001\n"; function next_year($matches) { global $arResults; $arResults[] = $matches; return $matches[2]; } echo preg_replace_callback( "/(April|Last) ([\S]*)/", "next_year", $text); echo '<pre>'; print_r($arResults); echo '</pre>'; ?> Expected result: ---------------- fools day is 04/01/2002 christmas was 12/24/2001 Array ( [0] => Array ( [0] => April fools [1] => April [2] => fools ) [1] => Array ( [0] => Last christmas [1] => Last [2] => christmas ) ) Actual result: -------------- Apache crash