• I have been receiving intermittent PHP warning on basically all of my websites regardless of where they are hosted, the theme, plugins, PHP version, etc. They also all tend to show up around the exact same time on the same days.

    Here is the error I receive on every website:

    [02-Feb-2020 08:09:01 UTC] PHP Warning: urldecode() expects parameter 1 to be string, array given in /home/…/public_html/wp-includes/class-wp-query.php on line 2203

    [02-Feb-2020 08:09:01 UTC] PHP Warning: preg_match() expects parameter 2 to be string, array given in /home/…/public_html/wp-includes/canonical.php on line 231

Viewing 1 replies (of 1 total)
  • Moderator bcworkz

    (@bcworkz)

    Intermittent warnings are difficult to resolve unless you can find a reliable way to induce the problem. Additionally, knowing where the warning finally occurred isn’t that helpful, we need to determine the source of the non-string data. To do so requires replacing the default error handler with one that utilizes debug_backtrace() to log the function calls leading up to the point when PHP finally realized something is wrong. One of those functions is likely the actual source of the problem. For examples see
    https://stackoverflow.com/questions/1159216/how-can-i-get-php-to-produce-a-backtrace-upon-errors

    If you use any of the proffered code, replace any echo statements with error_log() for output to be logged instead of sent to the browser. It’s not a literal search and replace. echo statement syntax is not the same as error_log() function syntax. For example:

    echo "Hello world.";
    error_log("Hello world.");

    Even this will not tell us the source of non-string data, it only narrows down where to look.

Viewing 1 replies (of 1 total)

The topic ‘Intermittent PHP warnings’ is closed to new replies.