From: xilon dot jul at gmail dot com Operating system: Linux 3.5.0-23-generic PHP version: 5.4.14 Package: Sockets related Bug Type: Bug Bug description:socket_select returns false and socket_last_error returns 0 (success)
Description: ------------ When a socket ressource previously watched for read I/O in socket_select is closed, the socket_select function would return false and throw a warning saying "Not a valid socket ressource". The fact is that subsequent call to socket_last_error() returns 0 which translates to success using socket_strerror(). Test script: --------------- $socket = socket_create(AF_INET, SOCK_DGRAM, SOL_UDP); if (false === socket_bind($socket, '0.0.0.0', 5555)) { die('bind()'); } $read[] = $socket; // voluntarily close the socket socket_close($socket); // Will throw a warning and return false $retval = socket_select($read, $w = null, $e = null, 1); echo socket_last_error(); // returns 0 Expected result: ---------------- As the C select system call, closing the socket should return a valid system error code. The C counterpart of this PHP sample above gives : select(): Bad file descriptor (9 => EBADF) Actual result: -------------- The result of socket_last_error is 0. -- Edit bug report at https://bugs.php.net/bug.php?id=64654&edit=1 -- Try a snapshot (PHP 5.4): https://bugs.php.net/fix.php?id=64654&r=trysnapshot54 Try a snapshot (PHP 5.3): https://bugs.php.net/fix.php?id=64654&r=trysnapshot53 Try a snapshot (trunk): https://bugs.php.net/fix.php?id=64654&r=trysnapshottrunk Fixed in SVN: https://bugs.php.net/fix.php?id=64654&r=fixed Fixed in release: https://bugs.php.net/fix.php?id=64654&r=alreadyfixed Need backtrace: https://bugs.php.net/fix.php?id=64654&r=needtrace Need Reproduce Script: https://bugs.php.net/fix.php?id=64654&r=needscript Try newer version: https://bugs.php.net/fix.php?id=64654&r=oldversion Not developer issue: https://bugs.php.net/fix.php?id=64654&r=support Expected behavior: https://bugs.php.net/fix.php?id=64654&r=notwrong Not enough info: https://bugs.php.net/fix.php?id=64654&r=notenoughinfo Submitted twice: https://bugs.php.net/fix.php?id=64654&r=submittedtwice register_globals: https://bugs.php.net/fix.php?id=64654&r=globals PHP 4 support discontinued: https://bugs.php.net/fix.php?id=64654&r=php4 Daylight Savings: https://bugs.php.net/fix.php?id=64654&r=dst IIS Stability: https://bugs.php.net/fix.php?id=64654&r=isapi Install GNU Sed: https://bugs.php.net/fix.php?id=64654&r=gnused Floating point limitations: https://bugs.php.net/fix.php?id=64654&r=float No Zend Extensions: https://bugs.php.net/fix.php?id=64654&r=nozend MySQL Configuration Error: https://bugs.php.net/fix.php?id=64654&r=mysqlcfg