Blank file-change notifications
(Bug fix below.)
I’m receiving blank file-change notifications in email and in the WordPress admin. I can induce a file-change notification by changing a file and manually firing the file check procedure. It will tell me that a file change has occurred, but no changes are reported either in email or in the reporting interface.
I did some debugging. It looks like the call to insert a record in the log is failing. The file is inc/filecheck.php and the relevant lines (starting at line 225) are:
$wpdb->insert( $wpdb->base_prefix . 'bwps_log', array( 'type' => '3', 'timestamp' => current_time( 'timestamp' ), 'host' => '', 'user' => '', 'url' => '', 'referrer' => '', 'data' => serialize( $combined ) ) );
If I run this query directly against the database with dummy data, I get an error that the ‘user’ column is supposed to be an integer and it won’t accept ” as a value.
I confirmed that the insert is failing in two ways: (1) the value of $wpdb->insert_id after the insert returns 0 and (2) there are no records in the database with type=3.
After changing the query above to the following, it began working:
$wpdb->insert( $wpdb->base_prefix . 'bwps_log', array( 'type' => '3', 'timestamp' => current_time( 'timestamp' ), 'host' => '', 'user' => 0, 'username' => '', 'url' => '', 'referrer' => '', 'data' => serialize( $combined ) ) );
Note that I added username, to set it to ” rather than leaving it null. Just a preference on my part based on similar code found in secure.php at line 749.
I also wanted to mention that this may be related to this older issue: http://wordpress.org/support/topic/plugin-better-wp-security-dozens-of-blank-file-change-warning-emails-a-day?replies=7
- The topic ‘Blank file-change notifications’ is closed to new replies.