mirror of
https://github.com/chillerlan/php-qrcode.git
synced 2026-08-24 19:27:58 +00:00
🔧 fixed QRImagick module value validation
This commit is contained in:
@@ -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;
|
||||
}
|
||||
|
||||
|
||||
@@ -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],
|
||||
|
||||
Reference in New Issue
Block a user