From:             imscorpio at hotmail dot com
Operating system: Windows 2000 Pro
PHP version:      4.3.3
PHP Bug Type:     Filesystem function related
Bug description:  strpos doesn't know if the file reached EOF

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

-- 
Edit bug report at http://bugs.php.net/?id=25781&edit=1
-- 
Try a CVS snapshot (php4):  http://bugs.php.net/fix.php?id=25781&r=trysnapshot4
Try a CVS snapshot (php5):  http://bugs.php.net/fix.php?id=25781&r=trysnapshot5
Fixed in CVS:               http://bugs.php.net/fix.php?id=25781&r=fixedcvs
Fixed in release:           http://bugs.php.net/fix.php?id=25781&r=alreadyfixed
Need backtrace:             http://bugs.php.net/fix.php?id=25781&r=needtrace
Try newer version:          http://bugs.php.net/fix.php?id=25781&r=oldversion
Not developer issue:        http://bugs.php.net/fix.php?id=25781&r=support
Expected behavior:          http://bugs.php.net/fix.php?id=25781&r=notwrong
Not enough info:            http://bugs.php.net/fix.php?id=25781&r=notenoughinfo
Submitted twice:            http://bugs.php.net/fix.php?id=25781&r=submittedtwice
register_globals:           http://bugs.php.net/fix.php?id=25781&r=globals
PHP 3 support discontinued: http://bugs.php.net/fix.php?id=25781&r=php3
Daylight Savings:           http://bugs.php.net/fix.php?id=25781&r=dst
IIS Stability:              http://bugs.php.net/fix.php?id=25781&r=isapi
Install GNU Sed:            http://bugs.php.net/fix.php?id=25781&r=gnused
Floating point limitations: http://bugs.php.net/fix.php?id=25781&r=float

Reply via email to