- Issue created by @chrisolof
- Status changed to Needs review
7 months ago 9:11pm 24 May 2024 - Open on Drupal.org βCore: 10.2.1 + Environment: PHP 8.1 & MySQL 8last update
7 months ago Waiting for branch to pass - πΊπΈUnited States chrisolof
The attached patch resolves the issue in the affected environments.
I've made three changes in here:
1. Switch the extension sub-field type from text to numeric.
2. Remove the custom numeric extension validation code in Drupal\phone_number\Element\PhoneNumber::phoneNumberValidate() that is no longer needed.
3. Ensure the array key "extension" is actually set before trying to access its value in Drupal\phone_number\Element\PhoneNumber::phoneNumberValidate().I suspect the third change is most responsible for eliminating the error here, and the patch could certainly be reduced to just that change. However while examining the validation of our extension sub-field it felt like a good opportunity to correct its field type and reduce our element's validation code a little bit. It could be this validation area was written before core had a numeric field type, or perhaps the original author was unaware of it. At any rate, this also enables client-side validation of the extension field, which is nice and something we've never had.
- First commit to issue fork.
- Merge request !26Undefined array key "extension" in /src/Element/PhoneNumber.php on line 237 β (Merged) created by vaish
- Status changed to Fixed
5 months ago 7:31pm 18 July 2024 Automatically closed - issue fixed for 2 weeks with no activity.