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

From: Date: Sun, 11 Sep 2016 04:22:37 +0000
Subject: Bug #72954 [Fbk->NoF]: file_get_contents: It does not return false at the time of time-out
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-203960@lists.php.net to get a copy of this message
Edit report at https://bugs.php.net/bug.php?id=72954&edit=1 ID: 72954 Updated by: php-bugs@lists.php.net Reported by: ne20utri312no at yahoo dot co dot jp Summary: file_get_contents: It does not return false at the time of time-out -Status: Feedback +Status: No Feedback Type: Bug Package: HTTP related Operating System: Windows PHP Version: 7.0.10 Private report: N New Comment: No feedback was provided. The bug is being suspended because we assume that you are no longer experiencing the problem. If this is not the case and you are able to provide the information that was requested earlier, please do so and change the status of the bug back to "Re-Opened". Thank you. Previous Comments: ------------------------------------------------------------------------ [2016-08-28 18:43:44] ab@php.net Thanks for the report. With both 5.6 and 7.0 i get with the test script Execution result: 1.0 sec , string(5) "Hello" FAILURE Expected result: 1 sec , bool(false) This is correct, as "hello" is flushed before sleep. Please provide additional info on how to reproduce the current behavior you describe. Also, please be sure, there's no any other process listening on the same port. Thanks. ------------------------------------------------------------------------ [2016-08-28 03:14:25] ne20utri312no at yahoo dot co dot jp 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 this bug report at https://bugs.php.net/bug.php?id=72954&edit=1

« previous php.bugs (#203960) next »