php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Request #34059 get_headers() returns false and throws warning on 404
Submitted: 2005-08-10 02:53 UTC Modified: 2006-01-23 16:05 UTC
Votes:2
Avg. Score:5.0 ± 0.0
Reproduced:1 of 2 (50.0%)
Same Version:1 (100.0%)
Same OS:0 (0.0%)
From: bjori@php.net Assigned:
Status: Closed Package: Feature/Change Request
PHP Version: 5CVS-2005-08-10 (dev) OS:
Private report: No CVE-ID: None
 [2005-08-10 02:53 UTC] bjori@php.net
Description:
------------
I feel like the current behaviur of get_headers() is wrong, i.e. it doesnt give me the headers on 404 errors etc.

Would like to get the header, even thou its just an error header.

Reproduce code:
---------------
php -r 'print_r(get_headers("http://example.com/non"));'

Expected result:
----------------
Array
(
    [0] => HTTP/1.1 404 Not Found
    [1] => Date: Wed, 10 Aug 2005 00:47:07 GMT
    [2] => Server: Apache/1.3.27 (Unix)  (Red-Hat/Linux)
    [3] => Transfer-Encoding: chunked
    [4] => Connection: close
    [5] => Content-Type: text/html; charset=iso-8859-1
)

Actual result:
--------------
Warning: get_headers(http://example.com/non): failed to open stream: HTTP request failed! HTTP/1.1 404 Not Found
 in Command line code on line 1


Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2006-01-23 16:05 UTC] iliaa@php.net
This bug has been fixed in CVS.

Snapshots of the sources are packaged every three hours; this change
will be in the next snapshot. You can grab the snapshot at
http://snaps.php.net/.
 
Thank you for the report, and for helping us make PHP better.


 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Fri Oct 04 11:01:28 2024 UTC