#32858 [NEW]: Bug #25649 has crept back into PHP - Improper feof() handling under FreeBSD
| From: | lew at mailduct dot com | Date: | Wed, 27 Apr 2005 19:36:48 +0000 |
| Subject: | #32858 [NEW]: Bug #25649 has crept back into PHP - Improper feof() handling under FreeBSD | ||
| Groups: | php.bugs | ||
| Request: | Send a blank email to php-bugs+get-78310@lists.php.net to get a copy of this message | ||
From: lew at mailduct dot com
Operating system: FreeBSD 4.11-REL
PHP version: 4.3.10
PHP Bug Type: Filesystem function related
Bug description: Bug #25649 has crept back into PHP - Improper feof() handling under FreeBSD
Description:
------------
In my prior bug report #25649 from September 2003, I pointed out a serious
bug in how PHP handles FEOF under FreeBSD. It was fixed by wez@php.net and
committed.
This same problem (improper handling of feof() by PHP under FreeBSD) has
now crept into current 4.3.X versions of PHP...
Problem: Once set, the FEOF indicator is not properly cleared when more
data is appended to a file that is opened for read by a PHP application.
Example: Suppose I want to "tail" a file using PHP. Once I hit the EOF,
I will no longer be able to read data from that file even when another
application appends to it. This is not the correct behaviour for feof(),
as illustrated by the prior fix done by wez@php.net.
Reproduce code:
---------------
--- program:
$fp = fopen( '/var/log/maillog','r' );
while( TRUE ) {
$r = array( $fp );
$n = stream_select( $r,$w=NULL,$e=NULL,30 );
if( $n ) {
echo fgets( $fp );
}
}
--- feeder:
echo "This is a test..." >> /var/log/maillog
Expected result:
----------------
For as long as PROGRAM is running, each time I run
FEEDER I expect to see PROGRAM output "This is a test..."
but it does not, because once EOF is reached, it is not
properly reset upon more data being appended to the file.
See pr #25649 for historical info...
Actual result:
--------------
PROGRAM will read the contents of /var/log/maillog until it
reaches EOF, and will not output anything else, even if new
data is appeneded to the file.
--
Edit bug report at http://bugs.php.net/?id=32858&edit=1
--
Try a CVS snapshot (php4): http://bugs.php.net/fix.php?id=32858&r=trysnapshot4
Try a CVS snapshot (php5.0): http://bugs.php.net/fix.php?id=32858&r=trysnapshot50
Try a CVS snapshot (php5.1): http://bugs.php.net/fix.php?id=32858&r=trysnapshot51
Fixed in CVS: http://bugs.php.net/fix.php?id=32858&r=fixedcvs
Fixed in release: http://bugs.php.net/fix.php?id=32858&r=alreadyfixed
Need backtrace: http://bugs.php.net/fix.php?id=32858&r=needtrace
Need Reproduce Script: http://bugs.php.net/fix.php?id=32858&r=needscript
Try newer version: http://bugs.php.net/fix.php?id=32858&r=oldversion
Not developer issue: http://bugs.php.net/fix.php?id=32858&r=support
Expected behavior: http://bugs.php.net/fix.php?id=32858&r=notwrong
Not enough info: http://bugs.php.net/fix.php?id=32858&r=notenoughinfo
Submitted twice: http://bugs.php.net/fix.php?id=32858&r=submittedtwice
register_globals: http://bugs.php.net/fix.php?id=32858&r=globals
PHP 3 support discontinued: http://bugs.php.net/fix.php?id=32858&r=php3
Daylight Savings: http://bugs.php.net/fix.php?id=32858&r=dst
IIS Stability: http://bugs.php.net/fix.php?id=32858&r=isapi
Install GNU Sed: http://bugs.php.net/fix.php?id=32858&r=gnused
Floating point limitations: http://bugs.php.net/fix.php?id=32858&r=float
No Zend Extensions: http://bugs.php.net/fix.php?id=32858&r=nozend
MySQL Configuration Error: http://bugs.php.net/fix.php?id=32858&r=mysqlcfg