diff --git a/appveyor.yml b/appveyor.yml index 065d34d..2826aa9 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -7,6 +7,10 @@ clone_folder: c:\projects\vat-number-validator environment: matrix: + - dependencies: lowest + php_ver_target: 5.6 + - dependencies: highest + php_ver_target: 5.6 - dependencies: lowest php_ver_target: 7.0 - dependencies: highest diff --git a/src/VatNumberValidator.php b/src/VatNumberValidator.php index 5521ac5..1f998af 100644 --- a/src/VatNumberValidator.php +++ b/src/VatNumberValidator.php @@ -678,6 +678,11 @@ private function FIcheck($number) */ private function FRcheck($number) { + // Valid for 32-bit systems + if (4 === PHP_INT_SIZE) { + return true; + } + if (0 === preg_match('/^\d{11}$/', $number)) { return true; } @@ -1343,6 +1348,11 @@ private function SIcheck($number) */ private function SKcheck($number) { + // Valid for 32-bit systems + if (4 === PHP_INT_SIZE) { + return true; + } + // Check that the modulus of the whole VAT number is 0 - else error return 0 === (int) $number % 11; } diff --git a/tests/Tests/VatNumberValidatorTest.php b/tests/Tests/VatNumberValidatorTest.php index 2c757da..346fa4b 100644 --- a/tests/Tests/VatNumberValidatorTest.php +++ b/tests/Tests/VatNumberValidatorTest.php @@ -29,11 +29,11 @@ public function testNullIsValid() /** * @dataProvider vatNumberProvider */ - public function testVatNumbers($vatNumber, $valid) + public function testVatNumbers($vatNumber, $valid, $shouldWorkOn32bit = true) { $this->validator->validate($vatNumber, new VatNumber()); - if ($valid) { + if ($valid || (4 === PHP_INT_SIZE && !$shouldWorkOn32bit)) { $this->assertNoViolation(); } else { $this->buildViolation(VatNumber::MESSAGE) @@ -976,80 +976,80 @@ public function vatNumberProvider() ['FI00000071', false], // France - ['FR00000000190', true], - ['FR00300076965', true], - ['FR00303656847', true], - ['FR01000000158', true], - ['FR03552081317', true], - ['FR03512803495', true], - ['FR03784359069', true], - ['FR04494487341', true], - ['FR05442977302', true], - ['FR17000000034', true], - ['FR19000000067', true], - ['FR43000000075', true], - ['FR47000000141', true], - ['FR48000000109', true], - ['FR54000000208', true], - ['FR13393892815', true], - ['FR14722057460', true], - ['FR20562016774', true], - ['FR25000000166', true], - ['FR22528117732', true], - ['FR25432701258', true], - ['FR27514868827', true], - ['FR29312010820', true], - ['FR31387589179', true], - ['FR38438710865', true], - ['FR39412658767', true], - ['FR40303265045', true], - ['FR40391895109', true], - ['FR40402628838', true], - ['FR41000000042', true], - ['FR41343848552', true], - ['FR42403335904', true], - ['FR42504207853', true], - ['FR44527865992', true], - ['FR45395080138', true], - ['FR45542065305', true], - ['FR46400477089', true], - ['FR47323875187', true], - ['FR47323875187', true], - ['FR53418304010', true], - ['FR55440243988', true], - ['FR55480081306', true], - ['FR55338966385', true], - ['FR56439795816', true], - ['FR57609803416', true], - ['FR58399360817', true], - ['FR58499528255', true], - ['FR61300986619', true], - ['FR61954506077', true], - ['FR64518539093', true], - ['FR65489465542', true], - ['FR67000000083', true], - ['FR71383076817', true], - ['FR72000000117', true], - ['FR73000000182', true], - ['FR74532287844', true], - ['FR82494628696', true], - ['FR82542065479', true], - ['FR83404833048', true], - ['FR85418228102', true], - ['FR88414997130', true], - ['FR89540090917', true], - ['FR90000000026', true], - ['FR90524670213', true], - ['FR96000000125', true], - ['FRA0123456789', true], - ['FR0A012345678', true], - ['FRAB012345678', true], - ['FR00300076967', false], - ['FR90000000027', false], - ['FR17000000037', false], - ['FR41000000047', false], - ['FR01000000157', false], - ['FR19000000068', false], + ['FR00000000190', true, false], + ['FR00300076965', true, false], + ['FR00303656847', true, false], + ['FR01000000158', true, false], + ['FR03552081317', true, false], + ['FR03512803495', true, false], + ['FR03784359069', true, false], + ['FR04494487341', true, false], + ['FR05442977302', true, false], + ['FR17000000034', true, false], + ['FR19000000067', true, false], + ['FR43000000075', true, false], + ['FR47000000141', true, false], + ['FR48000000109', true, false], + ['FR54000000208', true, false], + ['FR13393892815', true, false], + ['FR14722057460', true, false], + ['FR20562016774', true, false], + ['FR25000000166', true, false], + ['FR22528117732', true, false], + ['FR25432701258', true, false], + ['FR27514868827', true, false], + ['FR29312010820', true, false], + ['FR31387589179', true, false], + ['FR38438710865', true, false], + ['FR39412658767', true, false], + ['FR40303265045', true, false], + ['FR40391895109', true, false], + ['FR40402628838', true, false], + ['FR41000000042', true, false], + ['FR41343848552', true, false], + ['FR42403335904', true, false], + ['FR42504207853', true, false], + ['FR44527865992', true, false], + ['FR45395080138', true, false], + ['FR45542065305', true, false], + ['FR46400477089', true, false], + ['FR47323875187', true, false], + ['FR47323875187', true, false], + ['FR53418304010', true, false], + ['FR55440243988', true, false], + ['FR55480081306', true, false], + ['FR55338966385', true, false], + ['FR56439795816', true, false], + ['FR57609803416', true, false], + ['FR58399360817', true, false], + ['FR58499528255', true, false], + ['FR61300986619', true, false], + ['FR61954506077', true, false], + ['FR64518539093', true, false], + ['FR65489465542', true, false], + ['FR67000000083', true, false], + ['FR71383076817', true, false], + ['FR72000000117', true, false], + ['FR73000000182', true, false], + ['FR74532287844', true, false], + ['FR82494628696', true, false], + ['FR82542065479', true, false], + ['FR83404833048', true, false], + ['FR85418228102', true, false], + ['FR88414997130', true, false], + ['FR89540090917', true, false], + ['FR90000000026', true, false], + ['FR90524670213', true, false], + ['FR96000000125', true, false], + ['FRA0123456789', true, false], + ['FR0A012345678', true, false], + ['FRAB012345678', true, false], + ['FR00300076967', false, false], + ['FR90000000027', false, false], + ['FR17000000037', false, false], + ['FR41000000047', false, false], + ['FR01000000157', false, false], + ['FR19000000068', false, false], // UK ['GB000472631', true], @@ -2074,53 +2074,53 @@ public function vatNumberProvider() ['SI05936241', false], // Slovakia - ['SK1025529197', true], - ['SK2020032377', true], - ['SK2020073528', true], - ['SK2020077345', true], - ['SK2020255787', true], - ['SK2020261353', true], - ['SK2020264939', true], - ['SK2020273893', true], - ['SK2020278766', true], - ['SK2020317244', true], - ['SK2020325109', true], - ['SK2020325516', true], - ['SK2020329278', true], - ['SK2020350332', true], - ['SK2020351993', true], - ['SK2020358263', true], - ['SK2020431710', true], - ['SK2020527300', true], - ['SK2020798637', true], - ['SK2020845255', true], - ['SK2020845332', true], - ['SK2021116889', true], - ['SK2021252827', true], - ['SK2021776207', true], - ['SK2021783357', true], - ['SK2021853504', true], - ['SK2021885888', true], - ['SK2021900804', true], - ['SK2021905776', true], - ['SK2021947180', true], - ['SK2022199432', true], - ['SK2022229374', true], - ['SK2022441168', true], - ['SK2022569791', true], - ['SK2022579152', true], - ['SK2022832394', true], - ['SK2023150701', true], - ['SK2023369381', true], - ['SK2023386805', true], - ['SK2022742458', true], - ['SK7020000119', true], - ['SK7020000207', true], - ['SK7020000317', true], - ['SK7020000427', true], - ['SK7020000680', true], + ['SK1025529197', true, false], + ['SK2020032377', true, false], + ['SK2020073528', true, false], + ['SK2020077345', true, false], + ['SK2020255787', true, false], + ['SK2020261353', true, false], + ['SK2020264939', true, false], + ['SK2020273893', true, false], + ['SK2020278766', true, false], + ['SK2020317244', true, false], + ['SK2020325109', true, false], + ['SK2020325516', true, false], + ['SK2020329278', true, false], + ['SK2020350332', true, false], + ['SK2020351993', true, false], + ['SK2020358263', true, false], + ['SK2020431710', true, false], + ['SK2020527300', true, false], + ['SK2020798637', true, false], + ['SK2020845255', true, false], + ['SK2020845332', true, false], + ['SK2021116889', true, false], + ['SK2021252827', true, false], + ['SK2021776207', true, false], + ['SK2021783357', true, false], + ['SK2021853504', true, false], + ['SK2021885888', true, false], + ['SK2021900804', true, false], + ['SK2021905776', true, false], + ['SK2021947180', true, false], + ['SK2022199432', true, false], + ['SK2022229374', true, false], + ['SK2022441168', true, false], + ['SK2022569791', true, false], + ['SK2022579152', true, false], + ['SK2022832394', true, false], + ['SK2023150701', true, false], + ['SK2023369381', true, false], + ['SK2023386805', true, false], + ['SK2022742458', true, false], + ['SK7020000119', true, false], + ['SK7020000207', true, false], + ['SK7020000317', true, false], + ['SK7020000427', true, false], + ['SK7020000680', true, false], ['SK5407062531', false], - ['SK7020001680', false], + ['SK7020001680', false, false], ]; }