From: rdlowrey at gmail dot com Operating system: Fedora 17 PHP version: 5.4.15 Package: Streams related Bug Type: Bug Bug description:Inconsistent stream_select() behavior for php://memory vs. php://temp
Description: ------------ Streams of type php://memory cannot be represented as selectable descriptors where stream_select() is concerned. Attempting to do so will (rightly) trigger an E_WARNING along the lines of "Warning: stream_select(): cannot represent a stream of type MEMORY as a select()able descriptor in ..." I would expect streams of type php://temp to behave the same way. However, this is not the case. Instead, php://temp streams are immediately readable (but do not evaluate to TRUE for feof($stream). These streams should either (1) trigger an error similar to that of php://memory or (2) not be represented as readable by stream_select(). Test script: --------------- $stream = fopen('php://memory', 'r+'); $r = array($stream); $w = $e = NULL; stream_select($r, $w, $e, 0); // E_WARNING (as expected) $stream = fopen('php://temp', 'r'); $r = array($stream); $w = $e = NULL; if (stream_select($r, $w, $e, 0)) { var_dump(feof($stream)); // this isn't readable and should never be called but it results in bool(false) } Expected result: ---------------- The test script should trigger two warnings and neither stream should report as readable. Actual result: -------------- php://temp streams do not trigger an error when used with stream_select() and are immediately reported as readable. -- Edit bug report at https://bugs.php.net/bug.php?id=64921&edit=1 -- Try a snapshot (PHP 5.4): https://bugs.php.net/fix.php?id=64921&r=trysnapshot54 Try a snapshot (PHP 5.3): https://bugs.php.net/fix.php?id=64921&r=trysnapshot53 Try a snapshot (trunk): https://bugs.php.net/fix.php?id=64921&r=trysnapshottrunk Fixed in SVN: https://bugs.php.net/fix.php?id=64921&r=fixed Fixed in release: https://bugs.php.net/fix.php?id=64921&r=alreadyfixed Need backtrace: https://bugs.php.net/fix.php?id=64921&r=needtrace Need Reproduce Script: https://bugs.php.net/fix.php?id=64921&r=needscript Try newer version: https://bugs.php.net/fix.php?id=64921&r=oldversion Not developer issue: https://bugs.php.net/fix.php?id=64921&r=support Expected behavior: https://bugs.php.net/fix.php?id=64921&r=notwrong Not enough info: https://bugs.php.net/fix.php?id=64921&r=notenoughinfo Submitted twice: https://bugs.php.net/fix.php?id=64921&r=submittedtwice register_globals: https://bugs.php.net/fix.php?id=64921&r=globals PHP 4 support discontinued: https://bugs.php.net/fix.php?id=64921&r=php4 Daylight Savings: https://bugs.php.net/fix.php?id=64921&r=dst IIS Stability: https://bugs.php.net/fix.php?id=64921&r=isapi Install GNU Sed: https://bugs.php.net/fix.php?id=64921&r=gnused Floating point limitations: https://bugs.php.net/fix.php?id=64921&r=float No Zend Extensions: https://bugs.php.net/fix.php?id=64921&r=nozend MySQL Configuration Error: https://bugs.php.net/fix.php?id=64921&r=mysqlcfg