Re: header() not working with a http_response_code
| From: | Lester Caine | Date: | Tue, 05 May 2020 14:03:11 +0000 |
| Subject: | Re: header() not working with a http_response_code | ||
| References: | 1 2 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-327137@lists.php.net to get a copy of this message | ||
On 05/05/2020 12:01, Jānis Elmeris wrote:
Can you give an example header call that is not working for you?
https://github.com/bitweaver/kernel/blob/f91b6271a72cbbe390bf3ce2d13464090c3d1613/kernel_lib.php#L700
I've had to comment out the ", TRUE, $pStatusCode );" so that we get a simple header( 'Location: ' . $pUrl ); The trigger is normally from a 'page not found' and supplies that error code.
Not quite sure when this stopped working but it has been working for many years ...
piektd., 2020. g. 1. maijs, plkst. 12:20 — lietotājs Lester Caine (<lester@lsces.uk <mailto:lester@lsces.uk>>) rakstīja:-- Lester Caine - G8HFL ----------------------------- Contact - https://lsces.uk/wiki/Contact L.S.Caine Electronic Services - https://lsces.uk Model Engineers Digital Workshop - https://medw.uk Rainbow Digital Media - https://rainbowdigitalmedia.ukMy framework is using header() to redirect when an invalid page is hit, with the http_response_code providing the reason. This stopped working some time back and I had assumed it was just a problem with 'extra space' which I had not tracked down, but now I've eliminated that possibility ( and corrected a couple of smarty files ) I'm still just getting a blank screen!The problem seems to be the addition of $pStatusCode in header() ... have dropped that so header only uses the Url and things are are least redirecting. I suspect this is something to do with PHP changes as I'm currently using PHP7.2 and still keep hitting things which need to be reworked from the PHP5 base but I can't see any notes about this being changed in PHP ... what am I missing?