Bug #78455 [Opn->Fbk]: Access violation of private trait members
| From: | requinix@php.net | Date: | Sat, 24 Aug 2019 23:20:25 +0000 |
| Subject: | Bug #78455 [Opn->Fbk]: Access violation of private trait members | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-222397@lists.php.net to get a copy of this message | ||
Edit report at https://bugs.php.net/bug.php?id=78455&edit=1
ID: 78455
Updated by: requinix@php.net
Reported by: developmenthero at gmail dot com
Summary: Access violation of private trait members
-Status: Open
+Status: Feedback
Type: Bug
-Package: PHP Language Specification
+Package: Scripting Engine problem
Operating System: Windows 10
PHP Version: 7.3.8
Block user comment: N
Private report: N
New Comment:
Thank you for this bug report. To properly diagnose the problem, we
need a short but complete example script to be able to reproduce
this bug ourselves.
A proper reproducing script starts with <?php and ends with ?>,
is max. 10-20 lines long and does not require any external
resources such as databases, etc. If the script requires a
database to demonstrate the issue, please make sure it creates
all necessary tables, stored procedures etc.
Please avoid embedding huge scripts into the report.
> Prior to v7.3, "A::__set()" would be triggered here.
Nope. https://3v4l.org/5XSGH
Previous Comments:
------------------------------------------------------------------------
[2019-08-24 23:17:14] developmenthero at gmail dot com
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 this bug report at https://bugs.php.net/bug.php?id=78455&edit=1