From:             webmaster at digitalanime dot nl
Operating system: Linux
PHP version:      4.3.4
PHP Bug Type:     Output Control
Bug description:  header() works, but not with variables, after a POST request

Description:
------------
Hello there..



I've been fighting with this code for about a day or two, but it just
doesn't seem to work..



If I use output buffering, post a form and want to do a header(), it
works.... Only it doesn't when I want to use $_SERVER['REQUEST_URI']..

Reproduce code:
---------------
<?php

ob_start(); // start the outputbuffer

if(!empty($_POST) && !isset($_SESSION['form'])) { // my POST is full, but
we can't find a session variable... Strange.. There's someone fucking with
my site

 header('location: ' . $_SERVER['REQUEST_URI']);

}

if(empty($_POST)) { // POST is empty... Let's show a form here:

 // do my form here + make a session for the form

}

else { // POST is NOT empty... Let's handle the data

 // handle my data here

}

if(!empty($_POST) && isset($_SESSION['form'])) { // my POST is full, and
the session exists.. Fine, let's unset() it. :)

 unset($_SESSION['form']); // unsetting the session..

}

ob_end_flush();

?>

Expected result:
----------------
Well, the first thing I wanted to see, is that the form shows up (yes, it
really does, so that's not wrong..)



After that, I'll fill it in and submit it..



I get my data and so.. But, if I refresh, the browser asks me if I want to
send the data again.... I click yes, and my code works, except for the
header().



If I put header('location: index.php'); in it, It works, but not with
$_SERVER['REQUEST_URI'].



EVERYTHING works, except for REQUEST_URI, QUERY_STRING and any of the GET
variables..

Actual result:
--------------
A whole blank page..



With about:blank in the title bar..



Al that, nothing more, nothing less.

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

Reply via email to