Edit report at https://bugs.php.net/bug.php?id=55424&edit=1
ID: 55424 Comment by: php-bugs at majkl578 dot cz Reported by: Jared dot Williams1 at ntlworld dot com Summary: Fatal error when calling a method from a trait that is defined in parent class Status: Open Type: Bug Package: Scripting Engine problem Operating System: Ubuntu x64 11.04 PHP Version: 5.4SVN-2011-08-15 (SVN) Block user comment: N Private report: N New Comment: With the same test script, I'm getting this error: Fatal error: Cannot make non abstract method Input::setAttribute() abstract in class Text in /www/temp.php on line 27 Previous Comments: ------------------------------------------------------------------------ [2011-08-15 15:56:49] Jared dot Williams1 at ntlworld dot com Description: ------------ A fatal error occurs when a method is called from a trait, which is implemented in the parent class of the class that utilises the trait. Feels related to #55355 that was fixed. Test script: --------------- <?php trait Required { function setRequired() { $this->setAttribute('required', true); return $this; } abstract function setAttribute($name, $value); } class Input { protected $attributes = []; function setAttribute($name, $value) { $this->attributes[$name] = $value; } } class Text extends Input { use Required; } $t = new Text(); $t->setRequired(); Expected result: ---------------- No fatal error. Actual result: -------------- PHP Fatal error: Call to undefined method Text::setAttribute() in /home/jared/Temp/trait2.php on line 7 Fatal error: Call to undefined method Text::setAttribute() in /home/jared/Temp/trait2.php on line 7 ------------------------------------------------------------------------ -- Edit this bug report at https://bugs.php.net/bug.php?id=55424&edit=1