#23222 [NEW]: anomaly re: zlib.output_compression and header("Location:...

From: Date: Tue, 15 Apr 2003 08:13:47 +0000
Subject: #23222 [NEW]: anomaly re: zlib.output_compression and header("Location:...
Groups: php.bugs 
Request: Send a blank email to php-bugs+get-37692@lists.php.net to get a copy of this message
From: nospam at 1111-internet dot com Operating system: FreeBSD 4.8 PHP version: 4.3.1 PHP Bug Type: Output Control Bug description: anomaly re: zlib.output_compression and header("Location:... Consider the following code: <?php echo str_repeat("x", 4095); header("Location: /somewhere_else.php"); exit; ?> If zlib.output_compression is off, this will cause 4095 "x"s to display, properly followed by an error on the header line. If zlib.output_compression is on, however, the echo line will execute - but nothing is output immediately because it fails to fill the compression buffer - so the header line goes ahead and executes and redirects successfully, completely spurning the output. Granted, nobody would use this particular example in a real world application - I just set it up to illustrate the problem. I have run into real situations, though, where I'm doing diagnostics or inadvertently cause an error on code lines that logically precede a header("Location:... call. This problem prevents my diagnistic or error messages from showing up. Consider: <?php // set up mysql connection and mysql_query("insert into mytable (myfield) values (". $_GET["myvalue"]. ")"); // no problem if $_GET["myvalue"] is a number, // but if it's a non-numeric string like "abc" that line will generate an error message // which I would like to see so I can fix the problem... // but the error message doesn't fill the compression buffer // so the following redirect happens and usurps the error message header("Location: /somewhere_else.php"); exit; // so I go on as though there was never a problem // until I look at my still-empty database table some time later... ?> -- Edit bug report at http://bugs.php.net/?id=23222&edit=1 -- Try a CVS snapshot: http://bugs.php.net/fix.php?id=23222&r=trysnapshot Fixed in CVS: http://bugs.php.net/fix.php?id=23222&r=fixedcvs Fixed in release: http://bugs.php.net/fix.php?id=23222&r=alreadyfixed Need backtrace: http://bugs.php.net/fix.php?id=23222&r=needtrace Try newer version: http://bugs.php.net/fix.php?id=23222&r=oldversion Not developer issue: http://bugs.php.net/fix.php?id=23222&r=support Expected behavior: http://bugs.php.net/fix.php?id=23222&r=notwrong Not enough info: http://bugs.php.net/fix.php?id=23222&r=notenoughinfo Submitted twice: http://bugs.php.net/fix.php?id=23222&r=submittedtwice register_globals: http://bugs.php.net/fix.php?id=23222&r=globals PHP 3 support discontinued: http://bugs.php.net/fix.php?id=23222&r=php3 Daylight Savings: http://bugs.php.net/fix.php?id=23222&r=dst IIS Stability: http://bugs.php.net/fix.php?id=23222&r=isapi Install GNU Sed: http://bugs.php.net/fix.php?id=23222&r=gnused

« previous php.bugs (#37692) next »