ID: 21760 Comment by: hans at nyu dot edu Reported By: sunday at csh dot rit dot edu Status: No Feedback Bug Type: Sockets related Operating System: FreeBSD 4.7 PHP Version: 4.3.0 New Comment:
I'd like to supply some feedback to this bug. I'm operating in nearly an identical environment: FreeBSD 4.7-STABLE, PHP 4.3.1 CLI. It seems that specifying PHP_NORMAL_READ works, however it'll give an erroneous error: $buf = socket_read($csock,4096,PHP_NORMAL_READ); will yield: socket_read() unable to read from socket [54]: Connection reset by peer but: $buf = socket_read($csock,4096); will give no error. Now both the above situations are when less than 4096 bytes of data are written on the other end of the socket. If I specify a length of 5 and write 5, I don't believe I see the error, however, placing the PHP_NORMAL_READ call in a loop will iterate an extra time and cause the error again. I know my report is bit a scant, but I can supply any additional data if needed. Regards Previous Comments: ------------------------------------------------------------------------ [2003-03-09 18:49:39] [EMAIL PROTECTED] No feedback was provided. The bug is being suspended because we assume that you are no longer experiencing the problem. If this is not the case and you are able to provide the information that was requested earlier, please do so and change the status of the bug back to "Open". Thank you. ------------------------------------------------------------------------ [2003-02-28 06:56:44] chuck at fuck dot org I've upgraded to tonights CVS and still have the same problem with socket_read. The fix posted did work for 4.3.0 but i'm hesitant to use it again for obvious reasons. ------------------------------------------------------------------------ [2003-02-27 10:16:20] [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 Works fine here with latest stable CSV. The path you prose is bogus because it overwrites the 1st byte in t with a 0. ------------------------------------------------------------------------ [2003-02-05 21:13:53] chip at cyan dot com ah. found my windows 2000 socket_read bug: http://bugs.php.net/bug.php?id=21197 ------------------------------------------------------------------------ [2003-02-05 21:08:07] chip at cyan dot com I can repeat this bug. here is an example script that i used: http://force-elite.com/~chip/test/socket_phpreadnormal.phps it is a modification of the basic HTTP client given as an example in the PHP.net documentation. When PHP_NORMAL_READ is used, and certen buffer sizes, it will resuilt in socket_read returning bogus data, commonly all newlines(\n). On both a FreeBSD-4.7-stable(built Fri Nov 29), and FreeBSD-5.0-RC(built Wed Jan 8), both using PHP-4.3.0-cli, with a buffer size of 2048 it would work, with a buffer size of 100, socket_read() would return a stream of \n. On Linux 2.4.18-18.7.x(Redhat Box) using PHP-4.3.0-cli, it would always work, regardless of the buffer size. On Linux 2.4.19-crypto-r7(Gentoo Box) using PHP-4.3.0-cli, it would work with 2048 buffer size, but with 100 it would bail with: Notice: Undefined offset: 0 in /path/socket_phpreadnormal.php on line 51 Warning: socket_read() expects parameter 1 to be resource, null given in /path/socket_phpreadnormal.php on line 51 (I don't have direct access to this box, I didn't want to heavly debug it, it is possibly an error in my script.) On Windows 2000, using PHP-4.3.0-cli, it would always return 0(EOF) from socket_read(). It Bailed with: Warning: socket_read() unable to read from socket [0]: The operation completed successfully. (perhaps a seperate bug :-) ) ------------------------------------------------------------------------ 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/21760 -- Edit this bug report at http://bugs.php.net/?id=21760&edit=1