On Fri Jul 22 11:17 AM, Alex Howansky wrote: > trait foo > { > public $zoo = 'foo::zoo'; > public function bar() > { > echo "in foo::bar\n"; > } > } > > class baz > { > use foo; > public $zoo = 'baz::zoo'; > public function bar() > { > echo "in baz::bar\n"; > } > } > > $obj = new baz(); > $obj->bar(); > echo $obj->zoo, "\n"; > > We get: > > in baz::bar > foo::zoo > > It seems this is not correct and that it should be: > > in baz::bar > baz::zoo >
The expected behavior is an E_STRICT notice: http://svn.php.net/viewvc/php/php-src/trunk/Zend/tests/traits/property001.ph pt?view=markup&pathrev=306476 If the modifier is different/conflicting (public, protected, private) E_FATAL http://svn.php.net/viewvc?view=revision&revision=306476 http://marc.info/?l=php-internals&m=129251322332367&w=2 The theory is traits should not have conflicting state/properties. Best practice, always choose trait property names carefully/~unique so that you don't run into conflicts. The short answer is it's not a bug but maybe an implementation issue... should it be an E_WARNING instead of E_STRICT? -- PHP Internals - PHP Runtime Development Mailing List To unsubscribe, visit: http://www.php.net/unsub.php