diff --git a/qrcode/qrencode.php b/qrcode/qrencode.php index fc909fa..e790e64 100644 --- a/qrcode/qrencode.php +++ b/qrcode/qrencode.php @@ -127,26 +127,25 @@ public function init(array $spec) } //---------------------------------------------------------------------- - public function getCode() + public function getCode() { - $ret; - + $ret = NULL; if($this->count < $this->dataLength) { - $row = $this->count % $this->blocks; - $col = $this->count / $this->blocks; + $row = (int) $this->count % $this->blocks; + $col = intdiv($this->count, $this->blocks); if($col >= $this->rsblocks[0]->dataLength) { $row += $this->b1; } $ret = $this->rsblocks[$row]->data[$col]; } else if($this->count < $this->dataLength + $this->eccLength) { - $row = ($this->count - $this->dataLength) % $this->blocks; - $col = ($this->count - $this->dataLength) / $this->blocks; + $row = (int) (($this->count - $this->dataLength) % $this->blocks); + $col = (int) (($this->count - $this->dataLength) / $this->blocks); $ret = $this->rsblocks[$row]->ecc[$col]; } else { return 0; } $this->count++; - + return $ret; } }