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.36k stars 323 forks source link

Compatibility broken with PHP < 8.1 #124

Open remicollet opened 2 years ago

remicollet commented 2 years ago

Despite composer have

  "require": {
    "php": ">=5.6"
  },
$ php80 /usr/bin/phpunit9 --verbose
PHPUnit 9.5.21 #StandWithUkraine

Runtime:       PHP 8.0.21RC1
Configuration: /dev/shm/BUILD/php-qrcode-detector-decoder-45326fb83a2a375065dbb3a134b5b8a5872da569/phpunit.xml.dist

EE                                                                  2 / 2 (100%)

Time: 00:00.003, Memory: 4.00 MB

There were 2 errors:

1) Khanamiryan\QrCodeTests\QrReaderTest::testText1
ParseError: syntax error, unexpected fully qualified name "\Zxing\BinaryBitmap", expecting variable

/dev/shm/BUILDROOT/php-khanamiryan-qrcode-detector-decoder-1.0.6-1.fc35.remi.x86_64/usr/share/php/Zxing/QrReader.php:14
/usr/share/php/Fedora/Autoloader/Autoload.php:212
/dev/shm/BUILD/php-qrcode-detector-decoder-45326fb83a2a375065dbb3a134b5b8a5872da569/tests/QrReaderTest.php:14

2) Khanamiryan\QrCodeTests\QrReaderTest::testNoText
Error: Class "Zxing\QrReader" not found

/dev/shm/BUILD/php-qrcode-detector-decoder-45326fb83a2a375065dbb3a134b5b8a5872da569/tests/QrReaderTest.php:21

ERRORS!
Tests: 2, Assertions: 0, Errors: 2.

$ php74 /usr/bin/phpunit9 --verbose
PHPUnit 9.5.21 #StandWithUkraine

Runtime:       PHP 7.4.30
Configuration: /dev/shm/BUILD/php-qrcode-detector-decoder-45326fb83a2a375065dbb3a134b5b8a5872da569/phpunit.xml.dist

EE                                                                  2 / 2 (100%)

Time: 00:00.004, Memory: 4.00 MB

There were 2 errors:

1) Khanamiryan\QrCodeTests\QrReaderTest::testText1
ParseError: syntax error, unexpected '|', expecting variable (T_VARIABLE)

/dev/shm/BUILDROOT/php-khanamiryan-qrcode-detector-decoder-1.0.6-1.fc35.remi.x86_64/usr/share/php/Zxing/QrReader.php:16
/usr/share/php/Fedora/Autoloader/Autoload.php:212
/dev/shm/BUILD/php-qrcode-detector-decoder-45326fb83a2a375065dbb3a134b5b8a5872da569/tests/QrReaderTest.php:14

2) Khanamiryan\QrCodeTests\QrReaderTest::testNoText
Error: Class 'Zxing\QrReader' not found

/dev/shm/BUILD/php-qrcode-detector-decoder-45326fb83a2a375065dbb3a134b5b8a5872da569/tests/QrReaderTest.php:21

ERRORS!
Tests: 2, Assertions: 0, Errors: 2.
remicollet commented 2 years ago

Related to 37269d36e2924cb559832b897e557eb0ebd07b86

limingxinleo commented 2 years ago
> phpstan analyse --memory-limit 1G -l 0 -c phpstan.neon ./app ./config
 739/739 [▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓] 100%

 ------ --------------------------------------------------------------------- 
  Line   app/Kernel/Helper/QrHelper.php                                       
 ------ --------------------------------------------------------------------- 
  22     Instantiated class Zxing\QrReader not found.                         
         💡 Learn more at https://phpstan.org/user-guide/discovering-symbols   
 ------ --------------------------------------------------------------------- 
GenieTim commented 2 years ago

Yes, also seen in #126

remicollet commented 1 year ago

I notice 2.0.0 was release (I don't see any value in bumping major version when minimal required PHP is changed)

The main issue, is that 1.0.6 is still there https://packagist.org/packages/khanamiryan/qrcode-detector-decoder

And will break any installation with PHP 8.1

GenieTim commented 1 year ago

I disagree with the "no value in major when minimal PHP version changes", but that's a discussion for another day.

The maintainer kindly deleted the version from the GitHub releases page. It seems this is not sufficient. What possibility is there to get rid of 1.0.6 then?

giosh94mhz commented 1 year ago

What possibility is there to get rid of 1.0.6 then?

To the maintainer

The package must be removed from packagist too, but probabily the best thing to do it's a 1.0.7 release which rolls back the latest modification.

To everyone else

Add a conflict in composer.json of your project:

"conflict": {
        "khanamiryan/qrcode-detector-decoder": "~1.0.6"
},