ID: 25649 Updated by: [EMAIL PROTECTED] Reported By: lew at mailduct dot com -Status: Open +Status: Feedback Bug Type: Filesystem function related Operating System: FreeBSD 4.8-RELEASE PHP Version: 4.3.3 New Comment:
Please try using this CVS snapshot: http://snaps.php.net/php4-STABLE-latest.tar.gz For Windows: http://snaps.php.net/win32/php4-win32-STABLE-latest.zip You propably had some transfer errors there. Latest stable snapshot works fine here. Previous Comments: ------------------------------------------------------------------------ [2003-09-25 18:15:36] lew at mailduct dot com There's a problem with the snapshot: http://snaps.php.net/php4-STABLE-latest.tar.gz sys5# gunzip php4-STABLE-latest.tar.gz gunzip: php4-STABLE-latest.tar.gz: invalid compressed data--crc error ... also tried tar's uncompress flag: sys5# tar -xvzf ../php4-STABLE-latest.tar.gz php4-STABLE-200309252130/ php4-STABLE-200309252130/acconfig.h php4-STABLE-200309252130/aclocal.m4 php4-STABLE-200309252130/configure tar: Skipping to next header tar: Archive contains obsolescent base-64 headers gzip: stdin: invalid compressed data--crc error tar: Child returned status 1 tar: Error exit delayed from previous errors To make sure, I deleted and downloaded the file again, and the crc problem remained. I do have a question, however... do you know if the latest snapshot actually addressed this issue, or is "try the latest snapshot" just a standard reponse? Thanks again. ------------------------------------------------------------------------ [2003-09-25 06:09:56] [EMAIL PROTECTED] Please try using this CVS snapshot: http://snaps.php.net/php4-STABLE-latest.tar.gz For Windows: http://snaps.php.net/win32/php4-win32-STABLE-latest.zip ------------------------------------------------------------------------ [2003-09-24 20:17:03] lew at mailduct dot com My typo. Make that: $fh = fopen( '/var/log/maillog','r' ); ------------------------------------------------------------------------ [2003-09-24 20:12:15] lew at mailduct dot com Description: ------------ The behavior of "feof" has changed with the newer versions of PHP (4.1.1 exhibited different behavior). I believe 4.3.X has a problem with how it handles "feof" under FreeBSD. For example, suppose I want to "tail" a logfile that keeps growing, such as "maillog" or even "httpd-access.log". In the old PHP, once I reached the end of file, "feof" would become true. If a process *added* to the file, then "feof" would become false until I read to the end of the file again. This is consistent with "tail" behavior. Under the new PHP (4.3.X), once "feof" becomes true, it *never* goes false again. Thus, it is *impossible* to "tail" a file!! Reproduce code: --------------- <?php $fh = fopen( '/var/log/maillog' ); // Endless loop, for testing purposes while( TRUE ) { // Perform a "tail" on a growing logfile while( !feof($fh) ) { $log = fgets( $fh,512 ); print( $log ); } // We've hit the end, until more data ready print( "EOF detected... sleeping\n" ); sleep( 1 ); } ?> Expected result: ---------------- I expect to see all the lines contained in maillog until we hit the EOF. Then I expect to see the "EOF detected" until more lines are added to maillog via another process. At that point, I expect to see the new lines of data until we hit the new EOF point again. If I replace "fopen" with "popen" like this: $fh = popen( 'tail -f /var/log/maillog','r' ); then it works. But I shouldn't have to spawn off a tail to do what the older 4.1.X version of PHP used to do. Someone has changed something in how EOF is detected (and reset). Can you please see if you can find the cause of this. Thank you for listening. Actual result: -------------- test line 1 test line 2 test line 3 EOF detected... sleeping EOF detected... sleeping EOF detected... sleeping ... forever ... EOF detected... sleeping (even though maillog continues to have more lines appended to it, either through a daemon or a simple "cat more.txt >> /var/log/maillog" ). ------------------------------------------------------------------------ -- Edit this bug report at http://bugs.php.net/?id=25649&edit=1