|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
[2007-10-01 09:11 UTC] scottmac@php.net
|
|||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Sat Nov 29 00:00:01 2025 UTC |
Description: ------------ When executing preg_replace on a string over 32,205 bytes and no double line breaks with the following expression, the function neither matches nor returns the original string. preg_last_error() doesn't indicate any preg related errors. Reproduce code: --------------- error_reporting(E_ALL); $original_string = "This is a preg_replace bug.\n"; $string = ''; $i = 0; while($i < 1177) { $string .= $original_string; preg_replace('/\n?(.+?)(?:\n\s*\n|\z)/s', "foo", $string,-1,$count); if($count == 0) { echo "I broke at count: $i\n"; exit; } $i++; } echo "I didn't break at count: $i\n"; echo preg_last_error(); Expected result: ---------------- I didn't break at count: 1176. Actual result: -------------- I broke at count: 1176