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

From: Date: Mon, 26 Nov 2007 20:16:38 +0000
Subject: #43417 [Opn]: socket_read returns FALSE not "" on "no more data"
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-120105@lists.php.net to get a copy of this message
ID: 43417 User updated by: miniman dot k3o at gmail dot com Reported By: miniman dot k3o at gmail dot com Status: Open Bug Type: Sockets related Operating System: Linux Slackware PHP Version: 5.2.5 New Comment: >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' Previous Comments: ------------------------------------------------------------------------ [2007-11-26 20:12:43] miniman dot k3o at gmail dot com changed summary ------------------------------------------------------------------------ [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 (#120105) next »