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

 ID:                 55524
 Updated by:         g...@php.net
 Reported by:        g...@php.net
 Summary:            Traits should not be able to extend a class
-Status:             Assigned
+Status:             Closed
 Type:               Bug
 Package:            Scripting Engine problem
 PHP Version:        5.4.0alpha3
 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.

Fixed per svn rev 315712.


Previous Comments:
------------------------------------------------------------------------
[2011-08-29 15:53:36] g...@php.net

Automatic comment from SVN on behalf of gron
Revision: http://svn.php.net/viewvc/?view=revision&revision=315712
Log: Fixed bug #55524 Traits should not be able to extend a class
# also used the Z_STRVAL where it seemed appropriate

------------------------------------------------------------------------
[2011-08-29 08:25:00] good821 at 126 dot com

http://www.officialpackersjerseyshop.com/green-bay-packers-jerseys-paul-hornung-jersey-c-11_25.html
     Paul Hornung Jersey
http://www.officialpackersjerseyshop.com/green-bay-packers-jerseys-ray-nitschke-jersey-c-11_27.html
     Ray Nitschke Jersey
http://www.officialpackersjerseyshop.com/green-bay-packers-jerseys-reggie-white-jersey-c-11_24.html
     Reggie White Jersey

------------------------------------------------------------------------
[2011-08-29 05:13:33] g...@php.net

Checking for interface is already done. As well as checking that classes do not 
extend traits. I only missed checking that traits do not extend classes, as far 
as 
I can tell. Plan to fix it later this week.

------------------------------------------------------------------------
[2011-08-29 01:03:01] ka...@php.net

Might also be worth checking the implements keyword if a user tries to 
implement an interface (or multiple)

------------------------------------------------------------------------
[2011-08-28 08:05:04] g...@php.net

Description:
------------
Spotted by this post: http://zuttonet.com/articles/php-class-traits/

Traits build their own hierarchy of uses, but there is no useful semantics for 
extending classes.

For instance:


trait Foo extends Base {
    function bar() {}
}


The semantics for that is not defined (and actually at least broken for 
abstract 
methods).


This should give a fatal error as would the other way around (Base extends Foo).


Test script:
---------------
trait Foo extends Base {
    function bar() {}
}

Expected result:
----------------
Fatal error: A trait (Foo) cannot extend a class (Base) in %s on line %d



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



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

Reply via email to