#26454 [Fbk-Opn]: feof and fgets hangs out
ID: 26454 User updated by: nunoplopes at sapo dot pt Reported By: nunoplopes at sapo dot pt -Status: Feedback +Status: Open Bug Type: Sockets related Operating System: Windows XP - Apache PHP Version: 4CVS-2003-11-30 Assigned To: wez New Comment: 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. Previous Comments: [2003-11-30 05:22:46] [EMAIL PROTECTED] Please, just a single script, and please explain what happens and why it is wrong. [2003-11-30 05:14:18] nunoplopes at sapo dot pt I've compiled a couple of tests and its results on my pc, using the snapshot of Nov 30, 2003 09:30 GMT. The tests andits results are at: http://testes.aborla.net/php-bugreport.tar.bz2 [2003-11-30 04:33:06] [EMAIL PROTECTED] Can you clarify what is happening now (with the updated snapshot)? Provide a short script and explain what happens and why you think it is wrong. Thanks! [2003-11-29 14:59:41] nunoplopes at sapo dot pt I've installed the new snapshot (Nov 29, 2003 17:30 GMT). The script still times out. The example I wrote before still doesn't work, but there is other with feof that works. Really strange Working script: ? $fp = fsockopen (pt.php.net, 80, $errno, $errstr, 30); if (!$fp) { echo $errstr ($errno)br\n; } else { fputs ($fp, GET / HTTP/1.1\r\n); fputs ($fp, Host: pt.php.net\r\n); fputs ($fp, Connection: Close\r\n\r\n); while (!feof($fp)) { echo fgets ($fp,128); } fclose ($fp); } ? [2003-11-28 17:26:23] [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 Please try the snapshot that will be generated in about 4 hours (from the time of this post). 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=26454edit=1
#26454 [Fbk-Opn]: feof and fgets hangs out
ID: 26454 User updated by: nunoplopes at sapo dot pt Reported By: nunoplopes at sapo dot pt -Status: Feedback +Status: Open Bug Type: Sockets related Operating System: Windows XP - Apache PHP Version: 4CVS-2003-11-30 Assigned To: wez New Comment: 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... Previous Comments: [2003-11-30 05:35:05] [EMAIL PROTECTED] 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. [2003-11-30 05:22:46] [EMAIL PROTECTED] Please, just a single script, and please explain what happens and why it is wrong. [2003-11-30 05:14:18] nunoplopes at sapo dot pt I've compiled a couple of tests and its results on my pc, using the snapshot of Nov 30, 2003 09:30 GMT. The tests andits results are at: http://testes.aborla.net/php-bugreport.tar.bz2 [2003-11-30 04:33:06] [EMAIL PROTECTED] Can you clarify what is happening now (with the updated snapshot)? Provide a short script and explain what happens and why you think it is wrong. Thanks! 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=26454edit=1
#26454 [Fbk-Opn]: feof and fgets hangs out
ID: 26454 User updated by: nunoplopes at sapo dot pt Reported By: nunoplopes at sapo dot pt -Status: Feedback +Status: Open Bug Type: Sockets related Operating System: Windows XP - Apache PHP Version: 4CVS-2003-11-30 Assigned To: wez New Comment: The connection stays open and waiting. Previous Comments: [2003-11-30 06:10:25] [EMAIL PROTECTED] 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] [EMAIL PROTECTED] 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. [2003-11-30 05:22:46] [EMAIL PROTECTED] Please, just a single script, and please explain what happens and why it is wrong. 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=26454edit=1
#26454 [Fbk-Opn]: feof and fgets hangs out
ID: 26454 User updated by: nunoplopes at sapo dot pt Reported By: nunoplopes at sapo dot pt -Status: Feedback +Status: Open Bug Type: Sockets related Operating System: Windows XP - Apache -PHP Version: 4.3.4 +PHP Version: 4.3.5-dev New Comment: I've downloaded the latest cvs snapshot but the script continues to time out. In http://snaps.php.net/win32/compile-STABLE.log there is an error compiling main\network.c. Maybe its because of that error. Previous Comments: [2003-11-28 17:26:23] [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 Please try the snapshot that will be generated in about 4 hours (from the time of this post). [2003-11-28 15:17:56] nunoplopes at sapo dot pt Description: I opened a socket using fsockopen and then I send some data using fputs. Then I try to read data either using feof of fgets. If the servers returns 2 lines and I call three times the fgets(), the script times out when it reaches the 30 seconds. If I only call fgets 2 times, everything works fine. feof also stops the script execution. So, I have no way to know if servers' response has ended or not. Reproduce code: --- Get the code from CVS at: http://cvs.sourceforge.net/viewcvs.py/phpdocmanager/phpcvsclass/ Or just a small example: ? if ($handle = fsockopen (cvs.php.net, 2401, $errno, $errstr, 30)) { $text = BEGIN AUTH REQUEST\n; $text .= /repository\n; $text .= cvsread\n; $text .= A\n; $text .= END AUTH REQUEST\n; fputs ($handle, $text); fgets($handle); // I LOVE YOU\n fputs ($handle, version\n); echo fgets($handle); echo fgets($handle); echo fgets($handle); fclose($handle); } ? Expected result: M Concurrent Versions System (CVS) 1.12.2 (client/server)\n ok Actual result: -- timeout -- Edit this bug report at http://bugs.php.net/?id=26454edit=1
#26454 [Fbk-Opn]: feof and fgets hangs out
ID: 26454 User updated by: nunoplopes at sapo dot pt Reported By: nunoplopes at sapo dot pt -Status: Feedback +Status: Open Bug Type: Sockets related Operating System: Windows XP - Apache PHP Version: 4.3.5-dev New Comment: I've installed the new snapshot (Nov 29, 2003 17:30 GMT). The script still times out. The example I wrote before still doesn't work, but there is other with feof that works. Really strange Working script: ? $fp = fsockopen (pt.php.net, 80, $errno, $errstr, 30); if (!$fp) { echo $errstr ($errno)br\n; } else { fputs ($fp, GET / HTTP/1.1\r\n); fputs ($fp, Host: pt.php.net\r\n); fputs ($fp, Connection: Close\r\n\r\n); while (!feof($fp)) { echo fgets ($fp,128); } fclose ($fp); } ? Previous Comments: [2003-11-29 07:00:54] [EMAIL PROTECTED] oops; please try the next snapshot in 3.5 hours time. [2003-11-29 05:08:15] nunoplopes at sapo dot pt I've downloaded the latest cvs snapshot but the script continues to time out. In http://snaps.php.net/win32/compile-STABLE.log there is an error compiling main\network.c. Maybe its because of that error. [2003-11-28 17:26:23] [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 Please try the snapshot that will be generated in about 4 hours (from the time of this post). [2003-11-28 15:17:56] nunoplopes at sapo dot pt Description: I opened a socket using fsockopen and then I send some data using fputs. Then I try to read data either using feof of fgets. If the servers returns 2 lines and I call three times the fgets(), the script times out when it reaches the 30 seconds. If I only call fgets 2 times, everything works fine. feof also stops the script execution. So, I have no way to know if servers' response has ended or not. Reproduce code: --- Get the code from CVS at: http://cvs.sourceforge.net/viewcvs.py/phpdocmanager/phpcvsclass/ Or just a small example: ? if ($handle = fsockopen (cvs.php.net, 2401, $errno, $errstr, 30)) { $text = BEGIN AUTH REQUEST\n; $text .= /repository\n; $text .= cvsread\n; $text .= A\n; $text .= END AUTH REQUEST\n; fputs ($handle, $text); fgets($handle); // I LOVE YOU\n fputs ($handle, version\n); echo fgets($handle); echo fgets($handle); echo fgets($handle); fclose($handle); } ? Expected result: M Concurrent Versions System (CVS) 1.12.2 (client/server)\n ok Actual result: -- timeout -- Edit this bug report at http://bugs.php.net/?id=26454edit=1