|  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
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
View Add Comment Developer Edit
Anyone can comment on a bug. Have a simpler test case? Does it work for you on a different platform? Let us know!
Just going to say 'Me too!'? Don't clutter the database with that please — but make sure to vote on the bug!
Your email address:
Solve the problem:
47 - 26 = ?
Subscribe to this entry?

 [2013-01-18 11:19 UTC] anil at saog dot net
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 = '';
$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
var_dump($http_response_header); // filled up correctly

Expected result:
"$http_response_header" filled-up correctly

Actual result:
"$http_response_header" is always NULL


Add a Patch

Pull Requests

Add a Pull Request


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]
-Status: Open +Status: Wont fix
 [2013-10-02 05:31 UTC]
This feature has been removed from PHP-5.5
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Thu Feb 29 19:01:30 2024 UTC