khanamiryan/php-qrcode-detector-decoder

Compatibility broken with PHP < 8.1

remicollet opened this issue ยท 6 comments

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.

Related to 37269d3

> 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   
 ------ --------------------------------------------------------------------- 

Yes, also seen in #126

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

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?

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"
},