-
-
Notifications
You must be signed in to change notification settings - Fork 2k
New issue
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
Config child class E_NOTICE on non existent element access #1315
Comments
I presume this may has to do with
Because Phalcon\Config class is defined in extension and might be considered internal and my custom defined classes are not. |
Seems like a bug — isset() triggers the same behavior. |
Or maybe not — Internal classes understand PHP's intention to check whether the property exists (PHP passes them a special flag) but there is no way to pass that flag to Here's a quick test case: <?php
error_reporting(E_ALL);
class A
{
private $props = array();
public function __isset($k)
{
echo __METHOD__, "\n";
return isset($this->props[$k]);
}
public function __get($k)
{
echo __METHOD__, "\n";
return $this->props[$k];
}
}
$a = new A;
var_dump(isset($a->b->c));
var_dump(empty($a->b->c)); PHP will complain twice about |
I have implemented a workaround: if This adds one extra call on such |
I didn't understand much about the flag, but thank you very much :) 👍 |
So I was using Phalcon\Config class for following expressions:
And this works without any problems, which is nice. However when I try to do the same with an inherited class - I get notices "Undefined offset".
This code simulates the issue.
Notice is shown only for 2nd empty call. I'm not sure if it's a bug or restriction.
Phalcon version 1.3.0 built from ext.
The text was updated successfully, but these errors were encountered: