Skip to content

[Validator] Fix Costa Rica IBAN format #24900

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
wants to merge 2 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ class IbanValidator extends ConstraintValidator
'CH' => 'CH\d{2}\d{5}[\dA-Z]{12}', // Switzerland
'CI' => 'CI\d{2}[A-Z]{1}\d{23}', // Ivory Coast
'CM' => 'CM\d{2}\d{23}', // Cameron
'CR' => 'CR\d{2}\d{3}\d{14}', // Costa Rica
'CR' => 'CR\d{2}0\d{3}\d{14}', // Costa Rica
Copy link
Contributor

Choose a reason for hiding this comment

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

not sure this is security related, thus needs to be changed on lower branches. I'd prefer the BC variant.

Copy link
Member

Choose a reason for hiding this comment

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

Accepting an invalid IBAN is a bug. There's no BC to preserve here.

Copy link
Contributor

Choose a reason for hiding this comment

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

Right.. this wont lead to crashing behavior. My bad 👍

Copy link
Contributor

Choose a reason for hiding this comment

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

https://bank.codes/iban/structure/costa-rica/ implies it can be any kind of number btw... not sure in practice it's always 0.

Copy link
Contributor Author

@Warxcell Warxcell Nov 10, 2017

Choose a reason for hiding this comment

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

@ro0NL https://www.iban.com/calculate-iban.html - this site does not give you ability to choose Reserve Number. It automatically set it 0.

Also wiki says:

CRkk 0bbb cccc cccc cccc cc

0= always zero
b = bank code
c = Account number

Copy link
Contributor

Choose a reason for hiding this comment

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

👍

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@ro0NL Ok I leave it like that and point it to 2.7

'CV' => 'CV\d{2}\d{21}', // Cape Verde
'CY' => 'CY\d{2}\d{3}\d{5}[\dA-Z]{16}', // Cyprus
'CZ' => 'CZ\d{2}\d{20}', // Czech Republic
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -132,7 +132,7 @@ public function getValidIbans()
array('CV64000300004547069110176'), //Cape Verde
array('FR7630007000110009970004942'), //Central African Republic
array('CG5230011000202151234567890'), //Congo
array('CR0515202001026284066'), //Costa Rica
array('CR05015202001026284066'), //Costa Rica
array('DO28BAGR00000001212453611324'), //Dominican Republic
array('GT82TRAJ01020000001210029690'), //Guatemala
array('IR580540105180021273113007'), //Iran
Expand Down Expand Up @@ -246,6 +246,7 @@ public function getIbansWithInvalidFormat()
array('FR76300070001100099700049421'), //Central African Republic
array('CG52300110002021512345678901'), //Congo
array('CR05152020010262840661'), //Costa Rica
array('CR0515202001026284066'), //Costa Rica
array('DO28BAGR000000012124536113241'), //Dominican Republic
array('GT82TRAJ010200000012100296901'), //Guatemala
array('IR5805401051800212731130071'), //Iran
Expand Down Expand Up @@ -355,7 +356,7 @@ public function getIbansWithValidFormatButIncorrectChecksum()
array('CV64000300004547069110177'), //Cape Verde
array('FR7630007000110009970004943'), //Central African Republic
array('CG5230011000202151234567891'), //Congo
array('CR0515202001026284067'), //Costa Rica
array('CR96042332432534543564'), //Costa Rica
array('DO28BAGR00000001212453611325'), //Dominican Republic
array('GT82TRAJ01020000001210029691'), //Guatemala
array('IR580540105180021273113008'), //Iran
Expand Down