Skip to content

Conversation

oldpec
Copy link

@oldpec oldpec commented Dec 9, 2020

Numeric codes are numeric characters, but not ints, leading zeroes matter.
Without this change both:

$isoCodes = new IsoCodesFactory();
$country = $countries->getByNumericCode('036');

and

$isoCodes = new IsoCodesFactory();
$country = $countries->getByNumericCode(36);

fail, because the map generated by \Sokil\IsoCodes\AbstractNotPartitionedDatabase::getIndex() has string array keys like '036' which doesn't match for numeric codes with leading zeroes that has been cast to an int

@sokil sokil merged commit 8fba356 into sokil:3.0 Dec 9, 2020
@sokil
Copy link
Owner

sokil commented Dec 12, 2020

fixed in 3.1.0

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants