Bug #70483 [NEW]: stream_select depends on concrete value of given resource inside array
| From: | edefimov dot it at gmail dot com | Date: | Sun, 13 Sep 2015 18:14:37 +0000 |
| Subject: | Bug #70483 [NEW]: stream_select depends on concrete value of given resource inside array | ||
| Groups: | php.bugs | ||
| Request: | Send a blank email to php-bugs+get-195984@lists.php.net to get a copy of this message | ||
From: edefimov dot it at gmail dot com
Operating system: Ubuntu 14.04 (64bit)
PHP version: 5.6.13
Package: Streams related
Bug Type: Bug
Bug description:stream_select depends on concrete value of given resource inside array
Description:
------------
When script creates resource with identifier greater than FD_SETSIZE and
pass it as the only argument to stream_select, php warning is emitted
and stream_select fails.
Test script:
---------------
<?php
$nomatter = [];
$sockets = [];
for ($i = 0; $i <= 1024; $i++) {
$sockets[] = stream_socket_client('tcp://php.net:80', $errno,
$errstr, STREAM_CLIENT_ASYNC_CONNECT);
}
$s = stream_socket_client('tcp://php.net:80', $errno, $errstr,
STREAM_CLIENT_CONNECT | STREAM_CLIENT_ASYNC_CONNECT);
var_dump($s);
$read = [$s];
$result = stream_select($read, $nomatter, $nomatter, 1);
var_dump($result);
Expected result:
----------------
resource(1030) of type (stream)
int(1)
Actual result:
--------------
resource(1030) of type (stream)
PHP Warning: stream_select(): You MUST recompile PHP with a larger
value of FD_SETSIZE.
It is set to 1024, but you have descriptors numbered at least as high as
1028.
--enable-fd-setsize=2048 is recommended, but you may want to set it
to equal the maximum number of open files supported by your system,
in order to avoid seeing this error again at a later date. in /test.php
on line 13
PHP Stack trace:
PHP 1. {main}() /test.php:0
PHP 2. stream_select() /test.php:13
int(0)
--
Edit bug report at https://bugs.php.net/bug.php?id=70483&edit=1
--
Try a snapshot (PHP 5.4): https://bugs.php.net/fix.php?id=70483&r=trysnapshot54
Try a snapshot (PHP 5.5): https://bugs.php.net/fix.php?id=70483&r=trysnapshot55
Try a snapshot (trunk): https://bugs.php.net/fix.php?id=70483&r=trysnapshottrunk
Fixed in SVN: https://bugs.php.net/fix.php?id=70483&r=fixed
Fixed in release: https://bugs.php.net/fix.php?id=70483&r=alreadyfixed
Need backtrace: https://bugs.php.net/fix.php?id=70483&r=needtrace
Need Reproduce Script: https://bugs.php.net/fix.php?id=70483&r=needscript
Try newer version: https://bugs.php.net/fix.php?id=70483&r=oldversion
Not developer issue: https://bugs.php.net/fix.php?id=70483&r=support
Expected behavior: https://bugs.php.net/fix.php?id=70483&r=notwrong
Not enough info: https://bugs.php.net/fix.php?id=70483&r=notenoughinfo
Submitted twice: https://bugs.php.net/fix.php?id=70483&r=submittedtwice
register_globals: https://bugs.php.net/fix.php?id=70483&r=globals
PHP 4 support discontinued: https://bugs.php.net/fix.php?id=70483&r=php4
Daylight Savings: https://bugs.php.net/fix.php?id=70483&r=dst
IIS Stability: https://bugs.php.net/fix.php?id=70483&r=isapi
Install GNU Sed: https://bugs.php.net/fix.php?id=70483&r=gnused
Floating point limitations: https://bugs.php.net/fix.php?id=70483&r=float
No Zend Extensions: https://bugs.php.net/fix.php?id=70483&r=nozend
MySQL Configuration Error: https://bugs.php.net/fix.php?id=70483&r=mysqlcfg