From: alexey at gmail dot com Operating system: linux PHP version: 4.4.7 PHP Bug Type: *General Issues Bug description: preg_match_all does not find all matches
Description: ------------ I am unable to upgrade to 4.4.7 at this point. I am using 4.4.6 but the release notes did not include this problem as being fixed so I am reporting it now. The code tries to find all tags, but it finds only few of them after spending a lot of CPU cycles. Reproduce code: --------------- <? $data = " <HTML xmlns=\"http://www.w3.org/1999/xhtml\" lang=\"en\"> <body> <P>It's now possible to download whole Flash and WPF sites and run them when you want. One example is the <EM>New York Times</EM> Reader, for which I did some sketches, and which was reviewed on TechnologyReview.com <EM>(see \"<A href=http://www.technologyreview.com/Infotech/16760\"/>The </a> </em> <a href=\"http://www.technologyreview.com/Infotech/16760/\">Times </a> <em> <a href=\"http://www.technologyreview.com/Infotech/16760/\"> Emulates Print on the Web</a>, </BODY> </HTML> "; preg_match_all("#</?([[:alpha:]]+)[[:space:]]*([^\">]*|(\"[^\">]*\"))*>#", $data, $matches, PREG_OFFSET_CAPTURE); print_r($matches[0]); ?> Expected result: ---------------- It should include the following tags but it does not: [5] => Array ( [0] => </a> [1] => 350 ) [6] => Array ( [0] => </em> [1] => 355 ) [7] => Array ( [0] => </a> [1] => 425 ) [8] => Array ( [0] => <em> [1] => 430 ) [9] => Array ( [0] => </a> [1] => 519 ) [10] => Array ( [0] => </BODY> [1] => 527 ) [11] => Array ( [0] => </HTML> [1] => 535 ) Actual result: -------------- [0] => Array ( [0] => <HTML xmlns="http://www.w3.org/1999/xhtml" lang="en"> [1] => 2 ) [1] => Array ( [0] => <body> [1] => 56 ) [2] => Array ( [0] => <P> [1] => 63 ) [3] => Array ( [0] => <EM> [1] => 169 ) [4] => Array ( [0] => </EM> [1] => 187 ) [5] => Array ( [0] => <EM> [1] => 279 ) -- Edit bug report at http://bugs.php.net/?id=41385&edit=1 -- Try a CVS snapshot (PHP 4.4): http://bugs.php.net/fix.php?id=41385&r=trysnapshot44 Try a CVS snapshot (PHP 5.2): http://bugs.php.net/fix.php?id=41385&r=trysnapshot52 Try a CVS snapshot (PHP 6.0): http://bugs.php.net/fix.php?id=41385&r=trysnapshot60 Fixed in CVS: http://bugs.php.net/fix.php?id=41385&r=fixedcvs Fixed in release: http://bugs.php.net/fix.php?id=41385&r=alreadyfixed Need backtrace: http://bugs.php.net/fix.php?id=41385&r=needtrace Need Reproduce Script: http://bugs.php.net/fix.php?id=41385&r=needscript Try newer version: http://bugs.php.net/fix.php?id=41385&r=oldversion Not developer issue: http://bugs.php.net/fix.php?id=41385&r=support Expected behavior: http://bugs.php.net/fix.php?id=41385&r=notwrong Not enough info: http://bugs.php.net/fix.php?id=41385&r=notenoughinfo Submitted twice: http://bugs.php.net/fix.php?id=41385&r=submittedtwice register_globals: http://bugs.php.net/fix.php?id=41385&r=globals PHP 3 support discontinued: http://bugs.php.net/fix.php?id=41385&r=php3 Daylight Savings: http://bugs.php.net/fix.php?id=41385&r=dst IIS Stability: http://bugs.php.net/fix.php?id=41385&r=isapi Install GNU Sed: http://bugs.php.net/fix.php?id=41385&r=gnused Floating point limitations: http://bugs.php.net/fix.php?id=41385&r=float No Zend Extensions: http://bugs.php.net/fix.php?id=41385&r=nozend MySQL Configuration Error: http://bugs.php.net/fix.php?id=41385&r=mysqlcfg