• Resolved ollycross

    (@ollycross)


    Following updating a server to PHP 7.4, and using Shield 8.7.0 I am getting a lot of the following error across the site:

    
    Deprecated: array_key_exists(): Using array_key_exists() on objects is deprecated. Use isset() or property_exists() instead in /path/to/my/www/html/assets/plugins/wp-simple-firewall/src/lib/vendor/twig/twig/src/Template.php on line 607
    

    I am not sure what version of Twig you are including in the plugin, as it appears to have the information stripped out of it. I believe the latest version of Twig does has had this patched though.

    Are you able to update the packaged version of Twig in the plugin to bring it up-to-date with PHP compatibility?

    Thank you!

    • This topic was modified 4 years, 10 months ago by ollycross.
Viewing 7 replies - 1 through 7 (of 7 total)
  • Plugin Author Paul

    (@paultgoodchild)

    Hi,

    Thanks for letting us know about this.

    Unfortunately Shield’s minimum supported version is PHP 5.4. This means we have to keep the library compatible for as many sites as possible, all at once.

    We’re increasing Shield’s minimum supported version to PHP 7.0 when we release Shield 10. That’s a little way out, but it is coming.

    Until then, I’ll take a look and see if we can do a little bit of manual tweaking for Shield 9.0 which is due out next week.

    You could also suppress these errors so you’re not getting spurious notices on your site. Ideally your frontend shouldn’t be displaying deprecation notices…

    Thread Starter ollycross

    (@ollycross)

    I understand, 5.4 support is becoming more and more of an issue across a lot of projects.

    We suppress all errors on production, but I’d prefer not to do this in development as it might mask issues in our own code, or those of direct dependencies that we can update. This deprecation is particularly problematic as it seems to be triggered every single time a template is called. On a site which makes heavy use of templates this makes the amount of noise unworkable.

    Anyway, thank you for coming back to me. I’ll see if I can set up some kind of selective error suppression until such a time that it can be fixed upstream.

    Thread Starter ollycross

    (@ollycross)

    Reading around the issue, the offending code has been patched in V1.42.3; the 1.x releases are compatible back to php 5.5.

    Maybe it would be possible to update to the latest 1.x release, until such a time as Shield 10 is released?

    https://github.com/twigphp/Twig/commit/d0550b7a68d44551e3cae0aae5a6cf9180aec37e

    https://github.com/twigphp/Twig/commits/v1.42.3

    Plugin Author Paul

    (@paultgoodchild)

    Yep, I’ve taken a look at this also and I’m aware of the same thing.

    Unfortunately I’d have to change the minimum PHP version across the plugin to support TWIG 1.42.3 and above. It’s will be easier to just manually patch our TWIG library with their own fixes for PHP 7.4.

    We’ll do this for the 9.0 release due out next week. How does that work for you?

    Thread Starter ollycross

    (@ollycross)

    Hey every little helps, right? That would be great!

    Thank you again for your help!

    Plugin Author Paul

    (@paultgoodchild)

    No worries at all.
    If ya like Shield and what we’re doing, please do leave us a review!

    Every little really does help! ??

    Thread Starter ollycross

    (@ollycross)

    Hey Paul, can confirm this is fixed using Shield 9.

    Nice work!

Viewing 7 replies - 1 through 7 (of 7 total)
  • The topic ‘Deprecated code / Out of date Twig’ is closed to new replies.