#43417 [Opn->Bgs]: socket_read returns FALSE not "" on "no more data"

From: Date: Tue, 27 Nov 2007 13:02:38 +0000
Subject: #43417 [Opn->Bgs]: socket_read returns FALSE not "" on "no more data"
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-120128@lists.php.net to get a copy of this message
ID: 43417 Updated by: jani@php.net Reported By: miniman dot k3o at gmail dot com -Status: Open +Status: Bogus Bug Type: Sockets related Operating System: Linux Slackware PHP Version: 5.2.5 New Comment: "socket_read() returns the data as a string on success, or FALSE on error (including if the remote host has closed the connection). The error code can be retrieved with socket_last_error()." What happens is that the remote closed the connection..see also bug #28141 Previous Comments: ------------------------------------------------------------------------ [2007-11-26 20:16:38] miniman dot k3o at gmail dot com >Start my server and saw that it: returns FALSE on 'NO MORE DATA TO READ' i meant: Started my server and saw that socket_read: returns FALSE on 'NO MORE DATA TO READ' ------------------------------------------------------------------------ [2007-11-26 20:06:19] miniman dot k3o at gmail dot com Description: ------------ cyte from php.net/socket_read : Return Values Note: socket_read() returns a zero length string ("") when there is no more data to read. // Ive downloaded today PHP 5.2.5 sources from php.net site. Compiled it. Start my server and saw that it: returns FALSE on 'NO MORE DATA TO READ' // I think it is a bug; Reproduce code: --------------- php-5.2.5/ext/sockets isn't it a patch ? --- sockets.c 2007-09-26 12:55:07.000000000 +0200 +++ sockets.c.fixed 2007-11-26 19:51:23.000000000 +0100 @@ -891,6 +891,10 @@ ) { php_sock->error = errno; SOCKETS_G(last_error) = errno; + /*minicode starts: return empty string bugfix*/ + efree(tmpbuf); + RETURN_STRINGL('\0',0,0); + /*minicode ends*/ } else { PHP_SOCKET_ERROR(php_sock, "unable to read from socket", errno); } ------------------------------------------------------------------------ -- Edit this bug report at http://bugs.php.net/?id=43417&edit=1

« previous php.bugs (#120128) next »