#33585 [Opn->Bgs]: Session saved file empty.

From: Date: Wed, 06 Jul 2005 11:28:56 +0000
Subject: #33585 [Opn->Bgs]: Session saved file empty.
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-81466@lists.php.net to get a copy of this message
ID: 33585 Updated by: tony2001@php.net Reported By: piero dot mac at gmail dot com -Status: Open +Status: Bogus Bug Type: Session related Operating System: WIN XP HOME sp2 PHP Version: 5.0.4 New Comment: Read carefully my last comment. Change isset() to !empty() and see that it works perfectly. Previous Comments: ------------------------------------------------------------------------ [2005-07-06 13:26:32] piero dot mac at gmail dot com ref. $_POST is always set, it's just empty when there is no POST data. So it comes that you set _SESSION to empty array(). No bug here -> bogus. Problem is not POST of course is empty after refresh page. Problem is "NO DATA had stored in session save file". you can try also: if(isset($_POST) && !empty ($_POST)) { Php 5.0.3 and previoulsy are true. Thanx any way... ------------------------------------------------------------------------ [2005-07-06 13:19:49] piero dot mac at gmail dot com Sorry, but I see a refresh link error in page2.php Last line is href = "page2.php" and not href=bug2.php.... page2.php <-- correct version, thanx. <?php session_start(); if(isset($_POST)) { $_SESSION = $_POST; } else { $_POST = $_SESSION; } echo "<pre>"; print_r($_POST); print_r($_SESSION); echo "<a href='page2.php'>refresh</a></pre>"; ?> After page refresh $_SESSION is empty and any session data stored in session save file. ------------------------------------------------------------------------ [2005-07-06 13:16:47] tony2001@php.net $_POST is always set, it's just empty when there is no POST data. So it comes that you set _SESSION to empty array(). No bug here -> bogus. ------------------------------------------------------------------------ [2005-07-06 13:08:13] piero dot mac at gmail dot com No errors or notices are displayed. Im sorry, but right now, I don't have any available URL at this time. Here you find all reproduced bug code: pag1.php <?php $html = <<<EOD <html><body><form action = "page2.php" method = "post"> name <input type="text" name="nick" value="pippo"><br /> city <input type="text" name="city" value ="Turin"><br /> <input type="submit" name="submit" value = "submit"> </form></body></html> EOD; echo $html; ?> page2.php <?php session_start(); if(isset($_POST)) { $_SESSION = $_POST; } else { $_POST = $_SESSION; } echo "<pre>"; print_r($_POST); print_r($_SESSION); echo "<a href='bug2.php'>refresh</a>"; ?> ------------------------------------------------------------------------ [2005-07-06 12:21:40] tony2001@php.net Thank you for this bug report. To properly diagnose the problem, we need a short but complete example script to be able to reproduce this bug ourselves. A proper reproducing script starts with <?php and ends with ?>, is max. 10-20 lines long and does not require any external resources such as databases, etc. If possible, make the script source available online and provide an URL to it here. Try to avoid embedding huge scripts into the report. Can't reproduce. Please set display_errors to On and error_reporting to E_ALL in your php.ini and see if there are any error messages. ------------------------------------------------------------------------ The remainder of the comments for this report are too long. To view the rest of the comments, please view the bug report online at http://bugs.php.net/33585 -- Edit this bug report at http://bugs.php.net/?id=33585&edit=1

« previous php.bugs (#81466) next »