Recently, I have been working on some form validations and wanted to use the PhoneNumber validator class in my input filter.I realized that It would be awesome if we could set the country in a case-insensitive way :)
I've recently been working on some form validations and wanted to use the PhoneNumber validator class in my input filter and realized it would be awesome if we could set the country case-insensitive :)
Please supply an updated test for this behavior.
Added unit test for PR #5892
@mwillbanks I went ahead and added a test while merging.
@EvanDotPro thank you sir.
There is a side effect here... When you use this validator with the name of the parameter and not the value itself, it doesn't work !
'country' => 'country_id',
'allowed_types' => array('general')
country is set to : COUNTRY_ID and the value is no more found in the $context array
So, if you want that the country value is case-insensitive, a solution is to call strtoupper function in the loadPattern function :
protected function loadPattern($code)
$code = strtoupper($code);
Added unit test for PR zendframework/zendframework#5892