|  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #50719 get_headers and file_get_contents always follows location redirect
Submitted: 2010-01-11 12:18 UTC Modified: 2010-01-11 12:32 UTC
From: php at hm2k dot org Assigned:
Status: Not a bug Package: Streams related
PHP Version: 5.3.1 OS:
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.
Block user comment
Status: Assign to:
Bug Type:
From: php at hm2k dot org
New email:
PHP Version: OS:


 [2010-01-11 12:18 UTC] php at hm2k dot org
get_headers and file_get_contents should not blindly follow the location redirect.

The reason for this is that I, like others, want to get_headers  of the url i've supplied, not the ultimate location.

I'm not the only one having this issue, also see:

Reproduce code:

Expected result:
echo $headers['Location']; //returns

Actual result:
Warning: get_headers( [function.get-headers]: failed to open stream: Connection timed out


Add a Patch

Pull Requests

Add a Pull Request


AllCommentsChangesGit/SVN commitsRelated reports
 [2010-01-11 12:32 UTC]
You can control the number of redirects (or disable them entirely) via 
the max_redirects streams context option.
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Sat May 18 23:01:31 2024 UTC