We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Hey,
If a class - written in Zephir - contains private variables and extended in PHP, it won't be able to access those variables in its original methods.
I ran into this when I was trying to extend \Phalcon\Session\Manager and \Phalcon\Session\Bag in v4.0.0-alpha.4
\Phalcon\Session\Manager
\Phalcon\Session\Bag
Code to reproduce the issue:
/** Example.zep **/ class Example { private privateVariable; public function setPrivateVariable(value) { let this->privateVariable = value; return this; } public function getPrivateVariable() { return this->privateVariable; } }
In PHP it is extended without any new methods:
/** My/Example.php **/ namespace My; class Example extends \Example {}
Test code:
$example = new \My\Example; $example->setPrivateVariable('test'); var_dump($example->getPrivateVariable());
Result:
Notice: Undefined property: My\Example::$privateVariable
Changing private variables to protected solved the errors.
private
protected
Zephir version: 0.11.12 PHP: 7.3.4 or 7.2.16 (tried both)
Thanks
The text was updated successfully, but these errors were encountered:
Thank you for the report. We'll try to sort out ASAP.
Sorry, something went wrong.
df9c16e
Fix zephir-lang#1851 (zephir-lang#1862)
81b7f45
* Fix zephir-lang#1851 * Generate c code * Updated * Update FcallTest.php
No branches or pull requests
Hey,
If a class - written in Zephir - contains private variables and extended in PHP, it won't be able to access those variables in its original methods.
I ran into this when I was trying to extend
\Phalcon\Session\Manager
and\Phalcon\Session\Bag
in v4.0.0-alpha.4Code to reproduce the issue:
In PHP it is extended without any new methods:
Test code:
Result:
Notice: Undefined property: My\Example::$privateVariable
Changing
private
variables toprotected
solved the errors.Zephir version: 0.11.12
PHP: 7.3.4 or 7.2.16 (tried both)
Thanks
The text was updated successfully, but these errors were encountered: