|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
[2005-07-01 18:41 UTC] derick@php.net
|
|||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Mon Dec 01 15:00:01 2025 UTC |
Description: ------------ i can understand this error from inside a class class Foo{ function bar(){ $this =& $something_else; } } but i should think one can assign a ref to $this to another var. class Foo{ function bar(){ $this_dupe =& $this; //fails to compile $this_dupe = $this; //compiles okay } } the reason i bring this up, is in php4 and 5.0 this is allowed .. if code needs to run on php4 without silly performance hits (i.e. data copy on assignment), would be nice to keep that. from the error it seems it is trying to do this $this =& $this_dupe .. but that is not what is being done Reproduce code: --------------- <?php class Foo{ function bar(){ $this_dupe =& $this; //fails to compile $this_dupe = $this; //works a okay } } Expected result: ---------------- hopefully it should compile fine Actual result: -------------- Fatal error: Cannot re-assign $this in {test.php} on line 4