From: adrian dot carstea at gmail dot com Operating system: Fedora Core 4 PHP version: 5.1.2 PHP Bug Type: Session related Bug description: post variables appear in session
Description: ------------ post variables appear in session after 3 posts... $_GET Array ( ) $_POST Array ( [search_didi] => asd [submitare] => Cautare simpla // !!!!!!!!! [submit] => Cautare // !!!!!!!!! ) $_SESSION Array ( [submitare] => Cautare simpla // !!!!!!!!! [submit] => Cautare // !!!!!!!!! [search_didi] => asd ) Reproduce code: --------------- Source code tested on php5.0.4, php5.1.2 (works fine on php4.4.0) <? session_start(); if(isset($_POST['submitare']) && ($_POST['submitare']=='Cautare simpla' || $_POST['submitare']=='Cautare avansata')){ foreach($_SESSION as $key=>$value){ if(preg_match("@[EMAIL PROTECTED]",$key)){ unset($_SESSION["{$key}"]); } } foreach($_POST as $key=>$value){ //echo $key." ".$value."<hr>"; if(preg_match("@[EMAIL PROTECTED]",$key)){ echo $key."=".$value."<hr>"; $_SESSION["{$key}"]=$value; } } } echo "<pre>"; print_r($_GET); print_r($_POST); print_r($_SESSION); echo "</pre>"; if(!isset($_POST['submitare']) && !isset($_GET['page'])){ foreach($_SESSION as $key=>$value){ if(preg_match("@[EMAIL PROTECTED]",$key)){ unset($_SESSION["{$key}"]); } } } ?> <form action="" method="POST"> Cauta: <input type="text" name="search_didi" value="" /> <input type="hidden" name="submitare" value="Cautare simpla" /> <input type="submit" name="submit" value="Cautare" /> </form> Expected result: ---------------- $_GET Array ( ) $_POST Array ( [search_didi] => asd [submitare] => Cautare simpla // !!!!!!!!! [submit] => Cautare // !!!!!!!!! ) $_SESSION Array ( [search_didi] => asd ) -- Edit bug report at http://bugs.php.net/?id=37050&edit=1 -- Try a CVS snapshot (PHP 4.4): http://bugs.php.net/fix.php?id=37050&r=trysnapshot44 Try a CVS snapshot (PHP 5.1): http://bugs.php.net/fix.php?id=37050&r=trysnapshot51 Try a CVS snapshot (PHP 6.0): http://bugs.php.net/fix.php?id=37050&r=trysnapshot60 Fixed in CVS: http://bugs.php.net/fix.php?id=37050&r=fixedcvs Fixed in release: http://bugs.php.net/fix.php?id=37050&r=alreadyfixed Need backtrace: http://bugs.php.net/fix.php?id=37050&r=needtrace Need Reproduce Script: http://bugs.php.net/fix.php?id=37050&r=needscript Try newer version: http://bugs.php.net/fix.php?id=37050&r=oldversion Not developer issue: http://bugs.php.net/fix.php?id=37050&r=support Expected behavior: http://bugs.php.net/fix.php?id=37050&r=notwrong Not enough info: http://bugs.php.net/fix.php?id=37050&r=notenoughinfo Submitted twice: http://bugs.php.net/fix.php?id=37050&r=submittedtwice register_globals: http://bugs.php.net/fix.php?id=37050&r=globals PHP 3 support discontinued: http://bugs.php.net/fix.php?id=37050&r=php3 Daylight Savings: http://bugs.php.net/fix.php?id=37050&r=dst IIS Stability: http://bugs.php.net/fix.php?id=37050&r=isapi Install GNU Sed: http://bugs.php.net/fix.php?id=37050&r=gnused Floating point limitations: http://bugs.php.net/fix.php?id=37050&r=float No Zend Extensions: http://bugs.php.net/fix.php?id=37050&r=nozend MySQL Configuration Error: http://bugs.php.net/fix.php?id=37050&r=mysqlcfg