• Robert

    (@rsterry48)


    Greetings

    We’re getting a lot of deprecated errors on our development site when testing the PHP upgrade. Will these be fixed in a future release please?

    stripos(): Passing null to parameter #1 ($haystack) of type string is deprecated.

    trim(): Passing null to parameter #1 ($string) of type string is deprecated.

    preg_replace(): Passing null to parameter #3 ($subject) of type array|string is deprecated.

    Plus this warning:
    Warning: Attempt to read property “user_nicename” on bool in /wp-content/plugins

    Many thanks
    Robert Sterry


Viewing 2 replies - 1 through 2 (of 2 total)
  • Plugin Contributor Gary Jones

    (@garyj)

    Hi @rsterry48,

    Thanks for flagging this, and apologies for the slow reply.

    A few of the warnings you listed look likely to be resolved on the latest 4.0.2 release. The “Attempt to read property user_nicename on bool” warning in particular has had three targeted fixes since you posted, covering guest author pages with conflicting query vars and a couple of paths around user deletion. The trim() deprecation around comma-separated author query vars has also been tightened with an is_string() guard.

    That said, I can’t promise every one of the deprecations you saw is gone. The notices you quoted are quite generic, so without the file paths and line numbers it’s hard to be certain we’ve patched the exact call sites you hit. There are still a handful of preg_replace() and stripos() calls in the plugin where the input isn’t explicitly validated as a string before the call, and any of those could still fire under PHP 8.1+ if an upstream plugin or query happens to feed them a null value.

    Could I ask you to do two things, when you have a moment?

    1. Re-test on 4.0.2 and let us know whether the warnings still appear.
    2. If they do, please paste the full notices including the file path and line number that PHP reports for each one. With that we can either fix the specific call sites straight away or, if they’re already fixed, confirm that for you.

    Thanks again for taking the time to report this. The detail will help us close it out properly rather than guess.

    Thread Starter Robert

    (@rsterry48)

    Thank you very much Gary for your very helpful advice. Apologies for time taken to reply as I’ve been away overseas. Will let you know about future warnings as you request.

Viewing 2 replies - 1 through 2 (of 2 total)

You must be logged in to reply to this topic.