Re: assign to $this

From: Date: Thu, 15 Apr 2004 22:32:58 +0000
Subject: Re: assign to $this
References: 1  Groups: php.pear.qa 
Request: Send a blank email to pear-qa+get-1124@lists.php.net to get a copy of this message
On Fri, 16 Apr 2004 00:07:46 +0200, Tobias Schlitt wrote: > Lorenzo Alberton wrote: >>> just as an FYI eval() would work as Derick pointed out to me. >>> >> Ok, I confirm that. The eval() solution [1] works :-) >> > But do we really want to recommend eval()? > No objection from my side, but it should really be pointed out, > that this is a emergency solution and should not > become common. side-quoting Lukas from a php-internals post, it's an ugly hack for an ugly issue. It's the only (and I repeat "only") working solution I've heard so far for this problem. I'm not reccomending it if not absolutely necessary, but even if it's the first time I'm using eval(), I don't consider this function evil (at least for this fairly safe case). Many pear packages are using it, btw... So, if a class is internally (as in "deep inside") using an assignment to $this, probably there are other means to keep BC. If its usage is exposed like in a constructor, then I fear there's not much else to do. Best regards, Lorenzo

« previous php.pear.qa (#1124) next »