Req #75367 [NEW]: socket_select with STDIN on linux

From: Date: Thu, 12 Oct 2017 17:06:45 +0000
Subject: Req #75367 [NEW]: socket_select with STDIN on linux
Groups: php.bugs 
Request: Send a blank email to php-bugs+get-211648@lists.php.net to get a copy of this message
From: divinity76 at gmail dot com Operating system: Debian 10, kernel 4.12.13 PHP version: 7.0.24 Package: Sockets related Bug Type: Feature/Change Request Bug description:socket_select with STDIN on linux Description: ------------ socket_select should be able to listen to STDIN on linux, because it could be useful, and the underlying select() call is fully capable of doing it. i was recently in a situation where i needed to listen to changes both in a bunch of socket_accept'ed sockets, and STDIN at the same time, but socket_select doesn't accept STDIN in the $read array.. at least on linux, that shouldn't be a problem. Test script: --------------- <?php const PORT=9999; $srv = socket_create ( AF_INET, SOCK_STREAM, SOL_TCP ); socket_bind ( $srv, "0", PORT ); socket_listen ( $srv ); $unused = array (); $read = array ( $srv, STDIN ); while ( false !== socket_select ( $read, $unused, $unused, NULL ) ) { die("detected something"); } Expected result: ---------------- it should detect activity on STDIN Actual result: -------------- PHP Warning: socket_select(): supplied resource is not a valid Socket resource in /plain.php on line 11 PHP Stack trace: PHP 1. {main}() /plain.php:0 PHP 2. socket_select() /plain.php:11 -- Edit bug report at https://bugs.php.net/bug.php?id=75367&edit=1 -- Try a snapshot (PHP 5.4): https://bugs.php.net/fix.php?id=75367&r=trysnapshot54 Try a snapshot (PHP 5.5): https://bugs.php.net/fix.php?id=75367&r=trysnapshot55 Try a snapshot (trunk): https://bugs.php.net/fix.php?id=75367&r=trysnapshottrunk Fixed in SVN: https://bugs.php.net/fix.php?id=75367&r=fixed Fixed in release: https://bugs.php.net/fix.php?id=75367&r=alreadyfixed Need backtrace: https://bugs.php.net/fix.php?id=75367&r=needtrace Need Reproduce Script: https://bugs.php.net/fix.php?id=75367&r=needscript Try newer version: https://bugs.php.net/fix.php?id=75367&r=oldversion Not developer issue: https://bugs.php.net/fix.php?id=75367&r=support Expected behavior: https://bugs.php.net/fix.php?id=75367&r=notwrong Not enough info: https://bugs.php.net/fix.php?id=75367&r=notenoughinfo Submitted twice: https://bugs.php.net/fix.php?id=75367&r=submittedtwice register_globals: https://bugs.php.net/fix.php?id=75367&r=globals PHP 4 support discontinued: https://bugs.php.net/fix.php?id=75367&r=php4 Daylight Savings: https://bugs.php.net/fix.php?id=75367&r=dst IIS Stability: https://bugs.php.net/fix.php?id=75367&r=isapi Install GNU Sed: https://bugs.php.net/fix.php?id=75367&r=gnused Floating point limitations: https://bugs.php.net/fix.php?id=75367&r=float No Zend Extensions: https://bugs.php.net/fix.php?id=75367&r=nozend MySQL Configuration Error: https://bugs.php.net/fix.php?id=75367&r=mysqlcfg

« previous php.bugs (#211648) next »