php-qrcode-detector-decoder icon indicating copy to clipboard operation
php-qrcode-detector-decoder copied to clipboard

Cannot use object of type Zxing\Qrcode\Decoder\ECBlocks as array

Open EasonJolter opened this issue 4 years ago • 1 comments

this image couse Cannot use object of type Zxing\Qrcode\Decoder\ECBlocks as array ThrowableError in Version.php line 96 public function getECBlocksForLevel($ecLevel) { return $this->ecBlocks[$ecLevel->getOrdinal()]; } I use try catch, but it dosn't catched, just throw exception. And why this image couse exception?

360

EasonJolter avatar Apr 23 '20 14:04 EasonJolter

You have to change the following line in Version.php (94 - 101): public function getECBlocksForLevel($ecLevel) { return $this->ecBlocks[$ecLevel->getOrdinal()]; }

to:

public function getECBlocksForLevel($ecLevel) { if(is_array($this->ecBlocks)){ return $this->ecBlocks[$ecLevel->getOrdinal()]; }else{ return $this->ecBlocks; } }

R4dix avatar Jul 27 '20 12:07 R4dix