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
The implementation of RegionDataGenerator has different standards for different data sets from ICU's data import. This results in inconsistent lists between
Regions
Alpha2ToAlpha3
Alpha3ToAlpha2
NumericToAlpha2
Regions
This is the first of the data sets to be pulled from ICU, it is in the end a translated list of Alpha2 country codes from localeBundle['Countries']. This is quiet good and does filter out certain code in the components's DENYLIST.
Alpha2ToAlpha3
This is the next data set that is pulled from ICU (via $metadataBundle['alias']['territory']) but filtered against Regions from above.
Alpha3ToAlpha2
The next data set. It is a simple array flip of Alpha3ToAlpha2, which makes it also filtered against Regions.
NumericToAlpha2
The last data set that is directly pulled from ICU (via $metadataBundle['alias']['territory']) but this time not filtered against Regions. This is turns makes it so that when using Countries and interacting with numeric lists, the following extra codes are available for usage (but not in the other 3 data sets):
Alpha‐2
CLDR Numeric
Status
Meaning/Use
AA
958
Unknown/Invalid
Fallback when a region tag is not recognized.
QM
959
Reserved
No real country; left for implementers’ own assignments.
QN
960
Reserved
—
QP
962
Reserved
—
QQ
963
Reserved
—
QR
964
Reserved
—
QS
965
Reserved
—
QT
966
Reserved
—
QV
968
Reserved
—
QW
969
Reserved
—
QX
970
Reserved
—
QY
971
Reserved
—
QZ
972
Reserved
—
XC
975
Private-Use
User-assigned or testing‐only region codes.
XD
976
Private-Use
—
XE
977
Private-Use
—
XF
978
Private-Use
—
XG
979
Private-Use
—
XH
980
Private-Use
—
XI
981
Private-Use
—
XJ
982
Private-Use
—
XL
984
Private-Use
—
XM
985
Private-Use
—
XN
986
Private-Use
—
XO
987
Private-Use
—
XP
988
Private-Use
—
XQ
989
Private-Use
—
XR
990
Private-Use
—
XS
991
Private-Use
—
XT
992
Private-Use
—
XU
993
Private-Use
—
XV
994
Private-Use
—
XW
995
Private-Use
—
XX
996
Private-Use
—
XY
997
Private-Use
—
XZ
998
Private-Use
—
How to reproduce
Install the Intl component and simply dump the following data:
var_dump(Countries::getNumericCodes());
Possible Solution
The solution is to change the signature of the private function generateAlpha2ToNumericMapping so it is in line with the other functions that filter "territories" data against Regions (see above).
class RegionDataGenerator extends AbstractDataGenerator
{
// ...privatefunctiongenerateAlpha2ToNumericMapping(array$countries, ArrayAccessibleResourceBundle$metadataBundle): array
{
// now check against countries and ignore codes reserved for the future or for private use
}
}
My main question is if this is considered a BC break or not? I have the code to "fix" this ready, but I am not sure if it should go to Symfony 6.4, 7.4 or even 8.0?
Additional Context
No response
The text was updated successfully, but these errors were encountered:
…odes (llupa)
This PR was merged into the 6.4 branch.
Discussion
----------
[Intl] Ensure data consistency between alpha and numeric codes
| Q | A
| ------------- | ---
| Branch? | 6.4
| Bug fix? | yes
| New feature? | no
| Deprecations? | no
| Issues | Fix#60696
| License | MIT
Commits
-------
7d67017 [Intl] Ensure data consistency between alpha and numeric codes
Uh oh!
There was an error while loading. Please reload this page.
Symfony version(s) affected
6.4
Description
The implementation of
RegionDataGenerator
has different standards for different data sets from ICU's data import. This results in inconsistent lists betweenRegions
This is the first of the data sets to be pulled from ICU, it is in the end a translated list of Alpha2 country codes from
localeBundle['Countries']
. This is quiet good and does filter out certain code in the components's DENYLIST.Alpha2ToAlpha3
This is the next data set that is pulled from ICU (via $metadataBundle['alias']['territory']) but filtered against
Regions
from above.Alpha3ToAlpha2
The next data set. It is a simple array flip of
Alpha3ToAlpha2
, which makes it also filtered againstRegions
.NumericToAlpha2
The last data set that is directly pulled from ICU (via $metadataBundle['alias']['territory']) but this time not filtered against
Regions
. This is turns makes it so that when usingCountries
and interacting with numeric lists, the following extra codes are available for usage (but not in the other 3 data sets):How to reproduce
Install the Intl component and simply dump the following data:
Possible Solution
The solution is to change the signature of the private function
generateAlpha2ToNumericMapping
so it is in line with the other functions that filter "territories" data againstRegions
(see above).becomes
My main question is if this is considered a BC break or not? I have the code to "fix" this ready, but I am not sure if it should go to Symfony 6.4, 7.4 or even 8.0?
Additional Context
No response
The text was updated successfully, but these errors were encountered: