ID:               49838
 Updated by:       srina...@php.net
 Reported By:      travian dot utils at gmail dot com
-Status:           Verified
+Status:           Open
 Bug Type:         Sockets related
 Operating System: *
 PHP Version:      5.2.11
 New Comment:

this issue is no longer reproducible with latest svn snapshot
(http://snaps.php.net). pl. verify with latest snapshot and let us know.



Previous Comments:
------------------------------------------------------------------------

[2009-10-12 21:42:32] lbarn...@php.net

Verified (with gmc at sonologic dot nl's script), 5.2.11 only

------------------------------------------------------------------------

[2009-10-12 19:17:05] travian dot utils at gmail dot com 

Hello, Sjoerd.

Sorry for not fully clear description.

Thank you for interest to this problem.
gmc(at)sonologic(dot)nl understood my description and put code for
reproducing this problem. Thanks also to him.

Problem occurred when we updated PHP from 5.2.10 to 5.2.11 on our
production.
On PHP 5.2.10 problem code on the same server worked properly.
We tested problem code on the same server using PHP version 5.2.8 and
also code worked properly.

Now we rewrote our code for downloading big HTTP files without using
fgets(using socket_create, socket_bind, socket_connect, socket_select,
socket_write, socket_read and socket_close).
It works fine on PHP 5.2.8 and 5.2.11.

And it working fine in production on PHP 5.2.11.
So this is bug, not a configuration issue.

--
With best regards, 
Andrei.

------------------------------------------------------------------------

[2009-10-12 11:51:32] gmc at sonologic dot nl

I'm experiencing the same problem on:

FreeBSD 7.1-PRERELEASE FreeBSD 7.1-PRERELEASE #0: Tue Oct 14 11:55:05
CEST 2008     r...@postel:/usr/obj/usr/src/sys/GENERIC  i386

The problem is that feof($fp) returns TRUE, even though the end of the
remote file has not been reached.

The below script reproduces the problem. I'm sorry it depends on an
external resource, that's just the nature of the problem. AFAICS, the
bug is not dependent on the particular file chosen, it occurs for any
large text file.

<?php

        $trigger_bug=TRUE;

        $file = "http://www.mersenneforum.org/txt/43.txt";;

        if (!($fp = fopen($file, "r"))) {
                die("could not open XML input from $file");
        }

        $chunkno=1;
        $total=0;
        while($data=fgets($fp,10000)) {
                $total+=strlen($data);
                if($trigger_bug) {
                  print "chunk $chunkno, total ".$total."
(+".strlen($data)."), eof: ".(feof($fp)?1:0)."<br/>\n";
                } else {
                  print "chunk $chunkno, total ".$total."
(+".strlen($data).")<br/>\n";
                }
                $chunkno++;
        }
        fclose($fp);

?>

With $trigger_bug set to true, this will terminate before all of the
file is read. With $trigger_bug set to false it will read the entire
file. Note that the only difference between the two is that the script
displays the output of feof($fp).

This bug started to bite us when we upgraded from 5.2.1 to 5.2.11, it
is not present in 5.2.1 / 5.1.4.

------------------------------------------------------------------------

[2009-10-12 11:13:06] sjo...@php.net

Thank you for your bug report.

I don't understand the description you gave. Please make a small PHP
script to reproduce the problem and describe what the expected and
actual output are. Also, please explain exactly what is going wrong in
which PHP function.

------------------------------------------------------------------------

[2009-10-11 17:13:45] travian dot utils at gmail dot com 

Corrected summary.

------------------------------------------------------------------------

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/49838

-- 
Edit this bug report at http://bugs.php.net/?id=49838&edit=1

Reply via email to