Bug #60165 [Opn->Asn]: Overriding unexisting trait should throw/trigger the exception/error
| From: | felipe@php.net | Date: | Wed, 16 Nov 2011 01:16:56 +0000 |
| Subject: | Bug #60165 [Opn->Asn]: Overriding unexisting trait should throw/trigger the exception/error | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-165210@lists.php.net to get a copy of this message | ||
Edit report at https://bugs.php.net/bug.php?id=60165&edit=1
ID: 60165
Updated by: felipe@php.net
Reported by: fruit dot dev at gmail dot com
Summary: Overriding unexisting trait should throw/trigger the
exception/error
-Status: Open
+Status: Assigned
Type: Bug
-Package: Class/Object related
+Package: Scripting Engine problem
Operating System: Fedora 14
PHP Version: 5.4.0beta2
-Assigned To:
+Assigned To: gron
Block user comment: N
Private report: N
Previous Comments:
------------------------------------------------------------------------
[2011-10-28 21:23:56] fruit dot dev at gmail dot com
Description:
------------
In case, when user overrides invalid traits method, PHP should check whether specified method
belongs to given trait.
The code given below is valid for preprocessing. Meanwhile trait "A" does not have method
"getTitle", as well as trait "B" does contains "getSlug" method.
I guess, PHP should trigger error telling about the user is entangled among the three pines.
Test script:
---------------
trait A
{
public function getSlug ()
{
return $this->slug;
}
}
trait B
{
public function getTitle ()
{
return $this->title;
}
}
class Foo
{
protected $slug, $title;
use A, B
{
A::getTitle as title;
B::getSlug as slug;
}
}
$object = new Foo();
Expected result:
----------------
Error/exception should be triggered/thrown
Actual result:
--------------
silence (no errors was shown)
------------------------------------------------------------------------
--
Edit this bug report at https://bugs.php.net/bug.php?id=60165&edit=1