Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

PHP code works, but dumps a large PHP object #143

Open
freebrowser1 opened this issue Jul 24, 2023 · 1 comment
Open

PHP code works, but dumps a large PHP object #143

freebrowser1 opened this issue Jul 24, 2023 · 1 comment

Comments

@freebrowser1
Copy link

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
}

@ustpcz
Copy link

ustpcz commented Mar 19, 2024

Try var_dump( $qrcode->text());

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants