• Resolved redsand

    (@redsand)


    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 directory

    Call 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:236

    Looks like you just forgot to use file_exists() to check if the file is there before using file_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. 🙂

    https://ww.wp.xz.cn/plugins/sucuri-scanner/

Viewing 2 replies - 1 through 2 (of 2 total)
Viewing 2 replies - 1 through 2 (of 2 total)

The topic ‘Minor PHP Error’ is closed to new replies.