Forráskód Böngészése

fixed https://github.com/codemasher/php-qrcode/issues/3

smiley 9 éve
szülő
commit
3cb15c94fb
1 módosított fájl, 6 hozzáadás és 7 törlés
  1. 6 7
      src/QRCode.php

+ 6 - 7
src/QRCode.php

@@ -184,7 +184,7 @@ class QRCode{
 		$length = $this->qrDataInterface->dataLength;
 
 		if($this->qrDataInterface->mode === QRConst::MODE_KANJI){
-			$length = floor($this->qrDataInterface->dataLength / 2);
+			$length = floor($length / 2);
 		}
 
 		foreach(range(1, 10) as $type){
@@ -646,14 +646,13 @@ class QRCode{
 					continue;
 				}
 
-				$row = $col = -2;
-				while($row < 3){
-					while($col < 3){
+				for($row = -2; $row <= 2; $row++){
+					for($col = -2; $col <= 2; $col++){
 						$this->matrix[$posI + $row][$posJ + $col] =
-							$row === -2 || $row ===  2 || $col === -2 || $col ===  2 ||($row ===  0 && $col === 0);
-						$col++;
+							    $row === -2 || $row === 2
+							||  $col === -2 || $col === 2
+							|| ($row ===  0 && $col === 0);
 					}
-					$row++;
 				}
 			}
 		}