|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
[2007-08-27 11:17 UTC] jani@php.net
[2011-01-14 17:12 UTC] php at richardneill dot org
|
|||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Sat Oct 25 18:00:02 2025 UTC |
Description: ------------ PHP5/PCRE will fail to match on long strings when UNGREEDY, the boundary is around 100k of data. FWIW, same results if you change x* to x+ down there. Reproduce code: --------------- <?php $data=sprintf("<span>%s</span>",str_repeat("x",99996)); var_dump(preg_match("#<span>(x*?)</span>#",$data)); $data=sprintf("<span>%s</span>",str_repeat("x",99997)); var_dump(preg_match("#<span>(x*?)</span>#",$data)); $data=sprintf("<span>%s</span>",str_repeat("x",99997)); var_dump(preg_match("#<span>(x*)</span>#U",$data)); $data=sprintf("<span>%s</span>",str_repeat("x",99997)); var_dump(preg_match("#<span>(x*)</span>#",$data)); ?> Expected result: ---------------- all 4 expressions should match, this is what occurs with PHP 4.4.7. Actual result: -------------- under PHP 5.2.3: only the first and 4th expression match under PHP 4.4.7: all 4 match.