ID: 32261
Updated by: [EMAIL PROTECTED]
Reported By: takayana at egate1 dot com
Status: Verified
Bug Type: Session related
Operating System: *
PHP Version: 4CVS-2005-03-23
New Comment:
bug #24485 seems to be same issue as this.
Previous Comments:
------------------------------------------------------------------------
[2005-03-24 08:08:16] takayana at egate1 dot com
If it can do With PHP4.X I would like
you to carry out fix.
------------------------------------------------------------------------
[2005-03-24 07:46:37] [EMAIL PROTECTED]
Seems also to be fixed in HEAD (PHP 5.1.0-dev)
------------------------------------------------------------------------
[2005-03-23 01:29:49] [EMAIL PROTECTED]
Here's the shortest possible example script I came up with,
which does exactly same as your multiple scripts plus
shows what really happens:
<?php
class data {var $f;}
session_start();
$phase = isset($_GET['phase']) ? $_GET['phase'] : 1;
switch ($phase) {
case 1:
$_SESSION['foo'][0] = new data;
$_SESSION['foo'][0]->f = 1;
$_SESSION['foo'][1] = new data;
$_SESSION['foo'][1]->f = 2;
header("Location: test_web.php?phase=2");
exit(1);
break;
case 2:
$_SESSION['bar'] = new data;
$_SESSION['bar']->f = 3;
header("Location: test_web.php?phase=3");
exit(1);
break;
case 3:
$_SESSION['foo'][0] = $_SESSION['bar']; // Here be bug
header("Location: test_web.php?phase=4");
exit(1);
break;
case 4:
$_SESSION['bar'] = 'foo';
header("Location: test_web.php?phase=5");
exit(1);
break;
case 5:
echo '<pre>';
var_dump($_SESSION);
echo '</pre>';
break;
}
?>
Output is this:
array(2) {
["foo"]=>
array(2) {
[0]=>
&string(3) "foo"
[1]=>
object(data)(1) {
["f"]=>
int(2)
}
}
["bar"]=>
&string(3) "foo"
}
Result: ['bar'] became a reference to ['foo'][0]
(Does NOT happen when using arrays instead of object)
------------------------------------------------------------------------
[2005-03-10 11:58:17] takayana at egate1 dot com
Description:
------------
By a Session variable Operation by PHP4.3.10 carries out different
operation from a low-ranking version.
When the following 6 files are created and test_web1.php is performed,
in the case of a low rank version (for example, PHP4.3.9)
$_SESSION '[data]' Arrangement id value 31, 1, 2, 3, 4, and 5 ...
Although set to 20, in the case of PHP4.3.10, it is. 31, 1, 2, 3, 3,
and 5 ... It will be set to 20.
Reproduce code:
---------------
http://www.egate1.com/docs/.tmp/code.txt
------------------------------------------------------------------------
--
Edit this bug report at http://bugs.php.net/?id=32261&edit=1