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

From: Date: Sun, 11 Jan 2015 07:03:31 +0000
Subject: Doc #68798 [Opn]: 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-11844@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 User updated by: grzegorz129 at gmail dot com Reported by: grzegorz129 at gmail dot com -Summary: stream_select() preserves keys since rev. 305856 +Summary: stream_select() preserves keys since rev. 305856 breaking some code without note Status: Open Type: Documentation Problem Package: Documentation problem Operating System: All PHP Version: 5.6.4 Block user comment: N Private report: N New Comment: 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 } Previous Comments: ------------------------------------------------------------------------ [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 (#11844) next »