#37229 [Opn->Fbk]: values of $_SESSION array in copyies are references

From: Date: Fri, 28 Apr 2006 00:43:45 +0000
Subject: #37229 [Opn->Fbk]: values of $_SESSION array in copyies are references
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-96304@lists.php.net to get a copy of this message
ID: 37229 Updated by: bjori@php.net Reported By: mcsimm at inbox dot ru -Status: Open +Status: Feedback Bug Type: Session related Operating System: FreeBSD 5.4-RELEASE PHP Version: 4.4.2 New Comment: Please try using this CVS snapshot: http://snaps.php.net/php4-STABLE-latest.tar.gz For Windows: http://snaps.php.net/win32/php4-win32-STABLE-latest.zip Can't reproduce Previous Comments: ------------------------------------------------------------------------ [2006-04-27 22:47:50] judas dot iscariote at gmail dot com your test produces the "expected result" in current 5.2.0-dev CVS. ------------------------------------------------------------------------ [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 (#96304) next »