Re: static call bugs?
| From: | Andi Gutmans | Date: | Sat, 10 Mar 2001 00:06:39 +0000 |
| Subject: | Re: static call bugs? | ||
| References: | 1 | Groups: | php.dev |
| Request: | Send a blank email to php-dev+get-48473@lists.php.net to get a copy of this message | ||
At 12:56 AM 3/10/2001 +0100, André Langhorst wrote:
Hi, 1) I am currently completing the php documentation to cover all undocumented features and I have noticed that using a static method call to the same class from on instanciated object exhibits the presence of the instance within the static callThere are no static functions in PHP. This syntax is used to call a method of the parent. It can be used to call other methods and thus have the wrong $this but I wouldn't document it. In general, I think it's a bad idea to document undocumented features because some of them aren't meant for people to use. The behavior might change in the future. Best if you make a list of the things you want to document and we'll tell you if they are a side-effect, a feature for backwards compatibility but people shouldn't use it anymore or valid behavior.
2) If you uncomment the marked line, you will get an error without any reason...I'll look at this tomorrow. Don't have time right now. Andi
I guess these are bugs, aren't they? <?php class foo {function moo() { // $this->boo=2; // try to remove the comments print '$this is '; if (!isset($this)) { print 'not set'; foo::zoo(); } else { print 'set'; $this->zoo(); foo::zoo(); }} function zoo() { print '<br>'.'I have been called '.(!isset($this) ? 'statically':'via $this->zoo()'); var_dump($this); }} $s=new foo(); $s->moo(); ?><BR><?php foo::moo(); ?> andré --· André Langhorst t: +49 331 5811560 · · andre@php.net m: +49 173 9558736 ·* PHP Quality Assurance http://qa.php.net *