Doc #68798 [Opn->Ver]: stream_select() preserves keys since rev. 305856 breaking some code without note

From: Date: Tue, 27 Oct 2020 13:03:28 +0000
Subject: Doc #68798 [Opn->Ver]: stream_select() preserves keys since rev. 305856 breaking some code without note
References: 1  Groups: php.doc.bugs 
Request: Send a blank email to doc-bugs+get-18034@lists.php.net to get a copy of this message
Edit report at https://bugs.php.net/bug.php?id=68798&edit=1 ID: 68798 Updated by: cmb@php.net Reported by: grzegorz129 at gmail dot com Summary: stream_select() preserves keys since rev. 305856 breaking some code without note -Status: Open +Status: Verified Type: Documentation Problem Package: Streams related Operating System: All PHP Version: 5.6.4 -Assigned To: +Assigned To: cmb Block user comment: N Private report: N New Comment: A bit late to document this, though. Previous Comments: ------------------------------------------------------------------------ [2015-01-11 07:03:30] grzegorz129 at gmail dot com I have confirmed stream_select() behave differently on 5.3.29 (tested on OS X). /******** TEST CODE ********/ $read = $except = null; $write = array("test" => fopen("php://stdout", "w")); var_dump($write); stream_select($read, $write, $except, 0); var_dump($write); /******** PHP 5.6.4 ********/ array(1) { ["test"]=> resource(5) of type (stream) } array(1) { ["test"]=> resource(5) of type (stream) } /******** PHP 5.3.29 ********/ array(1) { ["test"]=> resource(5) of type (stream) } array(1) { [0]=> resource(5) of type (stream) } Example of code which conforms to documentation of stream_select() but fails on 5.6.4: $read = $except = null; $write = array("test" => fopen("php://stdout", "w")); stream_select($read, $write, $except, 0); for($i = 0; $i < count($write); $i++) { var_dump($write[$i]); //"resource(n) of type (stream)" on 5.3.29, NULL on 5.6.4 } ------------------------------------------------------------------------ [2015-01-11 03:14:48] grzegorz129 at gmail dot com Description: ------------ Bug #53427 proposed stream_select() should preserve array keys, it was implemented in revision #305856 (http://svn.php.net/viewvc/?view=revision&amp;revision=305856). However there's no documentation or changelog informations about changed behaviour. I believe it was first available since 5.4. Test script: --------------- $read = $except = null; $write = ["test" => fopen("php://stdout", "w")]; var_dump($write); stream_select($read, $write, $except, 0); var_dump($write); ------------------------------------------------------------------------ -- Edit this bug report at https://bugs.php.net/bug.php?id=68798&edit=1

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