From:             mcsimm at inbox dot ru
Operating system: FreeBSD 5.4-RELEASE
PHP version:      4.4.2
PHP Bug Type:     Session related
Bug description:  values of $_SESSION array in copyies are references

Description:
------------
When keeping copyies of $_SESSION array its values are copied as
references.

Bug has found in version 4.4.2 (FreeBSD)
In version 4.3.10 (Windows) this work correctly.

Reproduce code:
---------------
<?php
session_start();
$test_array = array();

$_SESSION['var'] = 'first';
$copy1 = $_SESSION;

$_SESSION['var'] = 'second';
$copy2 = $_SESSION;

var_dump($copy1);
var_dump($copy2);
?>

Expected result:
----------------
array(1) {
  ["var"]=>
  string(5) "first"
}
array(1) {
  ["var"]=>
  string(6) "second"
}

Actual result:
--------------
array(1) {
  ["var"]=>
  &string(6) "second"
}
array(1) {
  ["var"]=>
  &string(6) "second"
}

-- 
Edit bug report at http://bugs.php.net/?id=37229&edit=1
-- 
Try a CVS snapshot (PHP 4.4): 
http://bugs.php.net/fix.php?id=37229&r=trysnapshot44
Try a CVS snapshot (PHP 5.1): 
http://bugs.php.net/fix.php?id=37229&r=trysnapshot51
Try a CVS snapshot (PHP 6.0): 
http://bugs.php.net/fix.php?id=37229&r=trysnapshot60
Fixed in CVS:                 http://bugs.php.net/fix.php?id=37229&r=fixedcvs
Fixed in release:             
http://bugs.php.net/fix.php?id=37229&r=alreadyfixed
Need backtrace:               http://bugs.php.net/fix.php?id=37229&r=needtrace
Need Reproduce Script:        http://bugs.php.net/fix.php?id=37229&r=needscript
Try newer version:            http://bugs.php.net/fix.php?id=37229&r=oldversion
Not developer issue:          http://bugs.php.net/fix.php?id=37229&r=support
Expected behavior:            http://bugs.php.net/fix.php?id=37229&r=notwrong
Not enough info:              
http://bugs.php.net/fix.php?id=37229&r=notenoughinfo
Submitted twice:              
http://bugs.php.net/fix.php?id=37229&r=submittedtwice
register_globals:             http://bugs.php.net/fix.php?id=37229&r=globals
PHP 3 support discontinued:   http://bugs.php.net/fix.php?id=37229&r=php3
Daylight Savings:             http://bugs.php.net/fix.php?id=37229&r=dst
IIS Stability:                http://bugs.php.net/fix.php?id=37229&r=isapi
Install GNU Sed:              http://bugs.php.net/fix.php?id=37229&r=gnused
Floating point limitations:   http://bugs.php.net/fix.php?id=37229&r=float
No Zend Extensions:           http://bugs.php.net/fix.php?id=37229&r=nozend
MySQL Configuration Error:    http://bugs.php.net/fix.php?id=37229&r=mysqlcfg

Reply via email to