|  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #72954 file_get_contents: It does not return false at the time of time-out
Submitted: 2016-08-28 03:14 UTC Modified: 2016-09-11 04:22 UTC
From: ne20utri312no at yahoo dot co dot jp Assigned:
Status: No Feedback Package: HTTP related
PHP Version: 7.0.10 OS: Windows
Private report: No CVE-ID: None
View Add Comment Developer Edit
Welcome! If you don't have a Git account, you can't do anything here.
You can add a comment by following this link or if you reported this bug, you can edit this bug over here.
Block user comment
Status: Assign to:
Bug Type:
From: ne20utri312no at yahoo dot co dot jp
New email:
PHP Version: OS:


 [2016-08-28 03:14 UTC] ne20utri312no at yahoo dot co dot jp
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.
php -S localhost:8080
php 2.php

Execution result: 1.0 sec , string(0) ""
 Expected result:   1 sec , bool(false)

Test script:
// 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);
	echo "Hello";
	echo ' world';

Expected result:

Actual result:
string(0) ""


Add a Patch

Pull Requests

Add a Pull Request


AllCommentsChangesGit/SVN commitsRelated reports
 [2016-08-28 18:43 UTC]
-Status: Open +Status: Feedback
 [2016-08-28 18:43 UTC]
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"
 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.

 [2016-09-11 04:22 UTC] php-bugs at lists dot php dot net
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.
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Sat May 18 18:01:32 2024 UTC