Bug #71951 [Opn]: stream_socket_shutdown(..., STREAM_SHUT_RD) will not shutdown read on Linux

From: Date: Mon, 04 Apr 2016 03:34:19 +0000
Subject: Bug #71951 [Opn]: stream_socket_shutdown(..., STREAM_SHUT_RD) will not shutdown read on Linux
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-200332@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
 User updated by:    grzegorz129 at gmail dot com
 Reported by:        grzegorz129 at gmail dot com
 Summary:            stream_socket_shutdown(..., STREAM_SHUT_RD) will not
                     shutdown read on Linux
 Status:             Open
 Type:               Bug
 Package:            Streams related
 Operating System:   Linux
 PHP Version:        7.0.5
 Block user comment: N
 Private report:     N

 New Comment:

Edit: "Expected result" was accidentally switched with "Actual result".


Previous Comments:
------------------------------------------------------------------------
[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


Thread (3 messages)

« previous php.bugs (#200332) next »