php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #25173 Piling two header('Location: URL)'; make the first one to be loaded
Submitted: 2003-08-20 06:01 UTC Modified: 2003-08-20 06:27 UTC
Votes:1
Avg. Score:2.0 ± 0.0
Reproduced:1 of 1 (100.0%)
Same Version:1 (100.0%)
Same OS:1 (100.0%)
From: i dot spalletti at iast dot it Assigned:
Status: Not a bug Package: HTTP related
PHP Version: 4.3.3RC4 OS: Linux (kernel 2.4.21)
Private report: No CVE-ID: None
View Developer Edit
Welcome! If you don't have a Git account, you can't do anything here.
If you reported this bug, you can edit this bug over here.
(description)
Block user comment
Status: Assign to:
Package:
Bug Type:
Summary:
From: i dot spalletti at iast dot it
New email:
PHP Version: OS:

 

 [2003-08-20 06:01 UTC] i dot spalletti at iast dot it
Description:
------------
As of documentazion if you pile up two header('Location: URL)'; the second URL will be opened.
In 4.3.3RC4 you will load the first one

Reproduce code:
---------------
<?php
header('Location: http://www.php.net');
print "Let's write something interesting that nobody would read";
header('Location: http://qa.php.net');
?>

Expected result:
----------------
You should load PHP home page

Actual result:
--------------
You will load QA home page

Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2003-08-20 06:10 UTC] i dot spalletti at iast dot it
You should partially modify my report
<?php
header('Location: http://www.php.net');
print "Let's write something interesting that nobody would read";
header('Location: http://qa.php.net');
?>
Will load the first URL

<?php
header('Location: http://www.php.net');
header('Location: http://qa.php.net');
?>
Will load the second URL (note the absence of any print statement). I.e. if you output something the first URL is to be loaded, otherwise you'll load the second one
 [2003-08-20 06:11 UTC] derick@php.net
Thank you for taking the time to write to us, but this is not
a bug. Please double-check the documentation available at
http://www.php.net/manual/ and the instructions on how to report
a bug at http://bugs.php.net/how-to-report.php

If you print something, headers are send out. If they are send out you can not overwrite them again. Not a bug -> bogus
 [2003-08-20 06:21 UTC] i dot spalletti at iast dot it
I understand, but PHP 4.3.2 will load the second URL, not the first one.
Which is the right behavior?
 [2003-08-20 06:27 UTC] moriyoshi@php.net
Unless any output buffering function is enabled, headers would shortly be sent out at the time some output is made.
There's no exception. Check your php.ini.

 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Sun Dec 22 07:01:30 2024 UTC