From ffbcfef85c38817c9adb264b5b73ab3427eb326b Mon Sep 17 00:00:00 2001 From: Manuel Reinhard Date: Mon, 2 Dec 2019 15:24:45 +0100 Subject: [PATCH 1/4] Add testing with PHP 7.4 to Travis config --- .travis.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.travis.yml b/.travis.yml index 5f5e20ef..e528bb3c 100644 --- a/.travis.yml +++ b/.travis.yml @@ -4,6 +4,7 @@ php: - 7.1 - 7.2 - 7.3 + - 7.4 env: matrix: From c35bc1eb82926d010effac989ff55fd1cfed3c65 Mon Sep 17 00:00:00 2001 From: Manuel Reinhard Date: Tue, 10 Dec 2019 14:08:53 +0100 Subject: [PATCH 2/4] Adjust phpunit config to ignore deprecations --- phpunit.xml.dist | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/phpunit.xml.dist b/phpunit.xml.dist index 742e4938..3fe0463b 100644 --- a/phpunit.xml.dist +++ b/phpunit.xml.dist @@ -1,6 +1,14 @@ - + + + + + tests From 6316b732ba2cf4acc5f4578a98a37d483b0ebf89 Mon Sep 17 00:00:00 2001 From: Manuel Reinhard Date: Mon, 20 Apr 2020 10:20:09 +0200 Subject: [PATCH 3/4] Use khanamiryan/qrcode-detector-decoder in a version which works for PHP 7.4 --- composer.json | 1 + 1 file changed, 1 insertion(+) diff --git a/composer.json b/composer.json index 6d2c33f9..1b031057 100644 --- a/composer.json +++ b/composer.json @@ -7,6 +7,7 @@ "php": ">=7.1", "symfony/validator": "^3.4|^4.2", "symfony/intl": "^3.4|^4.2", + "khanamiryan/qrcode-detector-decoder": "^1.0.3", "kmukku/php-iso11649": "^1.4", "endroid/qr-code": "^3.5.3" }, From e9b7bca01049c2c52619fa74e0ca0f3952028601 Mon Sep 17 00:00:00 2001 From: Manuel Reinhard Date: Mon, 20 Apr 2020 10:53:06 +0200 Subject: [PATCH 4/4] Catch invalid characters before performing ISO11649 test --- src/Constraint/ValidCreditorReferenceValidator.php | 10 ++++++++++ tests/Constraint/ValidCreditorReferenceTest.php | 1 + 2 files changed, 11 insertions(+) diff --git a/src/Constraint/ValidCreditorReferenceValidator.php b/src/Constraint/ValidCreditorReferenceValidator.php index 202b6336..96274449 100644 --- a/src/Constraint/ValidCreditorReferenceValidator.php +++ b/src/Constraint/ValidCreditorReferenceValidator.php @@ -14,6 +14,16 @@ public function validate($value, Constraint $constraint) return; } + // Catch any invalid characters which are not allowed in ISO11649 + // (but may not be caught by the underlying library) + if (!preg_match('/^[\w ]*$/', $value)) { + $this->context->buildViolation($constraint->message) + ->setParameter('{{ string }}', $value) + ->addViolation(); + + return; + } + $referenceGenerator = new phpIso11649(); if (false === $referenceGenerator->validateRfReference($value)) { diff --git a/tests/Constraint/ValidCreditorReferenceTest.php b/tests/Constraint/ValidCreditorReferenceTest.php index b9d4c86f..6f720c33 100644 --- a/tests/Constraint/ValidCreditorReferenceTest.php +++ b/tests/Constraint/ValidCreditorReferenceTest.php @@ -64,6 +64,7 @@ public function getInvalidCreditorReferences() return [ ['RF43 1234 5123 45'], ['RF431234512345'], + ['RF431234512345Ä'], ['foo'] ]; }