Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Intl component - missing region #47825

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

Closed
trsteel88 opened this issue Oct 10, 2022 · 7 comments
Closed

Intl component - missing region #47825

trsteel88 opened this issue Oct 10, 2022 · 7 comments

Comments

@trsteel88
Copy link
Contributor

Symfony version(s) affected

6.*

Description

I have a application which was recently upgraded from Symfony 3.4 to 6 and I have noticed that there is a region missing from the Intl component.

The region that I have found was "AC" - https://github.com/symfony/intl/blob/3.4/Resources/data/regions/en.json#L3

Within the application, we have the following method:

public function getCountryName(): ?string
    {
        if (null === $this->country) {
            return null;
        }

        return Countries::getName($this->country);
    }

However, this now throws a Symfony\Component\Intl\Exception\MissingResourceException exception.

The only option for us is to catch this exception and return the code instead:

public function getCountryName(): ?string
    {
        if (null === $this->country) {
            return null;
        }

        try {
            return Countries::getName($this->country);
        } catch (MissingResourceException $e) {
            return $this->country;
        }
    }

It seems odd that this region has disappeared when it still exists here: https://www.iso.org/obp/ui/#iso:code:3166:AC

How to reproduce

echo \Symfony\Component\Intl\Countries::getName('AC');

Possible Solution

Load "AC" and any other missing regions back into the Intl php arrays. Unless this was intentionally removed?

Additional Context

No response

@ro0NL
Copy link
Contributor

ro0NL commented Oct 11, 2022

@ro0NL
Copy link
Contributor

ro0NL commented Oct 11, 2022

Unless this was intentionally removed?

yes. Do you experience it as a bug?

@trsteel88
Copy link
Contributor Author

Well it's causing an error as there is data saved against that code which no longer exists. My thoughts would be that getName should still fallback to the full list when performing a lookup.

@ro0NL
Copy link
Contributor

ro0NL commented Oct 11, 2022

ideally we preserve BC by deprecating removed entries first, but that's a data issue which isnt nessecarily covered by the current BC promise AFAIK 😅

My thoughts would be that getName should still fallback to the full list when performing a lookup.

nope :)

* @throws MissingResourceException if the country code does not exist

so anticipating it seems best

@xabbuh xabbuh added the Intl label Oct 11, 2022
@carsonbot
Copy link

Hey, thanks for your report!
There has not been a lot of activity here for a while. Is this bug still relevant? Have you managed to find a workaround?

@carsonbot
Copy link

Friendly ping? Should this still be open? I will close if I don't hear anything.

@carsonbot
Copy link

Hey,

I didn't hear anything so I'm going to close it. Feel free to comment if this is still relevant, I can always reopen!

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

No branches or pull requests

4 participants