lisachenko / z-engine

:zap: PHP Engine Direct API
MIT License
448 stars 22 forks source link

[Bug] Incorrect scope check for property hooks #32

Closed lisachenko closed 4 years ago

lisachenko commented 4 years ago

After implementation of #31, new issue is appeared: PHP FFI trampoline which is called during hook invocation is changing original scope to another one (FFI) and this is unexpcted for PHP engine. After that constructor in a class with property hooks can not access private or protected members in the same class because of incorrect scope.

To fix this issue, EG(fake_scope) could be used.

lisachenko commented 4 years ago

See comment in #31 for additional details.

lisachenko commented 4 years ago

Example of possible errors: Cannot access private property ZEngine\Stub\TestClass::$secret in ~/z-engine/src/ClassExtension/Hook/ReadPropertyHook.php:104