endroid / qr-code

QR Code Generator
https://endroid.nl
MIT License
4.41k stars 725 forks source link

Type Error #347

Closed Ulyssesyi closed 3 years ago

Ulyssesyi commented 3 years ago

LogoImageData::detectMimeTypeFromUrl throw type error because some code error.

 $format = PHP_VERSION > 80000 ? true : 1;

PHP_VERSION is string, try to use as integer so the expression always is false. And at next line the "get_headers" function need arg#2 be bool, but $format is 1. So it will throw type error in strict_types @endroid

endroid commented 3 years ago

Hi @Ulyssesyi thank you. I updated the code so it uses the version_compare method.

Ulyssesyi commented 3 years ago

@endroid version_compare can't use php version id as argument. The second argument should be '8.0.0' not '80000'. It should be PHP_VERSION_ID >= 80000 ? true : 1 or version_compare(PHP_VERSION, '8.0.0') >=0 ? true : 1

endroid commented 3 years ago

Ah didn't see that one, thought I was working with ID already ;) Fixed, thank you!