Re: Urgent patch for traits in PHP 5.4
| From: | Stefan Marr | Date: | Sun, 15 Jan 2012 09:57:57 +0000 |
| Subject: | Re: Urgent patch for traits in PHP 5.4 | ||
| References: | 1 2 3 4 5 6 7 8 9 10 11 | Groups: | php.internals |
| Request: | Send a blank email to internals+get-57369@lists.php.net to get a copy of this message | ||
Hi Dmitry:
After Stas nice and encouraging words, I had another look.
But to me it seems that I am not able to get to any of the relevant bits via the scoping infos in
the globals. And I do not see how we could encode something into ZEND_CLASS_NAME.
But I don't have a good overview of the engine, so I probably just miss the obvious.
And Stas, to assuage your pain:
Yes, in the worst case, Dmitry's patch would need a null check on EG(scope) and we make it
return NULL for those properties.
But I bet, someone with a little more insight will have a solution.
Best regards
Stefan
On 14 Jan 2012, at 23:22, Stefan Marr wrote:
> I was thinking that we might want to handle that in zend_do_early_binding but usually these ops
> get changed to NOPs after they have been evaluated.
> And that's not what we need when the op_arrays are shared, I think.
>
> However, the current implementation of ZEND_CLASS_NAME you proposed relies on EG(scope) which
> is not set for the case below.
>
> I might be able to look into it further on Monday, but not earlier, unfortunately.
>
> Best regards
> Stefan
>
>
> trait Foo {
> public $c = __CLASS__;
> }
>
> class Bar {
> use Foo;
> }
>
> $bar = new Bar();
> var_dump($bar);
>
>
> --
> Stefan Marr
> Software Languages Lab
> Vrije Universiteit Brussel
> Pleinlaan 2 / B-1050 Brussels / Belgium
> http://soft.vub.ac.be/~smarr
> Phone: +32 2 629 2974
> Fax: +32 2 629 3525
>
>
> --
> PHP Internals - PHP Runtime Development Mailing List
> To unsubscribe, visit: http://www.php.net/unsub.php
>
--
Stefan Marr
Software Languages Lab
Vrije Universiteit Brussel
Pleinlaan 2 / B-1050 Brussels / Belgium
http://soft.vub.ac.be/~smarr
Phone: +32 2 629 2974
Fax: +32 2 629 3525