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

From: Date: Mon, 04 Apr 2016 03:32:51 +0000
Subject: Bug #71951 [NEW]: stream_socket_shutdown(..., STREAM_SHUT_RD) will not shutdown read on Linux
Groups: php.bugs 
Request: Send a blank email to php-bugs+get-200331@lists.php.net to get a copy of this message
From:             grzegorz129 at gmail dot com
Operating system: Linux
PHP version:      7.0.5
Package:          Streams related
Bug Type:         Bug
Bug description:stream_socket_shutdown(..., STREAM_SHUT_RD) will not shutdown read on Linux

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 bug report at https://bugs.php.net/bug.php?id=71951&edit=1
-- 
Try a snapshot (PHP 5.4):   https://bugs.php.net/fix.php?id=71951&r=trysnapshot54
Try a snapshot (PHP 5.5):   https://bugs.php.net/fix.php?id=71951&r=trysnapshot55
Try a snapshot (trunk):     https://bugs.php.net/fix.php?id=71951&r=trysnapshottrunk
Fixed in SVN:               https://bugs.php.net/fix.php?id=71951&r=fixed
Fixed in release:           https://bugs.php.net/fix.php?id=71951&r=alreadyfixed
Need backtrace:             https://bugs.php.net/fix.php?id=71951&r=needtrace
Need Reproduce Script:      https://bugs.php.net/fix.php?id=71951&r=needscript
Try newer version:          https://bugs.php.net/fix.php?id=71951&r=oldversion
Not developer issue:        https://bugs.php.net/fix.php?id=71951&r=support
Expected behavior:          https://bugs.php.net/fix.php?id=71951&r=notwrong
Not enough info:            https://bugs.php.net/fix.php?id=71951&r=notenoughinfo
Submitted twice:            https://bugs.php.net/fix.php?id=71951&r=submittedtwice
register_globals:           https://bugs.php.net/fix.php?id=71951&r=globals
PHP 4 support discontinued: https://bugs.php.net/fix.php?id=71951&r=php4
Daylight Savings:           https://bugs.php.net/fix.php?id=71951&r=dst
IIS Stability:              https://bugs.php.net/fix.php?id=71951&r=isapi
Install GNU Sed:            https://bugs.php.net/fix.php?id=71951&r=gnused
Floating point limitations: https://bugs.php.net/fix.php?id=71951&r=float
No Zend Extensions:         https://bugs.php.net/fix.php?id=71951&r=nozend
MySQL Configuration Error:  https://bugs.php.net/fix.php?id=71951&r=mysqlcfg



Thread (3 messages)

« previous php.bugs (#200331) next »