Bug #70099 [NEW]: stream_select() reverts to previous behavior of not preserving keys after read
From: chris dot ball at mailinator dot com
Operating system: Windows
PHP version: 5.6.11
Package: Streams related
Bug Type: Bug
Bug description:stream_select() reverts to previous behavior of not preserving keys after read
Description:
------------
stream_select() should always preserve keys of input arrays. It does so
in the example for the first stream_select() call but then fails to do
so in subsequent calls AFTER data has been read in.
Test script:
---------------
<?php
$fp = fopen(__FILE__, "rb");
stream_set_blocking($fp, 0);
$readfp = array("__fp" => $fp);
$writefp = NULL;
$exceptfp = NULL;
$timeout = NULL;
var_dump($readfp);
$result = stream_select($readfp, $writefp, $exceptfp, $timeout);
var_dump($readfp);
$data = fread($fp, 1024);
$readfp = array("__fp" => $fp);
$writefp = NULL;
$exceptfp = NULL;
$timeout = NULL;
var_dump($readfp);
$result = stream_select($readfp, $writefp, $exceptfp, $timeout);
var_dump($readfp);
?>
Expected result:
----------------
array(1) {
["__fp"]=>
resource(5) of type (stream)
}
array(1) {
["__fp"]=>
resource(5) of type (stream)
}
array(1) {
["__fp"]=>
resource(5) of type (stream)
}
array(1) {
["__fp"]=>
resource(5) of type (stream)
}
Actual result:
--------------
array(1) {
["__fp"]=>
resource(5) of type (stream)
}
array(1) {
["__fp"]=>
resource(5) of type (stream)
}
array(1) {
["__fp"]=>
resource(5) of type (stream)
}
array(1) {
[0]=>
resource(5) of type (stream)
}
--
Edit bug report at https://bugs.php.net/bug.php?id=70099&edit=1
--
Try a snapshot (PHP 5.4): https://bugs.php.net/fix.php?id=70099&r=trysnapshot54
Try a snapshot (PHP 5.5): https://bugs.php.net/fix.php?id=70099&r=trysnapshot55
Try a snapshot (trunk): https://bugs.php.net/fix.php?id=70099&r=trysnapshottrunk
Fixed in SVN: https://bugs.php.net/fix.php?id=70099&r=fixed
Fixed in release: https://bugs.php.net/fix.php?id=70099&r=alreadyfixed
Need backtrace: https://bugs.php.net/fix.php?id=70099&r=needtrace
Need Reproduce Script: https://bugs.php.net/fix.php?id=70099&r=needscript
Try newer version: https://bugs.php.net/fix.php?id=70099&r=oldversion
Not developer issue: https://bugs.php.net/fix.php?id=70099&r=support
Expected behavior: https://bugs.php.net/fix.php?id=70099&r=notwrong
Not enough info: https://bugs.php.net/fix.php?id=70099&r=notenoughinfo
Submitted twice: https://bugs.php.net/fix.php?id=70099&r=submittedtwice
register_globals: https://bugs.php.net/fix.php?id=70099&r=globals
PHP 4 support discontinued: https://bugs.php.net/fix.php?id=70099&r=php4
Daylight Savings: https://bugs.php.net/fix.php?id=70099&r=dst
IIS Stability: https://bugs.php.net/fix.php?id=70099&r=isapi
Install GNU Sed: https://bugs.php.net/fix.php?id=70099&r=gnused
Floating point limitations: https://bugs.php.net/fix.php?id=70099&r=float
No Zend Extensions: https://bugs.php.net/fix.php?id=70099&r=nozend
MySQL Configuration Error: https://bugs.php.net/fix.php?id=70099&r=mysqlcfg
Thread (2 messages)
- chris dot ball at mailinator dot com