Stash icon indicating copy to clipboard operation
Stash copied to clipboard

PHP 8.1 deprecation issues

Open tyssen opened this issue 2 years ago • 1 comments

Hi Mark,

On PHP 8.1, there are a few deprecation issues. I've fixed some of them, the ones relating to having optional parameters defined before required ones. I just changed the order of the params in mod.stash.php and stash_model.php.

But also getting this one which I don't know how to fix:

preg_match(): Passing null to parameter #2 ($subject) of type string is deprecated user/addons/stash/mod.stash.php, line 236

tyssen avatar Jul 08 '22 02:07 tyssen

Could you please download the code from this branch and see if that solves the deprecation notices? https://github.com/croxton/Stash/tree/patch/php-8.1-compatibility

croxton avatar Sep 07 '22 10:09 croxton

I also ran into this issue today and tested the code but I still get the errors. The lines of code affected are 236, 1075 and 3959 in mod.stash.php.

roberthallatt avatar Oct 18 '22 15:10 roberthallatt

@roberthallatt I'm running the latest EE 7 and PHP 8.1.10, but can't reproduce any errors. Can you isolate the template code that throws an error?

croxton avatar Dec 01 '22 09:12 croxton

FYI I got deprecation errors too, but I hadn't seen there was a patch until just now. The other thing I noticed when I encountered them, is that these only appeared the first reload of the page after changing to PHP8.0 from 7.4, then they went away and I couldn't make them appear again. Fortunately I copied them but I will try the patch and see if I can get any to reappear, even if it means swapping back down to PHP7.4 and up to 8 again.

ttmwebdesign avatar Dec 01 '22 16:12 ttmwebdesign

These should be fixed now, please start a new issue if you find any more. https://github.com/croxton/Stash/archive/refs/heads/master.zip

croxton avatar Feb 02 '23 10:02 croxton