khanamiryan / php-qrcode-detector-decoder

This is a PHP library to detect and decode QR-codes. This is first and only QR code reader that works without extensions.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

PHP code works, but dumps a large PHP object

freebrowser1 opened this issue · comments

Install from: composer require khanamiryan/qrcode-detector-decoder.
Created a file qr.php in the working folder where composer.json resides:

<?php
require __DIR__ . "/vendor/autoload.php";
use Zxing\QrReader;

//require_once(dirname(__FILE__). "src
if ($argc > 0) {
    $qrcode = new QrReader($argv[1]);
    var_dump( $qrcode);
//return decoded text from QR Code
} else {
    echo nl2br($argv[0] . " path_to_image\n");
}

Run from the working folder where composer.json resides:
That results in 350000 lines of vomit starting and not the actual contents of the QR.

object(Zxing\QrReader)#3 (4) {
  ["bitmap":"Zxing\QrReader":private]=>
  object(Zxing\BinaryBitmap)#6 (2) {
    ["binarizer":"Zxing\BinaryBitmap":private]=>
    object(Zxing\Common\HybridBinarizer)#5 (5) {
      ["source":"Zxing\Binarizer":private]=>
      object(Zxing\GDLuminanceSource)#4 (8) {
        ["width":"Zxing\LuminanceSource":private]=>
        int(300)
        ["height":"Zxing\LuminanceSource":private]=>
        int(292)
        ["luminances"]=>
        array(87600) {
          [0]=>
          int(255)
          [1]=>
          int(255)
          [2]=>
          int(255)
===================================> 350000 (!) lines 
            int(254)
          }
          ["zero":"Zxing\Common\Reedsolomon\GenericGF":private]=>
          object(Zxing\Common\Reedsolomon\GenericGFPoly)#23 (2) {
            ["coefficients":"Zxing\Common\Reedsolomon\GenericGFPoly":private]=>
            array(1) {
              [0]=>
              int(0)
            }
            ["field":"Zxing\Common\Reedsolomon\GenericGFPoly":private]=>
            *RECURSION*
          }
          ["one":"Zxing\Common\Reedsolomon\GenericGF":private]=>
          object(Zxing\Common\Reedsolomon\GenericGFPoly)#24 (2) {
            ["coefficients":"Zxing\Common\Reedsolomon\GenericGFPoly":private]=>
            array(1) {
              [0]=>
              int(1)
            }
            ["field":"Zxing\Common\Reedsolomon\GenericGFPoly":private]=>
            *RECURSION*
          }
          ["primitive":"Zxing\Common\Reedsolomon\GenericGF":private]=>
          int(285)
          ["size":"Zxing\Common\Reedsolomon\GenericGF":private]=>
          int(256)
          ["generatorBase":"Zxing\Common\Reedsolomon\GenericGF":private]=>
          int(0)
        }
      }
    }
  }
  ["result":"Zxing\QrReader":private]=>
  NULL
  ["error":"Zxing\QrReader":private]=>
  NULL
}