note 78389 deleted from language.oop5.basic by cmb
| From: | cmb@php.net | Date: | Mon, 21 Nov 2016 18:17:44 +0000 |
| Subject: | note 78389 deleted from language.oop5.basic by cmb | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-207272@lists.php.net to get a copy of this message | ||
Note Submitter: alan at alan-ng dot net
----
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.