-
Notifications
You must be signed in to change notification settings - Fork 93
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
[BUGFIX] Fix math expression error verbosity #396
base: main
Are you sure you want to change the base?
Conversation
8c8af47
to
73d8cf2
Compare
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.
Looks OK from reading but we should really add tests for this.
73d8cf2
to
99ca678
Compare
Now with 100% code coverage. |
In case you didn't notice... this actually sneaks in neat ability: <f:render partial="MyPartial" arguments="{_all + another}" /> Doesn't allow you to define the array inside the expression, only works on variables - but works. |
I did notice and I think this should be done as a separate change to give it the spotlight it deserves. ;-) |
Something to consider: should we allow left/right side to be |
I hesitate to do this array union as a separate change exactly because it won't allow the array to be built directly in the expression. It's also not as easily done with another expression node type. It would be far easier to handle if that lexer I'm working on was a reality. If/when we do that, I expect it will instead look a bit like |
With separate change I mean separate PR with exactly the same code as here, not some kind of different syntax or so. |
Yes, I understood that, but I'd argue that this isn't a feature or a separate bugfix - it still falls into the category of this same error prevention (by guarding against arrays being divided, for example). You could still do this before, you'd just receive some nasty errors in pretty much all contexts if you didn't do it 100% correctly. Now you don't :) |
Prevents seeing the “non-numeric value encountered” error from PHP when a template attempts to do math on a variable that is not declared, or does not have the right type. See code comments for exact behavior. The intention is to match PHP type coercion as close as possible - among other things by inferring NULL as value when a variable is most likely not defined.
99ca678
to
dc99f18
Compare
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.
That it is finally fixed.
Prevents seeing the “non-numeric value encountered”
error from PHP when a template attempts to do math
on a variable that is not declared, or does not have the
right type. See code comments for exact behavior.
The intention is to match PHP type coercion as close
as possible - among other things by inferring NULL as
value when a variable is most likely not defined.