|   | php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login | 
| 
 PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits              [2008-11-25 12:12 UTC] patrik dot hirvinen at nemein dot com
  [2008-11-25 12:20 UTC] scottmac@php.net
 | |||||||||||||||||||||||||||
|  Copyright © 2001-2025 The PHP Group All rights reserved. | Last updated: Fri Oct 31 04:00:01 2025 UTC | 
Description: ------------ preg_match fails for some patterns when the searched string exceeds around 100300 bytes. It matches for same strings if enough text is removed from the middle part which gets captured by the pattern when working correctly. Also the exact same regexp works fine for perl on unshortened output. Reproduce code: --------------- <?php //foo.html >= 100 kB $contents = file_get_contents("foo.html"); $matches = array(); preg_match('%<BODY\s*>.*?</H[1-6]>(.+?)</BODY>%si', $contents, $matches); //$matches is empty var_dump($matches); ?> Expected result: ---------------- array(1) { [0]=> string(12935) "/*lots of html*/ } Actual result: -------------- array(0) { }