note 93292 added to language.references

From: Date: Tue, 01 Sep 2009 20:07:28 +0000
Subject: note 93292 added to language.references
Groups: php.notes 
Request: Send a blank email to php-notes+get-160134@lists.php.net to get a copy of this message
After hours of confusion and reading tons of posts I finally figured out that replacing PHP 4 style object creation, where new is assigned by reference: $node_obj =& new someClass($somearg, $moreargs); which in PHP 5.3.0 generates an E_STRICT message telling you that "Assigning the return value of new by reference is deprecated" with the following, where & has been removed: $node_obj = new someClass($somearg, $moreargs); in some cases (at least in recursive loops while creating a tree of nodes containing child nodes) requires unset($node_obj); before the actual object assignment line to avoid all child nodes becoming identical. Hope that delicate piece of information will save someone else a few hours. ---- Server IP: 69.147.83.197 Probable Submitter: 213.114.175.111 ---- Manual Page -- http://www.php.net/manual/en/language.references.php Edit -- https://master.php.net/note/edit/93292 Del: integrated -- https://master.php.net/note/delete/93292/integrated Del: useless -- https://master.php.net/note/delete/93292/useless Del: bad code -- https://master.php.net/note/delete/93292/bad+code Del: spam -- https://master.php.net/note/delete/93292/spam Del: non-english -- https://master.php.net/note/delete/93292/non-english Del: in docs -- https://master.php.net/note/delete/93292/in+docs Del: other reasons-- https://master.php.net/note/delete/93292 Reject -- https://master.php.net/note/reject/93292 Search -- https://master.php.net/manage/user-notes.php

« previous php.notes (#160134) next »