Bug #67695 [Opn->Fbk]: Notice error by echo $http_response_header

From: Date: Sun, 28 Dec 2014 23:02:31 +0000
Subject: Bug #67695 [Opn->Fbk]: Notice error by echo $http_response_header
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-189275@lists.php.net to get a copy of this message
Edit report at https://bugs.php.net/bug.php?id=67695&edit=1

 ID:                 67695
 Updated by:         kalle@php.net
 Reported by:        info at hollander-ict dot nl
 Summary:            Notice error by echo $http_response_header
-Status:             Open
+Status:             Feedback
 Type:               Bug
 Package:            *General Issues
 Operating System:   Windows 7 SP1 32Bit
 PHP Version:        Irrelevant
 Block user comment: N
 Private report:     N

 New Comment:

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.


Previous Comments:
------------------------------------------------------------------------
[2014-07-28 09:26:25] 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


------------------------------------------------------------------------



--
Edit this bug report at https://bugs.php.net/bug.php?id=67695&edit=1


Thread (3 messages)

« previous php.bugs (#189275) next »