Hi

I'm running v4.2.3 on RedHat v7.0 and am getting some strange behaviour with
the $_SESSION superglobal... below is a script to demonstrate the problem...
Whenever the $_SESSION array gets re-created by session_start() the reloaded
test entry is set to -1 however at no time does this value ever get assigned
to the $_SESSION array ... it seems to be picking up the initialised value
of the variable that gets assigned to the array...

It works fine on Win2K albeit v4.3.0 of PHP.

Anybody come across this before?
Cheers
Rich



<?php
session_start();
$test = -1;

echo '<html><body>Initial script load ... $_SESSION value is
'.(isset($_SESSION['test']) ? $_SESSION['test'].' it should be 999...' :
'not set yet').'<br />';

$test = 999;

$_SESSION['test'] = $test;
?>
<form action="<? echo $_SERVER['PHP_SELF'] ?>" method="post">
    <input type="submit" name="but" value="do it">
</form>
<?
echo '<br />After the assignment $test is '.$test.' and the $_SESSION value
is '.$_SESSION['test'].'<br />';
?>
</body>
</html>

The output from the 'initial script load' line is shown below ...

Initial script load ... $_SESSION value is not set yet (first time only)
Initial script load ... $_SESSION value is -1it should be 999... (all
subsequent submits)

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to