php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #76251 get_headers halt without any warning on unresolved hosts
Submitted: 2018-04-23 04:58 UTC Modified: 2018-06-24 04:25 UTC
Votes:1
Avg. Score:5.0 ± 0.0
Reproduced:1 of 1 (100.0%)
Same Version:1 (100.0%)
Same OS:1 (100.0%)
From: i dot s dot azizy at gmail dot com Assigned:
Status: No Feedback Package: HTTP related
PHP Version: 5.6Git-2018-04-23 (Git) OS: Linux workspace25 2.6.32-696.1.1
Private report: No CVE-ID: None
Welcome back! If you're the original bug submitter, here's where you can edit the bug or add additional notes.
If you forgot your password, you can retrieve your password here.
Password:
Status:
Package:
Bug Type:
Summary:
From: i dot s dot azizy at gmail dot com
New email:
PHP Version: OS:

 

 [2018-04-23 04:58 UTC] i dot s dot azizy at gmail dot com
Description:
------------
when you call get_headers function with unresolved url (url has dns and ip but is not responding) within script codes running script will be finished without any warning after a short timeout less that one minutes. there is not any warning or return value! running it alone did not raise this error.
pay attention : url must has valid dns ip but has not any response to requests like http://www.sport.ir

Test script:
---------------
ini_set("max_execution_time", "0");
ini_set("max_input_time", "0");
set_time_limit(0);

//  TEST ZONE START
error_reporting(E_ALL);
var_dump(get_headers('http://www.sport.ir'));
echo 'finished';
die;
//  TEST ZONE END

Expected result:
----------------
<br />
<b>Warning</b>:  get_headers(): php_network_getaddresses: getaddrinfo failed: Name or service not known in <b>[SCRIPT-PATH]/[SCRIPT-NAME]</b> on line <b>7</b><br />
<br />
<b>Warning</b>:  get_headers(http://www.sport.ir): failed to open stream: php_network_getaddresses: getaddrinfo failed: Name or service not known in <b>[SCRIPT-PATH]/[SCRIPT-NAME]</b> on line <b>7</b><br />
bool(false)
finished


Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2018-04-23 05:17 UTC] requinix@php.net
-Status: Open +Status: Feedback
 [2018-04-23 05:17 UTC] requinix@php.net
PHP 5.6 is no longer supported. Please test with PHP 7.1 or 7.2.

When I try your script I get:

Warning: get_headers(http://www.sport.ir): failed to open stream: A connection attempt failed because the connected party did not properly respond after a period of time, or established connection failed because connected host has failed to respond.
 in (file) on line (line)
bool(false)
finished

which looks correct to me.

PS: That getaddrinfo warning would mean the domain name could not be resolved.
 [2018-06-24 04:25 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: Mon Dec 09 23:01:27 2024 UTC