-
Notifications
You must be signed in to change notification settings - Fork 711
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
Fix error handler allowUndefinedVars #735
Conversation
@@ -66,7 +66,7 @@ public function deactivate() { | |||
*/ | |||
public function handleError($errno, $errstr, $errfile, $errline, $errcontext = []) | |||
{ | |||
if ($this->allowUndefinedVars && $errstr == 'Attempt to read property "value" on null') { | |||
if ($this->allowUndefinedVars && preg_match('/^Attempt to read property ".+?" on null$/', $errstr)) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I want to use \w
instead of .
, when we need to catch alphanumeric case.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Properties can also include -
and maybe even :
etc, so it uneagerly matches to the first "
. https://3v4l.org/s9KPc
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It makes sense.
This pull request would make it possible to migrate to newer version without a large amount of changes. Could this be merged? |
Does nobody have |
This change seems straightforward. Should be able to merge this. Just to be clear: could you provide an exact issue? I.e. what problem does this solve? |
That would trigger a
I'll fix the merge conflict. |
I propose a slightly different implementation, see #832 |
handleError
only checks for propertyvalue
, which is odd. I'm getting errorBecause
id
is the property being accessed. So it should check for any property name, not justvalue
.