Edit report at https://bugs.php.net/bug.php?id=63652&edit=1
ID: 63652 Updated by: larue...@php.net Reported by: stealz at op dot pl Summary: Using twice the same trait causes fatal error. Status: Open Type: Bug Package: Class/Object related Operating System: Windows 7 PHP Version: 5.4.9 Block user comment: N Private report: N New Comment: I think PHP had warn you about method collisions.. Previous Comments: ------------------------------------------------------------------------ [2012-12-01 05:52:32] larue...@php.net I think PHP had warn you about method collisions.. ------------------------------------------------------------------------ [2012-11-30 01:48:47] stealz at op dot pl Description: ------------ I think PHP should check whether traits were used already (ex. in parent class) and ignore them instead using again. It causes fatal error due to collisions which are obvious, because trait name is the same. What's interesting, collisions refer only to methods. PHP seems not to see the problem if double-used trait contains properties only. Test script: --------------- trait LifeOrganism { public $age; // it's fine #public function live() {} // uncomment to get Fatal error } trait Man { use LifeOrganism; } trait Elephant { use LifeOrganism; } class ElephantMan { use Man, Elephant; } Expected result: ---------------- Ignore trait which was already used. Actual result: -------------- Fatal error. ------------------------------------------------------------------------ -- Edit this bug report at https://bugs.php.net/bug.php?id=63652&edit=1