Skip to content
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

[Intl] getAlpha3Code() OutOfBoundsException for Norwegian #36145

Closed
kiler129 opened this issue Mar 20, 2020 · 4 comments
Closed

[Intl] getAlpha3Code() OutOfBoundsException for Norwegian #36145

kiler129 opened this issue Mar 20, 2020 · 4 comments

Comments

@kiler129
Copy link
Contributor

kiler129 commented Mar 20, 2020

Symfony version(s) affected: 5.0.5

Description
Both Languages::exists('no') and Languages::getName('no') produce expected results, while Languages::getAlpha3Code('no') crashes.

How to reproduce

  1. composer req symfony/intl
  2. Run the following code (tested under PHP 7.4.3):
<?php
declare(strict_types=1);

use Symfony\Component\Intl\Languages;
require_once __DIR__ . '/vendor/autoload.php';

var_dump(
    Languages::exists('no'), //by itself: bool(true)
    Languages::getName('no'), //by itself: string(9) "Norwegian"
    Languages::getAlpha3Code('no')
);

The code will produce:

PHP Fatal error:  Uncaught Symfony\Component\Intl\Exception\OutOfBoundsException: The index no does not exist. in /Users/kiler129/vendor/symfony/intl/Data/Util/RecursiveArrayAccess.php:39
Stack trace:
#0 /Users/kiler129/vendor/symfony/intl/Data/Bundle/Reader/BundleEntryReader.php(89): Symfony\Component\Intl\Data\Util\RecursiveArrayAccess::get(Array, Array)
#1 /Users/kiler129/vendor/symfony/intl/ResourceBundle.php(58): Symfony\Component\Intl\Data\Bundle\Reader\BundleEntryReader->readEntry('/Users/kiler129/...', 'meta', Array, true)
#2 /Users/kiler129/vendor/symfony/intl/Languages.php(93): Symfony\Component\Intl\ResourceBundle::readEntry(Array, 'meta')
#3 /Users/kiler129/test.php(11): Symfony\Component\Intl\Languages::getAlpha3Code('no')
#4 {main}

Next Symfony\Component\Intl\Exception\MissingResourceException: Couldn't read the indices [Alpha2ToAlpha3][no] for the locale "meta" in "/Users/kiler129/... in /Users/kiler129/vendor/symfony/intl/Data/Bundle/Reader/BundleEntryReader.php on line 175

Fatal error: Uncaught Symfony\Component\Intl\Exception\OutOfBoundsException: The index no does not exist. in /Users/kiler129/vendor/symfony/intl/Data/Util/RecursiveArrayAccess.php:39
Stack trace:
#0 /Users/kiler129/vendor/symfony/intl/Data/Bundle/Reader/BundleEntryReader.php(89): Symfony\Component\Intl\Data\Util\RecursiveArrayAccess::get(Array, Array)
#1 /Users/kiler129/vendor/symfony/intl/ResourceBundle.php(58): Symfony\Component\Intl\Data\Bundle\Reader\BundleEntryReader->readEntry('/Users/kiler129/...', 'meta', Array, true)
#2 /Users/kiler129/vendor/symfony/intl/Languages.php(93): Symfony\Component\Intl\ResourceBundle::readEntry(Array, 'meta')
#3 /Users/kiler129/test.php(11): Symfony\Component\Intl\Languages::getAlpha3Code('no')
#4 {main}

Next Symfony\Component\Intl\Exception\MissingResourceException: Couldn't read the indices [Alpha2ToAlpha3][no] for the locale "meta" in "/Users/kiler129/... in /Users/kiler129/vendor/symfony/intl/Data/Bundle/Reader/BundleEntryReader.php on line 175
@ro0NL
Copy link
Contributor

ro0NL commented Mar 20, 2020

See also #33165 :) not sure what to do yet.

@xabbuh xabbuh added the Intl label Mar 21, 2020
@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 reminder that this issue exists. If I don't hear anything I'll close this.

@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