Skip to content
This repository has been archived by the owner on Feb 23, 2019. It is now read-only.

PHP Warning: stristr(): Empty needle #447

Closed
nigrosimone opened this issue Mar 22, 2017 · 1 comment
Closed

PHP Warning: stristr(): Empty needle #447

nigrosimone opened this issue Mar 22, 2017 · 1 comment

Comments

@nigrosimone
Copy link
Collaborator

From forum https://wordpress.org/support/topic/php-warning-stristr-empty-needle-2/

PHP Warning: stristr(): Empty needle in /home/user/public_html/wp-content/plugins/w3-total-cache/lib/Minify/Minify/IgnoredCommentPreserver.php on line 42, referer: https://www.google.com/

and

stristr(): Empty needle in /home/user/public_html/wp-content/plugins/w3-total-cache/lib/Minify/Minify/HTML.php on line 187

in both cases w3tc doesn't check empty needle in stristr:

if ( stristr($comment, $ignoredComment) !== false) {
    return true;
}

my fix is a simple check for non empty needle:

if ( !empty($ignoredComment) && stristr($comment, $ignoredComment) !== false) {
    return true;
}
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

1 participant