Division by zero error on some codes.
jkrysakowski opened this issue · comments
Jakub Krysakowski commented
I'm getting an error, when trying to decode this code:
and it works fine for this one:
The error in the first case is:
PHP Fatal error: Uncaught DivisionByZeroError: Division by zero in /home/jakub/Pulpit/qr_test/vendor/khanamiryan/qrcode-detector-decoder/lib/Common/PerspectiveTransform.php:118
Stack trace:
#0 /home/jakub/Pulpit/qr_test/vendor/khanamiryan/qrcode-detector-decoder/lib/Common/PerspectiveTransform.php(52): Zxing\Common\PerspectiveTransform::squareToQuadrilateral()
#1 /home/jakub/Pulpit/qr_test/vendor/khanamiryan/qrcode-detector-decoder/lib/Qrcode/Detector/Detector.php(403): Zxing\Common\PerspectiveTransform::quadrilateralToQuadrilateral()
#2 /home/jakub/Pulpit/qr_test/vendor/khanamiryan/qrcode-detector-decoder/lib/Qrcode/Detector/Detector.php(114): Zxing\Qrcode\Detector\Detector::createTransform()
#3 /home/jakub/Pulpit/qr_test/vendor/khanamiryan/qrcode-detector-decoder/lib/Qrcode/Detector/Detector.php(65): Zxing\Qrcode\Detector\Detector->processFinderPatternInfo()
#4 /home/jakub/Pulpit/qr_test/vendor/khanamiryan/qrcode-detector-decoder/lib/Qrcode/QRCodeReader.php(61): Zxing\Qrcode\Detector\Detector->detect()
#5 /home/jakub/Pulpit/qr_test/vendor/khanamiryan/qrcode-detector-decoder/lib/QrReader.php(91): Zxing\Qrcode\QRCodeReader->decode()
#6 /home/jakub/Pulpit/qr_test/test.php(8): Zxing\QrReader->decode()
#7 {main}
thrown in /home/jakub/Pulpit/qr_test/vendor/khanamiryan/qrcode-detector-decoder/lib/Common/PerspectiveTransform.php on line 118
Library version: 2.0.2
Problem happens for QR codes generated with error correction level <= high. Works fine if the level is Quartile.