Minor PHP Error
-
While using the plugin Query Monitor for some debugging, we got the following error from wp-content/plugins/sucuri-scanner/sucuri.php:8616:
file_get_contents(/XXXXXX/wp-content/.htaccess): failed to open stream: No such file or directoryCall stack:
file_get_contents() wp-content/plugins/sucuri-scanner/sucuri.php:8616 SucuriScanHardening::get_whitelisted() wp-content/plugins/sucuri-scanner/sucuri.php:8727 sucuriscan_hardening_whitelist() wp-content/plugins/sucuri-scanner/sucuri.php:8640 sucuriscan_hardening_page() wp-includes/plugin.php:525 do_action('sucuri-security_page_sucuriscan_hardening') wp-admin/admin.php:236Looks like you just forgot to use
file_exists()to check if the file is there before usingfile_get_contents().I see that you used
file_exists()in the previous function (dewhitelist()) a few lines before it, so I’m guessing that was just an oversight.Site is on PHP 7.0.4 and WP 4.5, Apache.
I know some developers get in the habit of just ignoring/suppressing PHP notices or throwing an
@in front of things, but that’s not the best practice. It’s better just to be strict and fix the issue outright for cleaner code and to prevent any potential further issues (however small). Little things can add up.Thanks in advance. It’s a great plugin. 🙂
The topic ‘Minor PHP Error’ is closed to new replies.