Bug #69467 [NEW]: Wrong checked for the interface by using Trait

From: Date: Thu, 16 Apr 2015 08:42:19 +0000
Subject: Bug #69467 [NEW]: Wrong checked for the interface by using Trait
Groups: php.bugs 
Request: Send a blank email to php-bugs+get-192124@lists.php.net to get a copy of this message
From: zeli dot box at gmail dot com Operating system: PHP version: 5.4.39 Package: Class/Object related Bug Type: Bug Bug description:Wrong checked for the interface by using Trait Description: ------------ Create an interface in the class: 1. Adding trait to the class 2. Implement interface methods in the trait, but making them private/protected 3. Create class object 4. Checking the object for the instance of interface returns true This bug in php version > 5.4.10 But versions less than 5.4.10 was a fatal error: "Fatal error: Access level to Foo::bad() must be public (as in class Baz)" Test script: --------------- interface Baz { public function bad(); } trait Bar{ protected function bad(){} } class Foo implements Baz{ use Bar; } $test = new Foo(); var_dump($test instanceof Baz); Expected result: ---------------- Fatal error Actual result: -------------- bool(true) -- Edit bug report at https://bugs.php.net/bug.php?id=69467&edit=1 -- Try a snapshot (PHP 5.4): https://bugs.php.net/fix.php?id=69467&r=trysnapshot54 Try a snapshot (PHP 5.5): https://bugs.php.net/fix.php?id=69467&r=trysnapshot55 Try a snapshot (trunk): https://bugs.php.net/fix.php?id=69467&r=trysnapshottrunk Fixed in SVN: https://bugs.php.net/fix.php?id=69467&r=fixed Fixed in release: https://bugs.php.net/fix.php?id=69467&r=alreadyfixed Need backtrace: https://bugs.php.net/fix.php?id=69467&r=needtrace Need Reproduce Script: https://bugs.php.net/fix.php?id=69467&r=needscript Try newer version: https://bugs.php.net/fix.php?id=69467&r=oldversion Not developer issue: https://bugs.php.net/fix.php?id=69467&r=support Expected behavior: https://bugs.php.net/fix.php?id=69467&r=notwrong Not enough info: https://bugs.php.net/fix.php?id=69467&r=notenoughinfo Submitted twice: https://bugs.php.net/fix.php?id=69467&r=submittedtwice register_globals: https://bugs.php.net/fix.php?id=69467&r=globals PHP 4 support discontinued: https://bugs.php.net/fix.php?id=69467&r=php4 Daylight Savings: https://bugs.php.net/fix.php?id=69467&r=dst IIS Stability: https://bugs.php.net/fix.php?id=69467&r=isapi Install GNU Sed: https://bugs.php.net/fix.php?id=69467&r=gnused Floating point limitations: https://bugs.php.net/fix.php?id=69467&r=float No Zend Extensions: https://bugs.php.net/fix.php?id=69467&r=nozend MySQL Configuration Error: https://bugs.php.net/fix.php?id=69467&r=mysqlcfg

« previous php.bugs (#192124) next »