Doc #71951 [Opn->Csd]: stream_socket_shutdown(..., STREAM_SHUT_RD) will not shutdown read on Linux

From: Date: Mon, 04 Apr 2016 08:59:27 +0000
Subject: Doc #71951 [Opn->Csd]: stream_socket_shutdown(..., STREAM_SHUT_RD) will not shutdown read on Linux
References: 1  Groups: php.doc.bugs 
Request: Send a blank email to doc-bugs+get-13384@lists.php.net to get a copy of this message
Edit report at https://bugs.php.net/bug.php?id=71951&edit=1 ID: 71951 Updated by: krakjoe@php.net Reported by: grzegorz129 at gmail dot com Summary: stream_socket_shutdown(..., STREAM_SHUT_RD) will not shutdown read on Linux -Status: Open +Status: Closed Type: Documentation Problem Package: Streams related Operating System: Linux PHP Version: 7.0.5 -Assigned To: +Assigned To: krakjoe Block user comment: N Private report: N New Comment: The fix for this bug has been committed. Snapshots of the sources are packaged every three hours; this change will be in the next snapshot. You can grab the snapshot at http://snaps.php.net/. For Windows: http://windows.php.net/snapshots/ Thank you for the report, and for helping us make PHP better. Previous Comments: ------------------------------------------------------------------------ [2016-04-04 08:58:45] krakjoe@php.net Automatic comment from SVN on behalf of krakjoe Revision: http://svn.php.net/viewvc/?view=revision&amp;revision=338908 Log: Fix #71951: shutdown behaviour note ------------------------------------------------------------------------ [2016-04-04 07:53:58] krakjoe@php.net On OSX (BSD) the kernel space read buffer is emptied when the socket is shutdown. On Linux, it only rejects further packets (so the other side cannot write). A note in the documentation would be nice. ------------------------------------------------------------------------ [2016-04-04 03:34:18] grzegorz129 at gmail dot com Edit: "Expected result" was accidentally switched with "Actual result". ------------------------------------------------------------------------ [2016-04-04 03:32:49] grzegorz129 at gmail dot com Description: ------------ Following test script works as expected on OS X, but not on Linux. System details: - Linux X 4.3.0-1-amd64 #1 SMP Debian 4.3.5-1 (2016-02-06) x86_64 GNU/Linux - Debian stretch/sid Test script: --------------- <?php $server = stream_socket_server('tcp://127.0.0.1:9999'); $clientOnClient = stream_socket_client('tcp://127.0.0.1:9999'); $clientOnServer = stream_socket_accept($server, 0.5); var_dump(stream_set_chunk_size($clientOnServer, 1)); var_dump(stream_set_read_buffer($clientOnServer, 1)); fwrite($clientOnClient, 'ping'); var_dump(fread($clientOnServer, 2)); stream_socket_shutdown($clientOnServer, STREAM_SHUT_RD); var_dump(fread($clientOnServer, 2)); Expected result: ---------------- int(----) int(0) string(2) "pi" string(2) "ng" Actual result: -------------- int(8192) int(0) string(2) "pi" string(0) "" ------------------------------------------------------------------------ -- Edit this bug report at https://bugs.php.net/bug.php?id=71951&edit=1

« previous php.doc.bugs (#13384) next »