Bug #73862 [NEW]: Accessing protected property and method of sibling class is inconsistent

From: Date: Wed, 04 Jan 2017 19:05:57 +0000
Subject: Bug #73862 [NEW]: Accessing protected property and method of sibling class is inconsistent
Groups: php.bugs 
Request: Send a blank email to php-bugs+get-206303@lists.php.net to get a copy of this message
From: after89 at gmail dot com Operating system: PHP version: 7.1.0 Package: *General Issues Bug Type: Bug Bug description:Accessing protected property and method of sibling class is inconsistent Description: ------------ Accessing protected property defined in superclass of current context on object that is sibling of current context class (extends one of the base class) is not possible (https://3v4l.org/BODds). Althrough accessing method in the same manner is valid (https://3v4l.org/8DNBa). Both of this behaviours should be consistent. Test script: --------------- <?php class Base { protected $foo = 'Base'; } class Other extends Base { protected $foo = 'Other'; } class Child extends Base { public function bar() { $otherBase = new Other(); echo $otherBase->foo; } } $child = new Child(); $child->bar(); -- Edit bug report at https://bugs.php.net/bug.php?id=73862&edit=1 -- Try a snapshot (PHP 5.4): https://bugs.php.net/fix.php?id=73862&r=trysnapshot54 Try a snapshot (PHP 5.5): https://bugs.php.net/fix.php?id=73862&r=trysnapshot55 Try a snapshot (trunk): https://bugs.php.net/fix.php?id=73862&r=trysnapshottrunk Fixed in SVN: https://bugs.php.net/fix.php?id=73862&r=fixed Fixed in release: https://bugs.php.net/fix.php?id=73862&r=alreadyfixed Need backtrace: https://bugs.php.net/fix.php?id=73862&r=needtrace Need Reproduce Script: https://bugs.php.net/fix.php?id=73862&r=needscript Try newer version: https://bugs.php.net/fix.php?id=73862&r=oldversion Not developer issue: https://bugs.php.net/fix.php?id=73862&r=support Expected behavior: https://bugs.php.net/fix.php?id=73862&r=notwrong Not enough info: https://bugs.php.net/fix.php?id=73862&r=notenoughinfo Submitted twice: https://bugs.php.net/fix.php?id=73862&r=submittedtwice register_globals: https://bugs.php.net/fix.php?id=73862&r=globals PHP 4 support discontinued: https://bugs.php.net/fix.php?id=73862&r=php4 Daylight Savings: https://bugs.php.net/fix.php?id=73862&r=dst IIS Stability: https://bugs.php.net/fix.php?id=73862&r=isapi Install GNU Sed: https://bugs.php.net/fix.php?id=73862&r=gnused Floating point limitations: https://bugs.php.net/fix.php?id=73862&r=float No Zend Extensions: https://bugs.php.net/fix.php?id=73862&r=nozend MySQL Configuration Error: https://bugs.php.net/fix.php?id=73862&r=mysqlcfg

« previous php.bugs (#206303) next »