PHP warning in debug logs
-
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.
The topic ‘PHP warning in debug logs’ is closed to new replies.