You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Postal Code Formula is not validated on save, causing SyntaxError in dev and Internal server error in prod when opening any order in admin panel.
Steps to reproduce
Create a shipping zone and add an Postal Code Formula to Address Condition, enter smth like this postalCode >= '00100' and postalCode <= '03149'), notice the missing opening bracket, save it
Now go to Commerce -> Orders and open any order
You will get an Unexpected ")" in "Postal code formula matching address exception
Expected behavior
Validate formula on save, preventing incorrect value to be saved
Actual behavior
In production you get a Internal server error in dev you get an exception
Craft CMS version
5.6.11
Craft Commerce version
5.3.5
PHP version
No response
Operating system and version
No response
Database type and version
No response
Image driver and version
No response
Installed plugins and versions
The text was updated successfully, but these errors were encountered:
@stanislavprokopov thanks for reporting this. Unfortunately the condition builder does not have a way to validate the condition syntax, but I have gone ahead and ensured that no PHP error is raised when evaluating the bad condition in this PR: #3949
This will mean the condition will return false if it has any syntax errors, and will silently log the error with the bad formula.
I will update this ticket once the PR is included in the next release. Thanks!
What happened?
Description
Postal Code Formula
is not validated on save, causingSyntaxError
in dev andInternal server error
in prod when opening any order in admin panel.Steps to reproduce
Postal Code Formula
toAddress Condition
, enter smth like thispostalCode >= '00100' and postalCode <= '03149')
, notice the missing opening bracket, save itUnexpected ")" in "Postal code formula matching address
exceptionExpected behavior
Validate formula on save, preventing incorrect value to be saved
Actual behavior
In production you get a Internal server error in dev you get an exception
Craft CMS version
5.6.11
Craft Commerce version
5.3.5
PHP version
No response
Operating system and version
No response
Database type and version
No response
Image driver and version
No response
Installed plugins and versions
The text was updated successfully, but these errors were encountered: