|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
[2016-08-28 18:43 UTC] ab@php.net
-Status: Open
+Status: Feedback
[2016-08-28 18:43 UTC] ab@php.net
[2016-09-11 04:22 UTC] php-bugs at lists dot php dot net
|
|||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Sun Oct 26 01:00:01 2025 UTC |
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) ""