• Resolved Mark Barnes

    (@mark8barnes)


    We frequently receive warnings:

    INSERT INTO cn_wfConfig (name, val, autoload) values ('lastNotificationID', '1', 'no') Duplicate entry 'lastNotificationID' for key 'PRIMARY'

    These occur with /wp-admin/admin-ajax.php and /wp-cron.php

    We’ve also once received the warning:

    PHP Warning unlink(/home/customer/www/[redacted]/html/wp-content/wflogs/template.0757941001623254491.tmp): No such file or directory 
        [internal] unlink
        /home/customer/www/[redacted]/html/wp-content/plugins/wordfence/lib/wordfenceClass.php:2170 wordfence::veryFirstAction

    Please could you fix the bugs or include better error handling. Thanks.

Viewing 3 replies - 1 through 3 (of 3 total)
  • Plugin Support wfpeter

    (@wfpeter)

    Hi @mark8barnes, thanks for your question.

    Are you using Query Monitor by any chance? We do suppress “expected” errors where a file is not found or duplicate entries occur, but have noticed that QM ignores the $wpdb->suppress_errors(true); function provided by WordPress.

    The reason why we allow the first error to happen silently in the background is because it decreases the chance of a race condition happening, which could occur if we ran an extra query to check if the value exists yet. In short, the value could be created between the check and the attempted INSERT. It also takes more resources to check for the presence of a file rather than just attempt to perform an operation and ignore the error if it’s not there.

    Thanks,

    Peter.

    Thread Starter Mark Barnes

    (@mark8barnes)

    @wfpeter. Thanks for the reply. We are using Query Monitor on our dev machines, but not on our live site. On our live site, our custom error-checking code captures and logs the database error (our code monitors the $EZSQL_ERROR global).

    Elsewhere in WordFence you use ON DUPLICATE KEY UPDATE for this insert statement, so I don’t understand why you can’t use that for all occurrences of the statement. Or use INSERT IGNORE if that suits your purposes better.

    It is BugSnag that captures the warning about the deleted file. I’m not sure why it does so when you’re suppressing the error with an @.

    Plugin Support wfpeter

    (@wfpeter)

    Hi @mark8barnes,

    I have passed your suggestions about altering the statements on to the development team and whilst I can’t comment on inclusion of features or suggestions in future versions of the product, all cases are discussed for pros/cons using our internal channels.

    Thanks again,

    Peter.

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘PHP Warnings in WordFence’ is closed to new replies.