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

[Validator] Check the BIC country with symfony/intl#28473

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:masterfromsylfabre:issue_28167
Sep 20, 2018

Conversation

@sylfabre
Copy link
Contributor

@sylfabresylfabre commentedSep 15, 2018
edited by nicolas-grekas
Loading

QA
Branch?master
Bug fix?no
New feature?yes
BC breaks?no
Deprecations?no
Tests pass?yes
Fixed tickets#28167
LicenseMIT
Doc PRN/A

Check the BIC country code against the list from Intl component instead of a simple check alphabetical test.

This PR uses the Intl component which is not part of the required dependencies of the Validator component (https://github.com/symfony/validator/blob/master/composer.json):symfony/intl is only required for dev. So I'm making a PR against master because it may break existing code.
ButCountryValidator does the same so it may not be an issue after all.

@sylfabresylfabre changed the base branch frommaster to4.1September 15, 2018 09:34
@sylfabresylfabre changed the base branch from4.1 tomasterSeptember 15, 2018 09:35

// next 2 letters must be alphabetic (country code)
if (!ctype_alpha(substr($canonicalize,4,2))) {
$countries = Intl::getRegionBundle()->getCountryNames();
Copy link
Member

Choose a reason for hiding this comment

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

symfony/intl is not an hard dependency for the validator, we need to check if it is installed before using it

Copy link
ContributorAuthor

Choose a reason for hiding this comment

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

@chalasr should it be checked forCountryValidator too?

Or should we check againstIbanValidator::$formats making it public?

Copy link
Member

Choose a reason for hiding this comment

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

#28513 does it for other validators, let's do the same here

Copy link
ContributorAuthor

Choose a reason for hiding this comment

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

@chalasr right

@chalasrchalasr added this to the2.8 milestoneSep 15, 2018
@nicolas-grekas
Copy link
Member

nicolas-grekas commentedSep 19, 2018
edited
Loading

Could you please enhance your commit+PR title? This is a requirement for us to generate proper changelogs. Thanks for your help keeping high quality standards.

@sylfabresylfabreforce-pushed theissue_28167 branch 2 times, most recently fromc5b174d to207ace5CompareSeptember 19, 2018 15:27
@sylfabresylfabre changed the titleFix #28167[Validator] Check the BIC country with symfony/intl Fix #28167Sep 19, 2018
// next 2 letters must be alphabetic (country code)
if (!ctype_alpha(substr($canonicalize,4,2))) {
if (!class_exists(Intl::class)) {
thrownewRuntimeException('The "symfony/intl" component is required to use the Bic constraint.');
Copy link
Member

Choose a reason for hiding this comment

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

should be aLogicException as it involves to fix your code by adding the missing dependency (discussion currently happening in#28513)

@nicolas-grekasnicolas-grekas changed the title[Validator] Check the BIC country with symfony/intl Fix #28167[Validator] Check the BIC country with symfony/intlSep 20, 2018
@nicolas-grekas
Copy link
Member

Thank you@sylfabre.

@nicolas-grekasnicolas-grekas merged commit27bd3a8 intosymfony:masterSep 20, 2018
nicolas-grekas added a commit that referenced this pull requestSep 20, 2018
…ylfabre)This PR was merged into the 4.2-dev branch.Discussion----------[Validator] Check the BIC country with symfony/intl| Q             | A| ------------- | ---| Branch?       | master| Bug fix?      | no| New feature?  | yes| BC breaks?    | no| Deprecations? | no| Tests pass?   | yes| Fixed tickets |#28167| License       | MIT| Doc PR        | N/ACheck the BIC country code against the list from Intl component instead of a simple check alphabetical test.This PR uses the Intl component which is not part of the required dependencies of the Validator component (https://github.com/symfony/validator/blob/master/composer.json): `symfony/intl` is only required for dev. So I'm making a PR against master because it may break existing code.But `CountryValidator` does the same so it may not be an issue after all.Commits-------27bd3a8 [Validator] Check the BIC country with symfony/intlFix#28167
@chalasrchalasr modified the milestones:2.8,nextSep 20, 2018

// next 2 letters must be alphabetic (country code)
if (!ctype_alpha(substr($canonicalize,4,2))) {
if (!class_exists(Intl::class)) {
Copy link
Member

Choose a reason for hiding this comment

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

IMO this is a BC break. The constraint was working without the Intl component before.

Copy link
Member

Choose a reason for hiding this comment

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

and this exception will only be thrown at runtime if no test covers its usage meaning that it will result in a server error which is not good from my point of view

Copy link
Member

Choose a reason for hiding this comment

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

I agree. Reading the issue, I thought this was accepted as a bugfix.
I'm going to submit a BC layer

symfony-splitter pushed a commit to symfony/validator that referenced this pull requestSep 30, 2018
…ntl (chalasr)This PR was merged into the 4.2-dev branch.Discussion----------[Validator] Add BC layer covering BicValidator without Intl| Q             | A| ------------- | ---| Branch?       | master| Bug fix?      | no| New feature?  | no| BC breaks?    | no| Deprecations? | yes| Tests pass?   | yes| Fixed tickets |symfony/symfony#28473 (review)| License       | MIT| Doc PR        | n/aCommits-------10b8a5f041 [Validator] Add BC layer covering BicValidator without Intl
fabpot added a commit that referenced this pull requestSep 30, 2018
…ntl (chalasr)This PR was merged into the 4.2-dev branch.Discussion----------[Validator] Add BC layer covering BicValidator without Intl| Q             | A| ------------- | ---| Branch?       | master| Bug fix?      | no| New feature?  | no| BC breaks?    | no| Deprecations? | yes| Tests pass?   | yes| Fixed tickets |#28473 (review)| License       | MIT| Doc PR        | n/aCommits-------10b8a5f [Validator] Add BC layer covering BicValidator without Intl
@nicolas-grekasnicolas-grekas removed this from thenext milestoneNov 1, 2018
@nicolas-grekasnicolas-grekas added this to the4.2 milestoneNov 1, 2018
This was referencedNov 3, 2018
@sylfabresylfabre deleted the issue_28167 branchSeptember 25, 2020 13:15
Sign up for freeto join this conversation on GitHub. Already have an account?Sign in to comment

Reviewers

@xabbuhxabbuhxabbuh left review comments

@chalasrchalasrchalasr approved these changes

@nicolas-grekasnicolas-grekasnicolas-grekas approved these changes

Assignees

No one assigned

Projects

None yet

Milestone

4.2

Development

Successfully merging this pull request may close these issues.

5 participants

@sylfabre@nicolas-grekas@xabbuh@chalasr@carsonbot

[8]ページ先頭

©2009-2025 Movatter.jp