php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #41815 Concurrent read/write fails when EOF is reached
Submitted: 2007-06-26 18:56 UTC Modified: 2007-07-12 11:01 UTC
From: mpb dot mail at gmail dot com Assigned:
Status: Closed Package: Streams related
PHP Version: 5.2.3 OS: Linux 2.6
Private report: No CVE-ID: None
View Add Comment Developer Edit
Anyone can comment on a bug. Have a simpler test case? Does it work for you on a different platform? Let us know!
Just going to say 'Me too!'? Don't clutter the database with that please !
Your email address:
MUST BE VALID
Solve the problem:
26 + 36 = ?
Subscribe to this entry?

 
 [2007-06-26 18:56 UTC] mpb dot mail at gmail dot com
Description:
------------
If you fread() to the end of a file, and then additional bytes are appended to the file, future calls to fread() never return the appended bytes.

This problem may have started with PHP 5.2.0.
This problem still exists in PHP 5.2.3.

PHP 4.4.7 does NOT suffer from this problem.


Reproduce code:
---------------
<?php

$f = fopen ('test', 'w');
$g = fopen ('test', 'r');

fwrite ($f, "This is line 1.\n");
fflush ($f);

print fread ($g, 100);

fwrite ($f, "This is line 2.\n");
fflush ($f);

print fread ($g, 100);

?>


Expected result:
----------------
This is line 1.
This is line 2.


Actual result:
--------------
This is line 1.

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2007-07-12 11:01 UTC] jani@php.net
This bug has been fixed in CVS.

Snapshots of the sources are packaged every three hours; this change
will be in the next snapshot. You can grab the snapshot at
http://snaps.php.net/.
 
Thank you for the report, and for helping us make PHP better.


 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Thu Mar 28 23:01:26 2024 UTC