Hi!

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.

I've done some checks and discovered __CLASS__ behaves somewhat strangely with traits. COnsider this code:

<?
trait foo {
public $bar = __CLASS__;
function bar() { var_dump($this->bar); }
}

class foofoo {
        use foo;
}

class foofoo2 {
        use foo;
}

$a = new foofoo();
$a->bar();
$a = new foofoo2();
$a->bar();
echo "OK!";

Before the patch, it prints $this->bar as NULL. After the patch, I get:

Fatal error: Invalid binding type in - on line 5

Both behaviors seem to be wrong, as __CLASS__ works as constant in regular classes. Looks like even before the patch __CLASS__ handling wasn't correct, but patch also seems to break something.
--
Stanislav Malyshev, Software Architect
SugarCRM: http://www.sugarcrm.com/
(408)454-6900 ext. 227

--
PHP Internals - PHP Runtime Development Mailing List
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to