php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #67695 Notice error by echo $http_response_header
Submitted: 2014-07-28 09:26 UTC Modified: 2015-01-11 04:22 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: info at hollander-ict dot nl Assigned:
Status: No Feedback Package: *General Issues
PHP Version: Irrelevant OS: Windows 7 SP1 32Bit
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.
(description)
Block user comment
Status: Assign to:
Package:
Bug Type:
Summary:
From: info at hollander-ict dot nl
New email:
PHP Version: OS:

 

 [2014-07-28 09:26 UTC] info at hollander-ict dot nl
Description:
------------
I want to get the response headers, but I get a notice error.
I open the file with file_get_contents, but the $http_response_header is empty

Test script:
---------------
<?php
Class core {
var $error = FALSE;
	function call($string) {
		if (!file_exists($string)) {
		@file_get_contents($string);
			if ($http_response_header != "HTTP/1.1 200 OK") {
				return $error = $http_response_header;
			}
		} else {
			return header("Location:".$string);
		}
	}

?>

Expected result:
----------------
I expect a http_responde, like HTTP/1.1 200 OK

Actual result:
--------------
A Notice error when I echo the HTTP/1.1 200 OK

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2014-12-28 23:02 UTC] kalle@php.net
-Status: Open +Status: Feedback
 [2014-12-28 23:02 UTC] kalle@php.net
Please provide a complete reproducable script, the actual notice you get, no silence operators etc (@), maybe file_get_contents() failed for some reason before the HTTP request even was sent, as you can read in the documentation $http_response_header is populated in the local scope and is an array, you used it as a string, please make sure your code does not contain such errors before posting.
 [2015-01-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: Thu Apr 25 00:01:41 2024 UTC