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.
Apache License 2.0
1.37k stars 325 forks source link

Uncertain exception !!! Unstable, not sure which URIs are allowed to render !!! Or Design flaws ? #151

Open wheakerd opened 1 week ago

wheakerd commented 1 week ago

system: Fedora Linux 40 (Workstation Edition) php version: 8.3.7

$qrCode = QrCode::create($uri)
            ->setEncoding(
                new Encoding('UTF-8')
            )->setErrorCorrectionLevel(ErrorCorrectionLevel::Low)
            ->setSize(300)
            ->setMargin(10)
            ->setRoundBlockSizeMode(RoundBlockSizeMode::Margin)
            ->setForegroundColor(
                new Color(0, 0, 0)
            )
            ->setBackgroundColor(
                new Color(255, 255, 255)
            );

        $result = $writer->write($qrCode);

        try {
            $writer->validateResult($result, $uri);
        } catch (ValidationException $e) {
            var_dump($e->getMessage());
            return false;
        }

       return $result->getString();

string(179) "The validation reader read "" instead of "http://192.168.0.188:9504/app/index/invitation_register?code=1234". Adjust your parameters to increase readability or disable validation."

but use "http://192.168.0.188:9504/app/index/invitation_register?code=123",no exception! but use "http://192.168.0.188:9504/app/index/invitation_register?code=1235",no exception! but use "http://192.168.0.188:9504/app/index/invitation_register?code=12345",no exception!

the excrption, only "http://192.168.0.188:9504/app/index/invitation_register?code=1234" !!!

wheakerd commented 1 week ago

Currently, we only find that this URL cannot be rendered, or there may be more possibilities?

wheakerd commented 1 week ago

It's still able to render, it just throws an exception?!

wheakerd commented 1 week ago

"khanamiryan/qrcode-detector-decoder": "^2.0" "spomky-labs/aes-key-wrap": "^7.0"