From: cysgwr_eryri at yahoo dot dot dot co dot dot dot uk Operating system: Mandrake 9.1 PHP version: 4.3.3 PHP Bug Type: HTTP related Bug description: Strange behaviour of header() function
Description: ------------ Hello. I'm not sure whether this is a bug or a configuration error, but it has me stumped. I've searched the bugs and can't quite find anything exactly the same. Ironically, a number of people have complained about 'Location: ' not working, but it works perfectly here, and that's not what my problem is. Operating system is Mandrake 9.1. Web Server is Apache 1.38 with php 4.3.3 (problem occurs whether either statically compiled-in or as dynamic .so using apxs), with mod_perl 1.28 as a dynamic .so under apxs (problem occurs whether this is loaded or not). Problem occurs whether using php.ini-dist or a customised version. All ingredients compiled from source. I was trying to change some of the headers. The production code is massive and unwieldy, but managed to display the same symptoms with code reproduced below. In short: On a normal request the server reponds as follows: HTTP/1.1 200 OK Date: Thu, 16 Oct 2003 15:44:22 GMT Server: Apache/1.3.28 (Unix) mod_perl/1.28 PHP/4.3.3 X-Powered-By: PHP/4.3.3 Connection: close Content-Type: text/html However, trying to change *any* of the headers that are already present fails. This fails whether you specify the boolean 'append' value or not (if not, nothing is changed, if you specify 'appended', nothing is added). Adding other headers works perfectly fine, but trying to change those already present does not. Using the code provided the server returns this: HTTP/1.1 200 OK Date: Thu, 16 Oct 2003 16:07:54 GMT Server: Apache/1.3.28 (Unix) mod_perl/1.28 PHP/4.3.3 X-Powered-By: PHP/4.3.3 Foo: Bar Monkey: Nuts Connection: close Content-Type: text/html The new headers are added perfectly correctly, but the old ones are not altered at all. Is is just that these two headers are unalterable, is this a bug, or could it be a configuration issue? Reproduce code: --------------- <?php //change headers (older date, different server) header('Server: Monkey/1.0'); header('Date: Mon, 18 Nov 2002 11:24:52 GMT'); //add other headers for testing... header("Foo: Bar"); header("Monkey: Nuts"); ?> -- Edit bug report at http://bugs.php.net/?id=25890&edit=1 -- Try a CVS snapshot (php4): http://bugs.php.net/fix.php?id=25890&r=trysnapshot4 Try a CVS snapshot (php5): http://bugs.php.net/fix.php?id=25890&r=trysnapshot5 Fixed in CVS: http://bugs.php.net/fix.php?id=25890&r=fixedcvs Fixed in release: http://bugs.php.net/fix.php?id=25890&r=alreadyfixed Need backtrace: http://bugs.php.net/fix.php?id=25890&r=needtrace Try newer version: http://bugs.php.net/fix.php?id=25890&r=oldversion Not developer issue: http://bugs.php.net/fix.php?id=25890&r=support Expected behavior: http://bugs.php.net/fix.php?id=25890&r=notwrong Not enough info: http://bugs.php.net/fix.php?id=25890&r=notenoughinfo Submitted twice: http://bugs.php.net/fix.php?id=25890&r=submittedtwice register_globals: http://bugs.php.net/fix.php?id=25890&r=globals PHP 3 support discontinued: http://bugs.php.net/fix.php?id=25890&r=php3 Daylight Savings: http://bugs.php.net/fix.php?id=25890&r=dst IIS Stability: http://bugs.php.net/fix.php?id=25890&r=isapi Install GNU Sed: http://bugs.php.net/fix.php?id=25890&r=gnused Floating point limitations: http://bugs.php.net/fix.php?id=25890&r=float