#23152 [NEW]: $http_response_header is empty if server responds with a 4xx/5xx status

From: Date: Thu, 10 Apr 2003 14:35:53 +0000
Subject: #23152 [NEW]: $http_response_header is empty if server responds with a 4xx/5xx status
Groups: php.bugs 
Request: Send a blank email to php-bugs+get-37526@lists.php.net to get a copy of this message
From: maximilian dot errath at uni-graz dot at Operating system: Solaris 8 PHP version: 4.3.1 PHP Bug Type: HTTP related Bug description: $http_response_header is empty if server responds with a 4xx/5xx status When using fopen() to open an URL, $http_response_header is empty if the server responds with a 4xx or 5xx status. My script: <?php $fp = fopen('http://localhost/no-such-file.txt', 'r'); print_r($http_response_header); ?> With PHP 4.2.3 I get Warning:fopen("http://localhost/no-such-file.txt", "r") - Network is unreachable in /home/errath/packages/php-4.2.3/test.php on line 3 Array ( [0] => HTTP/1.1 404 Not Found [1] => Date: Thu, 10 Apr 2003 10:06:38 GMT [2] => Server: Apache/1.3.23 (Unix) [3] => Connection: close [4] => Content-Type: text/html; charset=iso-8859-1 ) but with PHP 4.3.1 and 4.3.2RC1 I get: Warning: fopen(http://localhost/no-such-file.txt) [http://www.php.net/function.fopen]: failed to open stream: HTTP request failed! HTTP/1.1 404 Not Found in /home/errath/packages/php-4.3.2RC1/test.php on line 3 Array ( ) -- Edit bug report at http://bugs.php.net/?id=23152&edit=1 -- Try a CVS snapshot: http://bugs.php.net/fix.php?id=23152&r=trysnapshot Fixed in CVS: http://bugs.php.net/fix.php?id=23152&r=fixedcvs Fixed in release: http://bugs.php.net/fix.php?id=23152&r=alreadyfixed Need backtrace: http://bugs.php.net/fix.php?id=23152&r=needtrace Try newer version: http://bugs.php.net/fix.php?id=23152&r=oldversion Not developer issue: http://bugs.php.net/fix.php?id=23152&r=support Expected behavior: http://bugs.php.net/fix.php?id=23152&r=notwrong Not enough info: http://bugs.php.net/fix.php?id=23152&r=notenoughinfo Submitted twice: http://bugs.php.net/fix.php?id=23152&r=submittedtwice register_globals: http://bugs.php.net/fix.php?id=23152&r=globals PHP 3 support discontinued: http://bugs.php.net/fix.php?id=23152&r=php3 Daylight Savings: http://bugs.php.net/fix.php?id=23152&r=dst IIS Stability: http://bugs.php.net/fix.php?id=23152&r=isapi Install GNU Sed: http://bugs.php.net/fix.php?id=23152&r=gnused

« previous php.bugs (#37526) next »