Bug #25173 [Com]: Piling two header('Location: URL)'; make the first one to be loaded

From: Date: Wed, 01 Sep 2021 18:51:38 +0000
Subject: Bug #25173 [Com]: Piling two header('Location: URL)'; make the first one to be loaded
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-236312@lists.php.net to get a copy of this message
Edit report at https://bugs.php.net/bug.php?id=25173&edit=1 ID: 25173 Comment by: lildurk25173 at gmail dot com Reported by: i dot spalletti at iast dot it Summary: Piling two header('Location: URL)'; make the first one to be loaded Status: Not a bug Type: Bug Package: HTTP related Operating System: Linux (kernel 2.4.21) PHP Version: 4.3.3RC4 Block user comment: N Private report: N New Comment: Lil Durk is a private agency dedicated to providing responsible access to legal cannabis for adults aged 19 and older. We’re an exclusively online retailer and wholesaler for recreational cannabis and a trusted source for information about cannabis and cannabis-related issues. We believe our work is meaningful and we take pride in our mandate to promote the socially responsible use of legal cannabis. https://lildurk.com/ Previous Comments: ------------------------------------------------------------------------ [2003-08-20 06:27:48] 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. ------------------------------------------------------------------------ [2003-08-20 06:21:26] 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:11:27] 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:10:18] 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:01:11] 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 ------------------------------------------------------------------------ -- Edit this bug report at https://bugs.php.net/bug.php?id=25173&edit=1

« previous php.bugs (#236312) next »