#37229 [Com]: values of $_SESSION array in copyies are references

From: Date: Thu, 27 Apr 2006 22:47:50 +0000
Subject: #37229 [Com]: values of $_SESSION array in copyies are references
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-96300@lists.php.net to get a copy of this message
ID: 37229 Comment by: judas dot iscariote at gmail dot com Reported By: mcsimm at inbox dot ru Status: Open Bug Type: Session related Operating System: FreeBSD 5.4-RELEASE PHP Version: 4.4.2 New Comment: your test produces the "expected result" in current 5.2.0-dev CVS. Previous Comments: ------------------------------------------------------------------------ [2006-04-27 22:33:27] mcsimm at inbox dot ru 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 this bug report at http://bugs.php.net/?id=37229&edit=1

« previous php.bugs (#96300) next »