Re: non static function called as static one
| From: | Olivier Doucet | Date: | Wed, 11 Mar 2009 22:40:37 +0000 |
| Subject: | Re: non static function called as static one | ||
| References: | 1 2 | Groups: | php.internals |
| Request: | Send a blank email to internals+get-43325@lists.php.net to get a copy of this message | ||
Hi,
> not sure if this was mentioned on the general list but, i believe what
> youre describing is documented in the manual under php5 classes/objects ->
> "the basics":
>
> http://www.php.net/manual/en/language.oop5.basic.php
>
> $this is a reference to the calling object (usually the object to which
> the method belongs, but can be another object, if the method is called
> statically
> <http://www.php.net/manual/en/language.oop5.static.php> from
> the context of a secondary object).
>
> -nathan
>
I know this behaviour is fully documented, but I was more concerned about
"is it a 'normal' behaviour ?". How can a programmer controls the class he
wrote, and make it absolutely bugproof ? How can he detect his function was
called in a static context and forbid it (or write specific code for) ?
Olivier