Skip to content

Commit eeb60ed

Browse files
committed
🔧 fix mask pattern 2 & 3 according to ISO/IEC 18004:2000 Section 8.8.1
1 parent ef42ef6 commit eeb60ed

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

src/Data/QRMatrix.php

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -596,6 +596,8 @@ public function mapData(array $data, int $maskPattern):QRMatrix{
596596
}
597597

598598
/**
599+
* ISO/IEC 18004:2000 Section 8.8.1
600+
*
599601
* @see \chillerlan\QRCode\QRMatrix::mapData()
600602
*
601603
* @internal
@@ -615,10 +617,10 @@ protected function getMask(int $x, int $y, int $maskPattern):int{
615617
// this is literally the same as the stupid switch...
616618
return [
617619
$a % 2,
618-
$y % 2,
619-
$x % 3,
620+
$x % 2,
621+
$y % 3,
620622
$a % 3,
621-
(floor($y / 2) + floor($x / 3)) % 2,
623+
((int)($y / 2) + (int)($x / 3)) % 2,
622624
$m % 2 + $m % 3,
623625
($m % 2 + $m % 3) % 2,
624626
($m % 3 + $a % 2) % 2

0 commit comments

Comments
 (0)