ID: 26454
Updated by: wez@php.net
Reported By: nunoplopes at sapo dot pt
-Status: Open
+Status: Closed
Bug Type: Sockets related
Operating System: Windows XP - Apache
PHP Version: 4CVS-2003-11-30
Assigned To: wez
New Comment:
In that case, this is the expected behaviour; the connection has not
closed, so feof() returns false.
fgets will time out because it will wait a maximum of 60 seconds (by
default; the default_socket_timeout ini setting configures this). It
does not return false because it has not hit an error; it merely does
not have any data before your timeout period expires (this is a
feature).
It is your responsibility to implement the network protocol correctly
(PHP cannot read your mind, not that of the CVS server); if you expect
only two lines, then you should read only two lines.
Previous Comments:
------------------------------------------------------------------------
[2003-11-30 06:15:12] nunoplopes at sapo dot pt
The connection stays open and waiting.
------------------------------------------------------------------------
[2003-11-30 06:10:25] wez@php.net
does it return two lines and close the connection, or return two lines
and wait for you to send more data?
------------------------------------------------------------------------
[2003-11-30 05:47:15] nunoplopes at sapo dot pt
In the manual it says:
"If an error occurs, returns FALSE." (http://php.net/fgets)
The cvs server should only returns two lines. So, if I call fgets a
third time, it times out and I think it should return FALSE.
And feof doesn't work either, so I never know if the server's reponse
has ended or not...
------------------------------------------------------------------------
[2003-11-30 05:35:05] wez@php.net
I don't have intimate knowledge of the cvs pserver protocol... why
should it return false instead of timeout?
------------------------------------------------------------------------
[2003-11-30 05:26:00] nunoplopes at sapo dot pt
The first example I wrote (in reproduce code) is a good example.
I echo fgets 3 times and it times out in the third fgets. Instead of
timing ou, it should return FALSE.
------------------------------------------------------------------------
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/26454--
Edit this bug report at http://bugs.php.net/?id=26454&edit=1