ID:               33585
 User updated by:  piero dot mac at gmail dot com
 Reported By:      piero dot mac at gmail dot com
 Status:           Bogus
 Bug Type:         Session related
 Operating System: WIN XP HOME sp2
 PHP Version:      5.0.4
 New Comment:

Ok. Maybe it's my fault don't explain very well the problem. I try
again ... the last. Forget $_POST. Find here another example:
Page1.php
<?php
session_start();
$_test = array('one'=> 'first','two' => 'second', 'last'=>'last');
$_SESSION = $_test;
echo "<pre>";
print_r($_test);
print_r($_SESSION);
echo "<a href='page2.php'>to page 2</a>";
?>

page2.php
<?php
session_start();
     echo "<pre>";
     print_r($_SESSION);
?>

$_SESSION in page2.php is empty. It's no good.

try now another one.

Page1_a.php
<?php
session_start();
$_test = array('one_a'=> 'first','two_a' => 'second',
'last_a'=>'last');

  foreach($_test as $key => $value)  {
    $_SESSION[$key] = $value;
    }
echo "<pre>";
print_r($_test);
print_r($_SESSION);
echo "<a href='page2.php'>to page 2</a>";
?>

now $_SESSION is correctly full.

I repeate once again... before rel. 5.0.4 never happen this
problem.

Nothing to do with POST, isset() or empty(). Only it was the more
lighting problem for me.

Thnx for the attention and best regard.


Previous Comments:
------------------------------------------------------------------------

[2005-07-06 13:28:55] [EMAIL PROTECTED]

Read carefully my last comment.
Change isset() to !empty() and see that it works perfectly.


------------------------------------------------------------------------

[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] [EMAIL PROTECTED]

$_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>";
?>

------------------------------------------------------------------------

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

Reply via email to