Hello Brad,
Wednesday, August 13, 2003, 8:40:37 AM, you wrote:
BB> this is old subject everyone is tired of i'm sure. but since large changes
BB> have been made to call_user_func[_array] recently, i want to confirm:
BB> if an object calls one of its methods ($thing->foo()), any static-type
BB> method calls made inside there - self::a(), parent::a(), fezbar::a() -
BB> will have $this defined, pointing to original calling object.
BB> self:: and parent:: are always relative to the containing class,
BB> regardless of this.
BB> two exceptions:
BB> - the method is declared as 'static'; if so, $this is never set
BB> - the method is called via call_user_func or call_user_func_array;
BB> if so, $this is not set
BB> the very last part seems like it *might* be a bug, or it might be a
BB> decision - that call_user_func(array('class','function'),$arg)
BB> will always force class::function() to behave as if declared statically.
BB> that is a bit of a problem for self:: and parent:: but that is ok if it
BB> is how it must be.
BB> if anyone can say about this, it would be kind.
BB> ps - i looked in old mail, sure this had been discussed - topic came up,
BB> but nothing for sure, except introduction of 'static' to prevent $this,
BB> which solves opposite problem :)
It is very simple:
If this is defined in a static method it is a language error. However when
mentioning this problem the acronym BC often gets used for what ever reason. I
mean the idea of the new OO model was to have OO in php at least, wasn't it ?
If this isn't defined in a dynamic (non static) method that it is obviously an
error that can't be discussed away. Not even with BC reasons.
Best regards,
Marcus mailto:[EMAIL PROTECTED]
--
PHP Internals - PHP Runtime Development Mailing List
To unsubscribe, visit: http://www.php.net/unsub.php