|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
[2003-10-07 15:46 UTC] jay@php.net
|
|||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Sat Oct 25 22:00:01 2025 UTC |
Description: ------------ If you loop a file line by line and searching with strpos() it doesn't know if the file has ended, reached EOF. It will contiue untill crash... Reproduce code: --------------- //scritp.php <?php $my_position = int; $haystack = $file_line[$my_position]; $position = strpos ( $haystack, $needle ); while ($position === false){ $my_position++; $haystack = $file_line[$my_position]; $position = strpos ( $haystack, $needle ); } ?> Expected result: ---------------- Nothing to read from or the $haystack has passed the EOF. Actual result: -------------- Fatal error: Maximum execution time of 30 seconds exceeded in script.php on line 9 Any line within the while() during 30sec it can go up to 65.000 - 70.000 lines