🔧 fixed QRImagick module value validation

This commit is contained in:
smiley
2023-07-12 13:17:28 +02:00
parent 94ceefc779
commit edbc995b63
2 changed files with 3 additions and 1 deletions
+1 -1
View File
@@ -78,7 +78,7 @@ class QRImagick extends QROutputAbstract{
// #rrggbb(aa)
// #rrrrggggbbbb(aaaa)
// ...
if(preg_match('/^#[a-f]+$/i', $value) && in_array((strlen($value) - 1), [3, 4, 6, 8, 9, 12, 16, 24, 32], true)){
if(preg_match('/^#[a-f\d]+$/i', $value) && in_array((strlen($value) - 1), [3, 4, 6, 8, 9, 12, 16, 24, 32], true)){
return true;
}
+2
View File
@@ -40,10 +40,12 @@ final class QRImagickTest extends QROutputTestAbstract{
public static function moduleValueProvider():array{
return [
'invalid: wrong type' => [[], false],
'valid: hex color, numeric (3)' => ['#123', true],
'valid: hex color (3)' => ['#abc', true],
'valid: hex color (4)' => ['#abcd', true],
'valid: hex color (6)' => ['#aabbcc', true],
'valid: hex color (8)' => ['#aabbccdd', true],
'valid: hex color, numeric (8)' => ['#11bb33dd', true],
'valid: hex color (32)' => ['#aaaaaaaabbbbbbbbccccccccdddddddd', true],
'invalid: hex color (non-hex)' => ['#aabbcxyz', false],
'invalid: hex color (too short)' => ['#aa', false],