Bug #77294 [NEW]: Abstract trait method implementation
| From: | chasepeeler at gmail dot com | Date: | Thu, 13 Dec 2018 16:04:22 +0000 |
| Subject: | Bug #77294 [NEW]: Abstract trait method implementation | ||
| Groups: | php.bugs | ||
| Request: | Send a blank email to php-bugs+get-218433@lists.php.net to get a copy of this message | ||
From: chasepeeler at gmail dot com
Operating system: Windows
PHP version: 7.0.33
Package: Class/Object related
Bug Type: Bug
Bug description:Abstract trait method implementation
Description:
------------
If a child class uses a trait with an abstract method, while it's parent
class uses a trait with a defined method of the same name, the method
from the parent classes trait will act as the implementation of the
abstract method.
The issue also exists in cases where a class uses two traits. One trait
contains an abstract method while the other trait contains a defined
method of the same name. When executed, the defined method will act as
the implementation of the abstract method.
I don't know if this is a bug or an undocumented feature. If it isn't a
bug, then it breaks the "compiler assisted copy/paste rule" since
copy/pasting the traits into the classes would cause an error. It also
appears to violate the documented behavior in relation to conflict
resolution:
http://php.net/manual/en/language.oop5.traits.php#language.oop5.traits.conflict.
If it isn't a bug, then the documentation needs to be updated to better
explain this situation.
Test script:
---------------
https://3v4l.org/OKoTY
--
Edit bug report at https://bugs.php.net/bug.php?id=77294&edit=1
--
Try a snapshot (PHP 5.4): https://bugs.php.net/fix.php?id=77294&r=trysnapshot54
Try a snapshot (PHP 5.5): https://bugs.php.net/fix.php?id=77294&r=trysnapshot55
Try a snapshot (trunk): https://bugs.php.net/fix.php?id=77294&r=trysnapshottrunk
Fixed in SVN: https://bugs.php.net/fix.php?id=77294&r=fixed
Fixed in release: https://bugs.php.net/fix.php?id=77294&r=alreadyfixed
Need backtrace: https://bugs.php.net/fix.php?id=77294&r=needtrace
Need Reproduce Script: https://bugs.php.net/fix.php?id=77294&r=needscript
Try newer version: https://bugs.php.net/fix.php?id=77294&r=oldversion
Not developer issue: https://bugs.php.net/fix.php?id=77294&r=support
Expected behavior: https://bugs.php.net/fix.php?id=77294&r=notwrong
Not enough info: https://bugs.php.net/fix.php?id=77294&r=notenoughinfo
Submitted twice: https://bugs.php.net/fix.php?id=77294&r=submittedtwice
register_globals: https://bugs.php.net/fix.php?id=77294&r=globals
PHP 4 support discontinued: https://bugs.php.net/fix.php?id=77294&r=php4
Daylight Savings: https://bugs.php.net/fix.php?id=77294&r=dst
IIS Stability: https://bugs.php.net/fix.php?id=77294&r=isapi
Install GNU Sed: https://bugs.php.net/fix.php?id=77294&r=gnused
Floating point limitations: https://bugs.php.net/fix.php?id=77294&r=float
No Zend Extensions: https://bugs.php.net/fix.php?id=77294&r=nozend
MySQL Configuration Error: https://bugs.php.net/fix.php?id=77294&r=mysqlcfg