RFC - ReflectionProperty calls __get methods
| From: | Bartłomiej Krukowski | Date: | Wed, 19 Jul 2017 07:53:41 +0000 |
| Subject: | RFC - ReflectionProperty calls __get methods | ||
| Groups: | php.internals | ||
| Request: | Send a blank email to internals+get-99929@lists.php.net to get a copy of this message | ||
Hello,
Class *ReflectionProperty* allows to get access to private properties in
library. Unfortunately there is one unexpected (or at least undocumented)
case - *ReflectionProperty* tries execute *__call* method. In my opinion
this approach is bad, because method *__call* can change state of
application (I'd like to read value, not execute code). I'd like to suggest
different approach:
- Method *ReflectionProperty->getValue* will throw exception when
property is removed.
- Class *ReflectionProperty* will receive new method - *exists*.
Code - http://ideone.com/A23YKF
Best regards