Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

[Intl] fix Locale::getFallback() throwing exception on long $locale#40162

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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Merged
nicolas-grekas merged 1 commit intosymfony:4.4fromAmirHo3ein13:ticket_39100
Feb 17, 2021

Conversation

@AmirHo3ein13
Copy link
Contributor

@AmirHo3ein13AmirHo3ein13 commentedFeb 12, 2021
edited by stof
Loading

QA
Branch?4.4
Bug fix?yes
New feature?no
Deprecations?no
TicketsFix#39100
LicenseMIT
Doc PR

Locale::getFallback() throws an exception when the$locale length is greater thanINTL_MAX_LOCALE_LEN so I added a condition to check if locale_parse return null, theLocale::getFallback() don't call\count function and just return null instead.

@carsonbot
Copy link

Hey!

I see that this is your first PR. That is great! Welcome!

Symfony has acontribution guide which I suggest you to read.

In short:

  • Always add tests
  • Keep backward compatibility (seehttps://symfony.com/bc).
  • Bug fixes must be submitted against the lowest maintained branch where they apply (seehttps://symfony.com/releases)
  • Features and deprecations must be submitted against the 5.x branch.

Review the GitHub status checks of your pull request and try to solve the reported issues. If some tests are failing, try to see if they are failing because of this change.

When two Symfony core team members approve this change, it will be merged and you will become an official Symfony contributor!
If this PR is merged in a lower version branch, it will be merged up to all maintained branches within a few days.

I am going to sit back now and wait for the reviews.

Cheers!

Carsonbot

@AmirHo3ein13AmirHo3ein13force-pushed theticket_39100 branch 2 times, most recently from8f96c7a toa41a1c7CompareFebruary 12, 2021 11:02
@OskarStark
Copy link
Contributor

Thanks for your contribution, could you please add a testcase to avails a regression in the future?

Also it looks like your commit/email is not associated with your github account 🧐

@OskarStark
Copy link
Contributor

Friendly ping@ro0NL

@AmirHo3ein13
Copy link
ContributorAuthor

Thanks for your contribution, could you please add a testcase to avails a regression in the future?

Also it looks like your commit/email is not associated with your GitHub account

@OskarStark thanks for your review. At first, I added a test case for my change but seems like in CI (appveyor) the\function_exists('locale_parse') returns false and it does not reach my change. As you can see, it is in my first commit, can you help me?

Also thank you for informing me about the email. I'll fix it and commit with the right email.

OskarStark reacted with thumbs up emoji

@AmirHo3ein13
Copy link
ContributorAuthor

@OskarStark@ro0NL seems like there is a problem with Doctrine, you can see ithere. Please check it, thanks in advance.

@xabbuh
Copy link
Member

The Doctrine failure isn't related. We can ignore it here.

Copy link
Member

@nicolas-grekasnicolas-grekas left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

Can you please add a test case?

@AmirHo3ein13
Copy link
ContributorAuthor

Can you please add a test case?

@nicolas-grekas as I wrote here, I have a problem testing my change and I need some help. Can you help me?

Thanks for your contribution, could you please add a testcase to avails a regression in the future?
Also it looks like your commit/email is not associated with your GitHub account

@OskarStark thanks for your review. At first, I added a test case for my change but seems like in CI (appveyor) the\function_exists('locale_parse') returns false and it does not reach my change. Can you help me?

@nicolas-grekas
Copy link
Member

Can you add the test to the PR?
The test case should have the@requires function locale_parse annotation on it.

@AmirHo3ein13
Copy link
ContributorAuthor

Can you add the test to the PR?
The test case should have the@requires function locale_parse annotation on it.

@nicolas-grekas thank you very much. I added the test successfully.

'LC_MONETARY=fr_FR.UTF-8;LC_MESSAGES=fr_FR.UTF-8;LC_PAPER=fr_FR.UTF-8;LC_NAME=fr_FR.UTF-8;'.
'LC_ADDRESS=fr_FR.UTF-8;LC_TELEPHONE=fr_FR.UTF-8;LC_MEASUREMENT=fr_FR.UTF-8;LC_IDENTIFICATION=fr_FR.UTF-8';

$this->assertNull(Locale::getFallback($locale));
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

do we agreeroot is the fallback then?

compared to above test$this->assertSame('root', Locale::getFallback('nl'));

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

actually $defaultFallback /en is expected

Copy link
ContributorAuthor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

@ro0NL the function is returningnull on long $locale by this change:
$localeSubTags = locale_parse($locale) ?? ['language' => $locale];

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

I thinknull is correct also.

Copy link
Contributor

@ro0NLro0NL left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

no strong opinion behavior-wise,null is reasonable

@nicolas-grekas
Copy link
Member

Thank you@AmirHo3ein13.

AmirHo3ein13 reacted with thumbs up emoji

@nicolas-grekasnicolas-grekas merged commit9765b5a intosymfony:4.4Feb 17, 2021
This was referencedMar 4, 2021
Sign up for freeto join this conversation on GitHub. Already have an account?Sign in to comment

Reviewers

@nicolas-grekasnicolas-grekasnicolas-grekas approved these changes

+1 more reviewer

@ro0NLro0NLro0NL approved these changes

Reviewers whose approvals may not affect merge requirements

Assignees

No one assigned

Projects

None yet

Milestone

4.4

Development

Successfully merging this pull request may close these issues.

6 participants

@AmirHo3ein13@carsonbot@OskarStark@xabbuh@nicolas-grekas@ro0NL

[8]ページ先頭

©2009-2025 Movatter.jp