#37050 [Opn->Bgs]: post variables appear in session

From: Date: Wed, 12 Apr 2006 09:51:21 +0000
Subject: #37050 [Opn->Bgs]: post variables appear in session
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-95654@lists.php.net to get a copy of this message
ID: 37050 Updated by: tony2001@php.net Reported By: adrian dot carstea at gmail dot com -Status: Open +Status: Bogus Bug Type: Session related Operating System: Fedora Core 4 PHP Version: 5.1.2 New Comment: Sorry, but your problem does not imply a bug in PHP itself. For a list of more appropriate places to ask for help using PHP, please visit http://www.php.net/support.php as this bug system is not the appropriate forum for asking support questions. Due to the volume of reports we can not explain in detail here why your report is not a bug. The support channels will be able to provide an explanation for you. Thank you for your interest in PHP. Previous Comments: ------------------------------------------------------------------------ [2006-04-12 09:38:31] adrian dot carstea at gmail dot com 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("@_didi$@i",$key)){ unset($_SESSION["{$key}"]); } } foreach($_POST as $key=>$value){ //echo $key." ".$value."<hr>"; if(preg_match("@_didi$@i",$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("@_didi$@i",$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 this bug report at http://bugs.php.net/?id=37050&edit=1

« previous php.bugs (#95654) next »