Bug #16102: >1 session variables not getting set correctly
| From: | martin_jones at bigfoot dot com | Date: | Fri, 15 Mar 2002 19:52:19 +0000 |
| Subject: | Bug #16102: >1 session variables not getting set correctly | ||
| Groups: | php.bugs | ||
| Request: | Send a blank email to php-bugs+get-2604@lists.php.net to get a copy of this message | ||
From: martin_jones@bigfoot.com
Operating system: Windows 2000/XP
PHP version: 4.1.2
PHP Bug Type: Session related
Bug description: >1 session variables not getting set correctly
The script below works fine on PHP 4.1.1, but fails on 4.1.2.
The script sets two session variables. Only the most recent variable seems
to get set, with the previous variable getting reset.
-----Script-----
<html>
<body>
<?php
session_start();
$varTest1 = "";
$varTest2 = "";
session_register("TEST1");
session_register("TEST2");
if (isset($_POST['TEST1'])) {
$varTest1 = $_POST['TEST1'];
$_SESSION['TEST1'] = $_POST['TEST1'];
}
if (isset($_POST['TEST2'])) {
$varTest2 = $_POST['TEST2'];
$_SESSION['TEST2'] = $_POST['TEST2'];
}
if (!isset($_SESSION['TEST1'])) {
$_SESSION['TEST1'] = "NOT SET";
}
if (!isset($_SESSION['TEST2'])) {
$_SESSION['TEST2'] = "NOT SET";
}
foreach ($_SESSION as $varKey=>$varValue) echo "$varKey =>
$varValue</br>";
?>
<form action="sesstest.php" method="POST">
<?php
if (isset($_POST['SUBMIT1'])) {
?>
<input type="text" value="<?php echo $varTest1; ?>"
name="TEST1">
<input type="SUBMIT" name="SUBMIT" value="Form1">
<?php
} else {
?>
<input type="text" value="<?php echo $varTest2; ?>"
name="TEST2">
<input type="SUBMIT" name="SUBMIT1" value="Form2">
<?php
}
?>
</form>
</body>
</html>
------Script End-------
The script should be saved as sesstest.php
The modules configured are GD and XSLT
If you need more information, please contact me.
--
Martin
--
Edit bug report at http://bugs.php.net/?id=16102&edit=1
--
Fixed in CVS: http://bugs.php.net/fix.php?id=16102&r=fixedcvs
Fixed in release: http://bugs.php.net/fix.php?id=16102&r=alreadyfixed
Need backtrace: http://bugs.php.net/fix.php?id=16102&r=needtrace
Try newer version: http://bugs.php.net/fix.php?id=16102&r=oldversion
Not developer issue: http://bugs.php.net/fix.php?id=16102&r=support
Expected behavior: http://bugs.php.net/fix.php?id=16102&r=notwrong
Not enough info: http://bugs.php.net/fix.php?id=16102&r=notenoughinfo
Submitted twice: http://bugs.php.net/fix.php?id=16102&r=submittedtwice