#50719 [NEW]: get_headers and file_get_contents always follows location redirect
| From: | php at hm2k dot org | Date: | Mon, 11 Jan 2010 12:18:29 +0000 |
| Subject: | #50719 [NEW]: get_headers and file_get_contents always follows location redirect | ||
| Groups: | php.bugs | ||
| Request: | Send a blank email to php-bugs+get-146531@lists.php.net to get a copy of this message | ||
From: php at hm2k dot org
Operating system:
PHP version: 5.3.1
PHP Bug Type: Streams related
Bug description: get_headers and file_get_contents always follows location redirect
Description:
------------
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:
http://www.php.net/manual/en/function.get-headers.php#90434
Reproduce code:
---------------
$headers=get_headers('http://tinyurl.com/hm2k');
Expected result:
----------------
echo $headers['Location']; //returns
http://connecting.nokia.com/NOKIA/WWW/HRJEdisc.nsf/HNew/0CB2705072779CACC2256D630080E7F4
Actual result:
--------------
Warning: get_headers(http://tinyurl.com/hm2k) [function.get-headers]:
failed to open stream: Connection timed out
--
Edit bug report at http://bugs.php.net/?id=50719&edit=1
--
Try a snapshot (PHP 5.2): http://bugs.php.net/fix.php?id=50719&r=trysnapshot52
Try a snapshot (PHP 5.3): http://bugs.php.net/fix.php?id=50719&r=trysnapshot53
Try a snapshot (PHP 6.0): http://bugs.php.net/fix.php?id=50719&r=trysnapshot60
Fixed in SVN: http://bugs.php.net/fix.php?id=50719&r=fixed
Fixed in SVN and need be documented: http://bugs.php.net/fix.php?id=50719&r=needdocs
Fixed in release: http://bugs.php.net/fix.php?id=50719&r=alreadyfixed
Need backtrace: http://bugs.php.net/fix.php?id=50719&r=needtrace
Need Reproduce Script: http://bugs.php.net/fix.php?id=50719&r=needscript
Try newer version: http://bugs.php.net/fix.php?id=50719&r=oldversion
Not developer issue: http://bugs.php.net/fix.php?id=50719&r=support
Expected behavior: http://bugs.php.net/fix.php?id=50719&r=notwrong
Not enough info: http://bugs.php.net/fix.php?id=50719&r=notenoughinfo
Submitted twice: http://bugs.php.net/fix.php?id=50719&r=submittedtwice
register_globals: http://bugs.php.net/fix.php?id=50719&r=globals
PHP 4 support discontinued: http://bugs.php.net/fix.php?id=50719&r=php4
Daylight Savings: http://bugs.php.net/fix.php?id=50719&r=dst
IIS Stability: http://bugs.php.net/fix.php?id=50719&r=isapi
Install GNU Sed: http://bugs.php.net/fix.php?id=50719&r=gnused
Floating point limitations: http://bugs.php.net/fix.php?id=50719&r=float
No Zend Extensions: http://bugs.php.net/fix.php?id=50719&r=nozend
MySQL Configuration Error: http://bugs.php.net/fix.php?id=50719&r=mysqlcfg