On 11/26/07, Mike Lively <[EMAIL PROTECTED]> wrote:
> I have come up with three different patches that allow us to work around
> the issue of parent:: being considered an 'explicit class reference' and
> thus disallowing static:: to effectively used.
>
> The patches are against 5.3. I also have patches against HEAD but I was
> having problems getting run-tests.php to run against that code base (it
> would hang on the first test no matter which set of tests I ws running.)
>
> All three patches have different levels of intrusiveness to the engine
> and all three patches have been tested against (and pass) the existing
> lsb tests in Zend/tests/lsb_*.phpt
>
> 1.) lsb.parent-forwarding.patch
> This patch modifies the behavior of only parent:: to not change
> EG(called_class) to the parent of the current scope. With this change.
>
> <?php
>
> class A {
> public static function test() {
> echo get_called_class()."\n";
> }
> }
>
> class B extends A {
> public static function test() {
> parent::test();
> }
> }
>
> A::test();
> B::test();
>
> ?>
> will output:
> A
> B
>
> It should be noticed that with this patch parent:: will always resolve
> to the parent of the current scope, it will just not make any changes to
> the called_scope (effectively)
I believe this first patch is the proper way to go. It feels
"natural", "intuitive", etc.
--
Alexey Zakhlestin
http://blog.milkfarmsoft.com/
--
PHP Internals - PHP Runtime Development Mailing List
To unsubscribe, visit: http://www.php.net/unsub.php