note 78390 added to ref.session

From: Date: Wed, 10 Oct 2007 04:44:43 +0000
Subject: note 78390 added to ref.session
Groups: php.notes 
Request: Send a blank email to php-notes+get-131262@lists.php.net to get a copy of this message
The following odd behavior happens in php version 5.1.4 (and presumably some other versions) that does not happen in php version 5.2.1 (and possibly other versions > 5.1.4). <?php $_SESSION['instance']=...; $instance=new SomeClass; ?> The second line will not only create the $instance object successfully, it will also modify the value of $_SESSION['instance']! The workaround I arrived at, after trial and error, was to avoid using object names which match a $_SESSION array key. This is not intended to be a bug report, since it was apparently fixed by version 5.2.1, so it's just a workaround suggestion. ---- Server IP: 69.147.83.197 Probable Submitter: 76.201.152.69 ---- Manual Page -- http://www.php.net/manual/en/ref.session.php Edit -- https://master.php.net/note/edit/78390 Del: integrated -- https://master.php.net/note/delete/78390/integrated Del: useless -- https://master.php.net/note/delete/78390/useless Del: bad code -- https://master.php.net/note/delete/78390/bad+code Del: spam -- https://master.php.net/note/delete/78390/spam Del: non-english -- https://master.php.net/note/delete/78390/non-english Del: in docs -- https://master.php.net/note/delete/78390/in+docs Del: other reasons-- https://master.php.net/note/delete/78390 Reject -- https://master.php.net/note/reject/78390 Search -- https://master.php.net/manage/user-notes.php

« previous php.notes (#131262) next »