stefangabos / Zebra_Session

A drop-in replacement for PHP's default session handler which stores session data in a MySQL database, providing better performance, better security and protection against session fixation and session hijacking
https://stefangabos.github.io/Zebra_Session/Zebra_Session/Zebra_Session.html
Other
172 stars 85 forks source link

Temporary solution #[\AllowDynamicProperties] for php 8.2 #47

Closed i07 closed 1 year ago

i07 commented 1 year ago

[\AllowDynamicProperties] annotation added, to remove deprecation warnings in php 8.2 and higher. This is not a solution but simply to allow dynamic properties for the Zebra_Session class in php 8.2 and higher.

stefangabos commented 1 year ago

But there shouldn't be any dynamic properties in the library... I am currently running 8.1.2 but I'll upgrade and will check. Thanks for the heads-up!

i07 commented 1 year ago

Thanks for checking!, just added the annotation to remove the deprecation warnings, I thought let's do a pull request with the annotation, so it's compatible with 8.2 for now, giving you ample time to refactor where needed. ;-) at least until php 9

i07 commented 1 year ago

well it wasn't Zebra_session; I actually had one dynamic property, the error was triggered from line 309 (session_start() in Zebra_Session.php), when session_deserialization happened, it tried to create the property. I mistakenly took that the property was created by Zebra_Session when it was actually my object that was the cause. Thank you for your quick response!

i07 commented 1 year ago

but.. after doing a little small project with just Zebra_Session , you do have two properties that are dynamic

Deprecated: Creation of dynamic property Zebra_Session::$security_code is deprecated in /Users/i07/Development/82test/vendor/stefangabos/zebra_session/Zebra_Session.php on line 282

Deprecated: Creation of dynamic property Zebra_Session::$session_lock is deprecated in /Users/i07/Development/82test/vendor/stefangabos/zebra_session/Zebra_Session.php on line 492

stefangabos commented 1 year ago

I had this fixed a while ago but didn't do a release - I was trying to find some time for more updates. I did release 4.0.0 now which you can get via composer

i07 commented 1 year ago

Awesome, that did it! , thank you Stefan