Re: Urgent patch for traits in PHP 5.4
| From: | Pierre Joye | Date: | Fri, 13 Jan 2012 12:25:20 +0000 |
| Subject: | Re: Urgent patch for traits in PHP 5.4 | ||
| References: | 1 2 3 4 5 6 7 8 | Groups: | php.internals |
| Request: | Send a blank email to internals+get-57348@lists.php.net to get a copy of this message | ||
adding david too to the loop.
On Fri, Jan 13, 2012 at 10:36 AM, Dmitry Stogov <dmitry@zend.com> wrote:
> Hi,
>
> Recently we've found a huge problem in PHP traits implementation.
>
> It performs copying of each op_array (with all opcodes!) for each method
> used from trait. This not only makes traits extremely slow and reduce effect
> of opcode caches, but also prohibits extensions from modifying op_array in
> some way, e.g. extending op_arrays with additional information in
> op_array.reserved* fields. As result some extensions (e.g. xdebug and some
> Zend extensions) will just crash on traits usage.
>
> As I understood the copying was done only for proper handling of __CLASS__
> constant in trait methods. I think it's too radical solution.
> I've introduced ZEND_CLASS_NAME instruction instead and made op_arrays to
> share their opcodes (in the same way as inherited methods). The only
> difference that methods from traits may be renamed.
>
> The patch is attached (it requires executor/scanner/parser regeneration)
> I would like to commit it into 5.4 and trunk. Note that the patch makes
> binary compatibility break and can't be applied to 5.4.* after 5.4.0
> release.
>
> I know that applying it may delay the PHP 5.4.0 release, but it's better to
> fix the problem now.
>
> Thanks. Dmitry.
>
> --
> PHP Internals - PHP Runtime Development Mailing List
> To unsubscribe, visit: http://www.php.net/unsub.php
--
Pierre
@pierrejoye | http://blog.thepimp.net | http://www.libgd.org