From:             lps at cwru dot edu
Operating system: Linux 
PHP version:      4.3.7
PHP Bug Type:     HTTP related
Bug description:  http headers not posted inside an 'if' that reads a preset variable.

Description:
------------
I've tested this buggy script on two substantially different setups:  

Redhat Linux 5.2  running Apache-1.3.31/PHP 4.3.3
Gentoo Linux V1.4 running Yaws-1.40/PHP 4.3.7

The http-header is posted ok if either:

1.  You change the "echo"  to "$foo =" and move the header("Cache..") to
after the if-statement.

2.  The condition in the if statement does not refer to a preset
variable.

Hope this helps,
Leon


Reproduce code:
---------------
<?php
header("Testing: 123");
if ($_SERVER["REQUEST_METHOD"] == "POST") {
    header("Cache-Control: no-store");
    echo $_POST["foo"];
}
?>
<html>
<head>
  <title> Bug in PHP 4.3.3 and PHP 4.3.7 </title>
</head>
<body>
  <form action="test.php" method="post">
  <textarea name="foo">When you submit this, you will not get a
'Cache-Control: no-store' header.</textarea>
  <input type="submit" />
  </form>
</body>
</html>


-- 
Edit bug report at http://bugs.php.net/?id=28956&edit=1
-- 
Try a CVS snapshot (php4):  http://bugs.php.net/fix.php?id=28956&r=trysnapshot4
Try a CVS snapshot (php5):  http://bugs.php.net/fix.php?id=28956&r=trysnapshot5
Fixed in CVS:               http://bugs.php.net/fix.php?id=28956&r=fixedcvs
Fixed in release:           http://bugs.php.net/fix.php?id=28956&r=alreadyfixed
Need backtrace:             http://bugs.php.net/fix.php?id=28956&r=needtrace
Need Reproduce Script:      http://bugs.php.net/fix.php?id=28956&r=needscript
Try newer version:          http://bugs.php.net/fix.php?id=28956&r=oldversion
Not developer issue:        http://bugs.php.net/fix.php?id=28956&r=support
Expected behavior:          http://bugs.php.net/fix.php?id=28956&r=notwrong
Not enough info:            http://bugs.php.net/fix.php?id=28956&r=notenoughinfo
Submitted twice:            http://bugs.php.net/fix.php?id=28956&r=submittedtwice
register_globals:           http://bugs.php.net/fix.php?id=28956&r=globals
PHP 3 support discontinued: http://bugs.php.net/fix.php?id=28956&r=php3
Daylight Savings:           http://bugs.php.net/fix.php?id=28956&r=dst
IIS Stability:              http://bugs.php.net/fix.php?id=28956&r=isapi
Install GNU Sed:            http://bugs.php.net/fix.php?id=28956&r=gnused
Floating point limitations: http://bugs.php.net/fix.php?id=28956&r=float

Reply via email to