Edit report at https://bugs.php.net/bug.php?id=55355&edit=1

 ID:                 55355
 Updated by:         g...@php.net
 Reported by:        Jared dot Williams1 at ntlworld dot com
 Summary:            Unexpected fatal error when using abstract functions
                     with traits
-Status:             Open
+Status:             Closed
 Type:               Bug
 Package:            Class/Object related
 Operating System:   Ubuntu 11.04
 PHP Version:        5.4SVN-2011-08-03 (SVN)
-Assigned To:        
+Assigned To:        gron
 Block user comment: N
 Private report:     N

 New Comment:

This bug has been fixed in SVN.

Snapshots of the sources are packaged every three hours; this change
will be in the next snapshot. You can grab the snapshot at
http://snaps.php.net/.

 For Windows:

http://windows.php.net/snapshots/
 
Thank you for the report, and for helping us make PHP better.

Thanks, is fixed per http://svn.php.net/viewvc?view=revision&revision=314943


Previous Comments:
------------------------------------------------------------------------
[2011-08-15 11:16:13] g...@php.net

Automatic comment from SVN on behalf of gron
Revision: http://svn.php.net/viewvc/?view=revision&revision=314943
Log: Fixed Bug #55355: Inheritance chain was not regarded when checking whether 
the abstract method of a trait is satisfied.

------------------------------------------------------------------------
[2011-08-03 13:47:55] Jared dot Williams1 at ntlworld dot com

Description:
------------
When resolving trait abstract methods, it seems the class hierarchy is not 
checked, resulting in a fatal error if an abstract method isn't implemented 
directly in the class that is utilising the trait.



Test script:
---------------
<?php

        trait ATrait
        {
                function bar()
                {
                        $this->foo();
                }

                abstract function foo(); 
        }

        class Base
        {
                function foo() { }
        }

        class Child extends Base
        {
                use ATrait;     
        }


Actual result:
--------------
PHP Fatal error:  Cannot make non abstract method Base::foo() abstract in class 
Child in /home/jared/Temp/trait.php on line 21

Fatal error: Cannot make non abstract method Base::foo() abstract in class 
Child 
in /home/jared/Temp/trait.php on line 21



------------------------------------------------------------------------



-- 
Edit this bug report at https://bugs.php.net/bug.php?id=55355&edit=1

Reply via email to