-
Notifications
You must be signed in to change notification settings - Fork 9
[HOTFIX] Rewrote address splitting function to work with bad addresses #352
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
Conversation
| * and additionToAddress2 contain additional information that is given at the start and the end of the string, respectively. | ||
| * Unit tests for testing the regular expression that this function uses exist over at https://regex101.com/r/vO5fY7/1. | ||
| * More information on this functionality can be found at http://blog.viison.com/post/115849166487/shopware-5-from-a-technical-point-of-view#address-splitting. | ||
| * Fatia um endereço em nome da rua, número e complemento |
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.
Comments are only in English :)
| * Fatia um endereço em nome da rua, número e complemento | ||
| * | ||
| * @param string $address | ||
| * @param string $address Endereço a ser fatiado |
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.
Same above.
| \s*\Z/xu'; | ||
|
|
||
| $result = preg_match($regex, $address, $matches); | ||
| public static function split_street($address) { |
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.
Are you really right about this? There is a huge difference between the regexs... Why this?
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 regex was not working when address had no number... a merchant added an address number field to their checkout (using checkout manager) and that broke things as address had no number and regex simply failed...
As it was too complex we rewrote the regex to be simplier and to match with weird addresses anyway.
| } elseif ($result === false) { | ||
| throw new \RuntimeException(sprintf('Error occurred while trying to split address \'%s\'', $address)); | ||
| if ($result === false) { | ||
| throw new \RuntimeException(sprintf('Problemas ao interpretar o endereço: \'%s\'', $address)); |
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.
The string is in pt-br, please, put in en-us.
Bad addresses with missing numbers broke the checkout page.