]> granicus.if.org Git - php/commitdiff
Return empty string when recv() does not fetch any data
authorIlia Alshanetsky <iliaa@php.net>
Tue, 3 Feb 2009 19:22:40 +0000 (19:22 +0000)
committerIlia Alshanetsky <iliaa@php.net>
Tue, 3 Feb 2009 19:22:40 +0000 (19:22 +0000)
ext/sockets/sockets.c

index 4e31e905f0436dd89d7b2a2b6db9cc9388567d37..66b1edda9bf1fdb6d7e30c438adf8a6630055b99 100644 (file)
@@ -901,6 +901,9 @@ PHP_FUNCTION(socket_read)
 
                efree(tmpbuf);
                RETURN_FALSE;
+       } else if (!retval) {
+               efree(tmpbuf);
+               RETURN_EMPTY_STRING();
        }
 
        tmpbuf = erealloc(tmpbuf, retval + 1);