[Plugin: WP Security Scan] Minor Errors in Log files
-
You are doing a great job with this plugin, and I’ d like to congratulate you on your achievement.
In case no-one else has reported it to you, there are some errors that are generated in the logs related to your plugin. I don’t think it affects the functionality at all but, I am sure you would agree, it would be nice if it didn’t generate them at all.
Please see them below:
[11-Jan-2010 23:53:10] PHP Notice: Use of undefined constant mrt_update_notice - assumed 'mrt_update_notice' in /home/myhome/public_html/content/wp-content/plugins/wp-security-scan/securityscan.php on line 48 [11-Jan-2010 23:53:10] PHP Notice: Use of undefined constant mrt_wpdberrors - assumed 'mrt_wpdberrors' in /home/myhome/public_html/content/wp-content/plugins/wp-security-scan/securityscan.php on line 50 [11-Jan-2010 23:53:10] PHP Notice: Use of undefined constant mrt_remove_wp_version - assumed 'mrt_remove_wp_version' in /home/myhome/public_html/content/wp-content/plugins/wp-security-scan/securityscan.php on line 53
The solution to the warning notice is simply to test that a variable exists before using it. For example,
if ($options['allfeeds'] || $options['commentfeeds'])
would be changed to:
if (array_key_exists('allfeeds', $options) && $options['allfeeds'] || array_key_exists('commentfeeds', $options) && $options['commentfeeds'])
While some may argue that isset is better for testing arrays, because it performs slightly better, you need to bear in mind that if the array key does indeed exist but it has been set to null, isset will return false, whereas array_key_exists returns the result that you would expect.
With scalars, you would simply use isset.
Hope this is all useful to you (although I imagine that you know all this already) ??
Best wishes
Hal
- The topic ‘[Plugin: WP Security Scan] Minor Errors in Log files’ is closed to new replies.