[PHP-BUG] Bug #78455 [NEW]: Access violation of private trait members
[email protected] ("developmenthero at gmail dot com") Sat, 24 Aug 2019 23:17:14 +0000
| Newsgroups | php.standards |
|---|---|
| Message-ID | <[email protected]> |
From: developmenthero at gmail dot com
Operating system: Windows 10
PHP version: 7.3.8
Package: PHP Language Specification
Bug Type: Bug
Bug description:Access violation of private trait members
Description:
------------
Private members of traits are (at least) since v7.3.7 accessible from
within "using" classes now.
Unfortunately this broke triggering __get() and __set() methods within
traits.
Test script:
---------------
trait A {
private $value = 1;
public function getValue() {
return $this->value;
}
public function __set($name, $val) {
var_dump($name, $val);
}
}
class B {
use A;
public function setValue($value) {
// Prior to v7.3, "A::__set()" would be triggered here.
$this->value = $value;
}
}
$B = new B();
var_dump($B->getValue());
$B->setValue(12);
var_dump($B->getValue());
--
Edit bug report at https://bugs.php.net/bug.php?id=78455&edit=1
--
Fix committed: https://bugs.php.net/fix.php?id=78455&r=fixed
Fixed in release: https://bugs.php.net/fix.php?id=78455&r=alreadyfixed
Need backtrace: https://bugs.php.net/fix.php?id=78455&r=needtrace
Need Reproduce Script: https://bugs.php.net/fix.php?id=78455&r=needscript
Try newer version: https://bugs.php.net/fix.php?id=78455&r=oldversion
Not developer issue: https://bugs.php.net/fix.php?id=78455&r=support
Expected behavior: https://bugs.php.net/fix.php?id=78455&r=notwrong
Not enough info: https://bugs.php.net/fix.php?id=78455&r=notenoughinfo
Submitted twice: https://bugs.php.net/fix.php?id=78455&r=submittedtwice
register_globals: https://bugs.php.net/fix.php?id=78455&r=globals
PHP version support discontinued: https://bugs.php.net/fix.php?id=78455&r=phptooold
Daylight Savings: https://bugs.php.net/fix.php?id=78455&r=dst
IIS Stability: https://bugs.php.net/fix.php?id=78455&r=isapi
Install GNU Sed: https://bugs.php.net/fix.php?id=78455&r=gnused
Floating point limitations: https://bugs.php.net/fix.php?id=78455&r=float
No Zend Extensions: https://bugs.php.net/fix.php?id=78455&r=nozend
MySQL Configuration Error: https://bugs.php.net/fix.php?id=78455&r=mysqlcfg