ID: 24627 User updated by: duerra at yahoo dot com Reported By: duerra at yahoo dot com Status: Bogus Bug Type: Filesystem function related Operating System: XP Pro PHP Version: 4.3.3RC1 New Comment:
Just a comment from the "feof" reference, as a basic point: if ($fp = fopen($filename, 'r')) { while (!feof($fp)) { // ... } } That's exactly what I'm doing here (though the stating of the file pointer not moving is not explicitly stated, this is shown as working to a level that I have attempted to code...) Previous Comments: ------------------------------------------------------------------------ [2003-07-12 22:42:29] [EMAIL PROTECTED] There must have been some bug in previous versions, feof() never moves the file pointer so you end up in endless loop, of course. (I don't know where in the manual it's said it moves the file pointer..) ------------------------------------------------------------------------ [2003-07-12 22:39:43] duerra at yahoo dot com php.net's own manual shows that this should work. I'm not reading the file, but rather just gathering a count of each line. As I stated, this has always worked in previous versions of PHP, and is also many tutorials and books, including "PHP and MySQL Web Development" (as I am looking at the example right now) have shown an example almost identical to what I've posted here on how to do such looping and counting. I believe that the file pointer not moving is exactly the problem (please correct me if I'm wrong). Is that not a bug, and if not, what has changed between 4.3.2 and 4.3.3 that I have not noticed?? I see nothing of reference in the change log for 4.3.3 ------------------------------------------------------------------------ [2003-07-12 18:31:30] duerra at yahoo dot com This always worked correct in previous versions of PHP. It wasn't until the move to 4.3.3RC1 (from 4.3.2) that I had this infinite looping problem. ------------------------------------------------------------------------ [2003-07-12 18:28:42] [EMAIL PROTECTED] Thank you for taking the time to write to us, but this is not a bug. Please double-check the documentation available at http://www.php.net/manual/ and the instructions on how to report a bug at http://bugs.php.net/how-to-report.php Yes, b_ulrich is right. ------------------------------------------------------------------------ [2003-07-12 18:21:03] b_ulrich at t-online dot de Your example works correct: while(!feof($open)) { $count++; } must be an endless loop because the filepointer never moves. Maybe you should do an fread($open,1024); inside the while loop. Or what ever you want to count. ------------------------------------------------------------------------ The remainder of the comments for this report are too long. To view the rest of the comments, please view the bug report online at http://bugs.php.net/24627 -- Edit this bug report at http://bugs.php.net/?id=24627&edit=1