chillerlan / php-qrcode

A PHP QR Code generator and reader with a user-friendly API.
https://smiley.codes/qrcode/
Apache License 2.0
2.01k stars 302 forks source link

Fix PHP 8.1 deprecation #110

Closed jmsche closed 2 years ago

jmsche commented 2 years ago

Hi,

This fixes a minor deprecation in 4.3 branch for PHP 8.1.

Without this here is the risen deprecation:

Deprecated: strtolower(): Passing null to parameter #1 ($string) of type string is deprecated

codemasher commented 2 years ago

Hey, this has already been fixed in #97, it's not tagged yet though.

jmsche commented 2 years ago

Hi, sorry, didn't see it :) Could you please create a tag so it's available? Thanks!

codemasher commented 2 years ago

I will as soon:tm: as i'm done with the v5 branch as there are a bunch of things i want to backport to 4.x. In the meantime I'd advise to manually set QROptions::$dataModeOverride = '' or suppress E_DEPRECATED.

menjilx commented 2 years ago

Hi,

This fixes a minor deprecation in 4.3 branch for PHP 8.1.

Without this here is the risen deprecation:

Deprecated: strtolower(): Passing null to parameter #1 ($string) of type string is deprecated

How to fix this issue manually, currently using v4.3. Thank you

codemasher commented 2 years ago

The answer is in the post before yours.

menjilx commented 2 years ago

The answer is in the post before yours.

added already and it is now fixed. Thank you!

image
codemasher commented 2 years ago

@menjilx Your fix won't do anything because you always set the value of $dataModeOverride to '' now, like, it can't even be changed if you wanted to because $interface will now always yield null. Just set it to an empty string wherever you invoke the QROptions instance.

menjilx commented 2 years ago

@menjilx Your fix won't do anything because you always set the value of $dataModeOverride to '' now, like, it can't even be changed if you wanted to because $interface will now always yield null. Just set it to an empty string wherever you invoke the QROptions instance.

thanks for checking my response, also updated it and placed it on the "options" already.

image
codemasher commented 2 years ago

I have tagged the fix now as a release as i currently don't have time for the other things i've planned. It's available as 4.3.3.