From: [EMAIL PROTECTED] Operating system: Linux PHP version: 5.3CVS-2008-09-11 (CVS) PHP Bug Type: Streams related Bug description: feof() hangs
Description: ------------ The code below works fine with PHP 5.2.6 (and earlier), but not with the unreleased PHP 5.2.7 and PHP 5.3.0: 892 $handle = @fopen($url, 'r'); 893 894 if (!$handle) { 895 throw new RuntimeException( 896 'Could not connect to the Selenium RC server.' 897 ); 898 } 899 900 stream_set_blocking($handle, 1); 901 stream_set_timeout($handle, 0, $this->timeout); 902 903 $info = stream_get_meta_data($handle); 904 $response = ''; 905 906 while ((!feof($handle)) && (!$info['timed_out'])) { 907 $response .= fgets($handle, 4096); 908 $info = stream_get_meta_data($handle); 909 } 910 911 fclose($handle); The code above hangs with PHP 5.2.7 and PHP 5.3.0 in line 906 as shown using Xdebug's tracing: fopen() Driver.php:892 stream_set_blocking() Driver.php:900 stream_set_timeout() Driver.php:901 stream_get_meta_data() Driver.php:903 feof() Driver.php:906 fgets() Driver.php:907 stream_get_meta_data() Driver.php:908 feof() Driver.php:906 The second feof() call above hangs. More information can be found here: - http://static.phpunit.de/trace.818532121.xt - http://static.phpunit.de/strace.txt Changing the loop to while (!$info['eof'] && !$info['timed_out']) { $response .= fgets($handle, 4096); $info = stream_get_meta_data($handle); } fixes the problem. This means a difference between feof() and $info['eof']. -- Edit bug report at http://bugs.php.net/?id=46049&edit=1 -- Try a CVS snapshot (PHP 5.2): http://bugs.php.net/fix.php?id=46049&r=trysnapshot52 Try a CVS snapshot (PHP 5.3): http://bugs.php.net/fix.php?id=46049&r=trysnapshot53 Try a CVS snapshot (PHP 6.0): http://bugs.php.net/fix.php?id=46049&r=trysnapshot60 Fixed in CVS: http://bugs.php.net/fix.php?id=46049&r=fixedcvs Fixed in release: http://bugs.php.net/fix.php?id=46049&r=alreadyfixed Need backtrace: http://bugs.php.net/fix.php?id=46049&r=needtrace Need Reproduce Script: http://bugs.php.net/fix.php?id=46049&r=needscript Try newer version: http://bugs.php.net/fix.php?id=46049&r=oldversion Not developer issue: http://bugs.php.net/fix.php?id=46049&r=support Expected behavior: http://bugs.php.net/fix.php?id=46049&r=notwrong Not enough info: http://bugs.php.net/fix.php?id=46049&r=notenoughinfo Submitted twice: http://bugs.php.net/fix.php?id=46049&r=submittedtwice register_globals: http://bugs.php.net/fix.php?id=46049&r=globals PHP 4 support discontinued: http://bugs.php.net/fix.php?id=46049&r=php4 Daylight Savings: http://bugs.php.net/fix.php?id=46049&r=dst IIS Stability: http://bugs.php.net/fix.php?id=46049&r=isapi Install GNU Sed: http://bugs.php.net/fix.php?id=46049&r=gnused Floating point limitations: http://bugs.php.net/fix.php?id=46049&r=float No Zend Extensions: http://bugs.php.net/fix.php?id=46049&r=nozend MySQL Configuration Error: http://bugs.php.net/fix.php?id=46049&r=mysqlcfg