php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #53427 Stream array keys lost on stream_select
Submitted: 2010-11-30 13:30 UTC Modified: 2010-11-30 17:24 UTC
From: tudoadtedoadrb at gmail dot com Assigned: cataphract (profile)
Status: Closed Package: Streams related
PHP Version: 5.3.3 OS: Windows XP SP3
Private report: No CVE-ID: None
 [2010-11-30 13:30 UTC] tudoadtedoadrb at gmail dot com
Description:
------------
When you pass a keyed array of streams into stream_select the keys are lost.

The behaviour I am seeing is similar to the socket_select bug 44197.

Test script:
---------------
<?php
$read["myindex"] = $mystream;
$write = NULL;
$except = NULL;

var_dump($read);

stream_select($read, $write, $except, 0);

var_dump($read);

?> 


Expected result:
----------------
Assuming $mystream changes status and there is data available for reading...

array(1) {
  ["myindex"]=>
  resource(11) of type (stream)
}
array(1) {
  ["myindex"]=>
  resource(11) of type (stream)
}

Actual result:
--------------
array(1) {
  ["myindex"]=>
  resource(11) of type (stream)
}
array(1) {
  [0]=>
  resource(11) of type (stream)
}

Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2010-11-30 13:38 UTC] cataphract@php.net
-Status: Open +Status: Assigned -Assigned To: +Assigned To: cataphract
 [2010-11-30 17:22 UTC] cataphract@php.net
Automatic comment from SVN on behalf of cataphract
Revision: http://svn.php.net/viewvc/?view=revision&amp;revision=305856
Log: - Implemented bug/request #53427 - stream_select doesn't preserve the
  keys. This cannot be backported to PHP 5.3 due to a BC break. See
  UPGRADING for more information.
 [2010-11-30 17:24 UTC] cataphract@php.net
-Status: Assigned +Status: Closed
 [2010-11-30 17:24 UTC] cataphract@php.net
Fixed in trunk, but cannot be backported to 5.3 in order not to break scripts that iterate the resulting arrays with for($i = 0; $i < count($fdset); $i++) { }.
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Sun Dec 22 10:01:28 2024 UTC