• I’m debugging a site I’m working on, and the debug log is filling with this error message:

    PHP Warning: Undefined array key “si_preview” in /html/wp-content/plugins/siteimprove/includes/class-siteimprove.php on line 148

    Looking at that line of code, there’s something nonsensical about the conditional:

    if ( isset( $_GET['si_preview'] ) || '1' === $_GET['si_preview'] ) {

    It doesn’t make sense to have an “or” || here; the second condition cannot possibly evaluate to true unless the first condition does. Using || eliminates the purpose of the first condition, which is to avoid having the second condition trigger the PHP warning.

    I am assuming this should be an “and” && instead.

    • This topic was modified 1 year, 4 months ago by room34.
Viewing 2 replies - 1 through 2 (of 2 total)
  • After upgrading to php8 I also receive the above warning. I would agree the logic is incorrect and should be changed from || to &&. Please can a new version of the plugin be created containing this bugfix.

    +1 for this fix, debug logs are filled with this warning after PHP 8 upgrade and it makes other issues harder to debug

    PHP Warning:  Undefined array key "si_preview" in /data/wordpress/htdocs/wp-content/plugins/siteimprove/includes/class-siteimprove.php on line 148
Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘PHP warning in debug logs’ is closed to new replies.