Bug #72954 [NEW]: file_get_contents: It does not return false at the time of time-out

From: Date: Sun, 28 Aug 2016 03:14:29 +0000
Subject: Bug #72954 [NEW]: file_get_contents: It does not return false at the time of time-out
Groups: php.bugs 
Request: Send a blank email to php-bugs+get-203613@lists.php.net to get a copy of this message
From: ne20utri312no at yahoo dot co dot jp Operating system: Windows PHP version: 7.0.10 Package: HTTP related Bug Type: Bug Bug description:file_get_contents: It does not return false at the time of time-out Description: ------------ file_get_contents It does not return false at the time of time-out php 7.0.10 (php 5.6 does not have this bug) open two shell. (1) php -S localhost:8080 (2) php 2.php Execution result: 1.0 sec , string(0) "" FAILURE Expected result: 1 sec , bool(false) Test script: --------------- <?php // php -S localhost:8080 // php 2.php ini_set('display_errors', 0); if (php_sapi_name() == 'cli') { $timeout = 1; ini_set('default_socket_timeout', $timeout); $st = microtime(TRUE); $res = file_get_contents('http://localhost:8080/'. basename(__FILE__)); $time = microtime(TRUE) - $st; ob_start(); var_dump($res); $s = trim(ob_get_contents()); ob_end_clean(); printf("Execution result: %0.1f sec , %s\n", $time, $s); $success = ($res ===FALSE && round($time)<=$timeout); echo ($success ? 'Success' : 'FAILURE'). "\n"; printf(" Expected result: %3d sec , bool(false)\n", $timeout); } else { echo "Hello"; flush(); sleep(1); echo ' world'; } Expected result: ---------------- bool(false) Actual result: -------------- string(0) "" -- Edit bug report at https://bugs.php.net/bug.php?id=72954&edit=1 -- Try a snapshot (PHP 5.4): https://bugs.php.net/fix.php?id=72954&r=trysnapshot54 Try a snapshot (PHP 5.5): https://bugs.php.net/fix.php?id=72954&r=trysnapshot55 Try a snapshot (trunk): https://bugs.php.net/fix.php?id=72954&r=trysnapshottrunk Fixed in SVN: https://bugs.php.net/fix.php?id=72954&r=fixed Fixed in release: https://bugs.php.net/fix.php?id=72954&r=alreadyfixed Need backtrace: https://bugs.php.net/fix.php?id=72954&r=needtrace Need Reproduce Script: https://bugs.php.net/fix.php?id=72954&r=needscript Try newer version: https://bugs.php.net/fix.php?id=72954&r=oldversion Not developer issue: https://bugs.php.net/fix.php?id=72954&r=support Expected behavior: https://bugs.php.net/fix.php?id=72954&r=notwrong Not enough info: https://bugs.php.net/fix.php?id=72954&r=notenoughinfo Submitted twice: https://bugs.php.net/fix.php?id=72954&r=submittedtwice register_globals: https://bugs.php.net/fix.php?id=72954&r=globals PHP 4 support discontinued: https://bugs.php.net/fix.php?id=72954&r=php4 Daylight Savings: https://bugs.php.net/fix.php?id=72954&r=dst IIS Stability: https://bugs.php.net/fix.php?id=72954&r=isapi Install GNU Sed: https://bugs.php.net/fix.php?id=72954&r=gnused Floating point limitations: https://bugs.php.net/fix.php?id=72954&r=float No Zend Extensions: https://bugs.php.net/fix.php?id=72954&r=nozend MySQL Configuration Error: https://bugs.php.net/fix.php?id=72954&r=mysqlcfg

« previous php.bugs (#203613) next »