php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #64016 file_get_contents does not fill up $http_response_header via HEAD method
Submitted: 2013-01-18 11:19 UTC Modified: 2013-10-02 05:31 UTC
Votes:4
Avg. Score:4.5 ± 0.5
Reproduced:4 of 4 (100.0%)
Same Version:1 (25.0%)
Same OS:0 (0.0%)
From: anil at saog dot net Assigned:
Status: Wont fix Package: *URL Functions
PHP Version: 5.4.11 OS: Centos 6.2
Private report: No CVE-ID: None
Have you experienced this issue?
Rate the importance of this bug to you:

 [2013-01-18 11:19 UTC] anil at saog dot net
Description:
------------
PHP is compiled with option "--with-curlwrappers". Whenever a HEAD request issued with "file_get_contents", "$http_response_header" is not filled-up but upon calling "get_headers()", variable "$http_response_header" auto-magically filled up.

Test script:
---------------
$url = 'http://www.google.com';
$ctx = stream_context_create();

stream_context_set_option($ctx, array('http' => array('method' => 'HEAD','timeout' => 60)));

$res = file_get_contents($url, false, $ctx);
var_dump($http_response_header); // NULL
get_headers($url);
var_dump($http_response_header); // filled up correctly

Expected result:
----------------
"$http_response_header" filled-up correctly

Actual result:
--------------
"$http_response_header" is always NULL

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2013-02-20 16:56 UTC] mattsch at gmail dot com
$http_response_header is undefined after doing a file_get_contents on a url on php 5.3.21 as well.
 [2013-10-02 05:31 UTC] mike@php.net
-Status: Open +Status: Wont fix
 [2013-10-02 05:31 UTC] mike@php.net
This feature has been removed from PHP-5.5
 
PHP Copyright © 2001-2019 The PHP Group
All rights reserved.
Last updated: Wed Jul 24 03:01:26 2019 UTC