Bug #69766 [NEW]: protected property can be accesed from another class that has the same parent

From: Date: Sat, 06 Jun 2015 17:26:48 +0000
Subject: Bug #69766 [NEW]: protected property can be accesed from another class that has the same parent
Groups: php.bugs 
Request: Send a blank email to php-bugs+get-193175@lists.php.net to get a copy of this message
From: tornike dot comaia dot mail at gmail dot com Operating system: Any PHP version: 5.5.26RC1 Package: Scripting Engine problem Bug Type: Bug Bug description:protected property can be accesed from another class that has the same parent Description: ------------ It is possible to access the protected property of class A within the class B if both classes have the same parent - C, that defined the property unless the property is overriden in child class A or B Test script: --------------- <?php class C { protected $data; } class A extends C { } class B extends C { public function test() { $obj = new A(); $obj->data = 'Hello world'; echo $obj->data; } } ?> Expected result: ---------------- Unless the class B is not the child of the class A, an error must be risen when trying to access the protected property of the class A within class B -- Edit bug report at https://bugs.php.net/bug.php?id=69766&edit=1 -- Try a snapshot (PHP 5.4): https://bugs.php.net/fix.php?id=69766&r=trysnapshot54 Try a snapshot (PHP 5.5): https://bugs.php.net/fix.php?id=69766&r=trysnapshot55 Try a snapshot (trunk): https://bugs.php.net/fix.php?id=69766&r=trysnapshottrunk Fixed in SVN: https://bugs.php.net/fix.php?id=69766&r=fixed Fixed in release: https://bugs.php.net/fix.php?id=69766&r=alreadyfixed Need backtrace: https://bugs.php.net/fix.php?id=69766&r=needtrace Need Reproduce Script: https://bugs.php.net/fix.php?id=69766&r=needscript Try newer version: https://bugs.php.net/fix.php?id=69766&r=oldversion Not developer issue: https://bugs.php.net/fix.php?id=69766&r=support Expected behavior: https://bugs.php.net/fix.php?id=69766&r=notwrong Not enough info: https://bugs.php.net/fix.php?id=69766&r=notenoughinfo Submitted twice: https://bugs.php.net/fix.php?id=69766&r=submittedtwice register_globals: https://bugs.php.net/fix.php?id=69766&r=globals PHP 4 support discontinued: https://bugs.php.net/fix.php?id=69766&r=php4 Daylight Savings: https://bugs.php.net/fix.php?id=69766&r=dst IIS Stability: https://bugs.php.net/fix.php?id=69766&r=isapi Install GNU Sed: https://bugs.php.net/fix.php?id=69766&r=gnused Floating point limitations: https://bugs.php.net/fix.php?id=69766&r=float No Zend Extensions: https://bugs.php.net/fix.php?id=69766&r=nozend MySQL Configuration Error: https://bugs.php.net/fix.php?id=69766&r=mysqlcfg

« previous php.bugs (#193175) next »