dapphp / securimage

PHP CAPTCHA Script
https://github.com/dapphp/securimage
BSD 2-Clause "Simplified" License
568 stars 190 forks source link

dynamic property Securimage.... is deprecated in php 8.2 #116

Open graphicz opened 1 year ago

graphicz commented 1 year ago

First of all thank you so much for this brilliant update of Securimage, I am really thrilled with it, thank you!

I tested on a Linux server with php v8.2 and got these warnings: Deprecated: Creation of dynamic property Securimage::$code_entered is deprecated in /home/newebsite/public_html/securimage-nextgen/securimage-nextgen/securimage.php on line 1028 Deprecated: Creation of dynamic property Securimage::$correct_code is deprecated in /home/newebsite/public_html/securimage-nextgen/securimage-nextgen/securimage.php on line 1029

After some Googling I came upon this: https://stackoverflow.com/questions/74878889/php-warning-deprecated-creation-of-dynamic-property-is-deprecated

Opening securimage.php and looking at line 60 class Securimage I added immediately above #[\AllowDynamicProperties] so lines 60/61 now look like:

#[\AllowDynamicProperties]
class Securimage

and the errors have gone.

Thank you

flipreverse commented 7 months ago

@graphicz Have a look at my fork: https://github.com/flipreverse/securimage I've just fixed some PHP 8.2 deprecated warnings including a quick and dirty try for your isse.