PHP Fatal error: Uncaught Exception: Spam detected.
Posted: Tue Mar 25, 2025 6:43 pm
I have a client with a contact form set to use a "honeypot" to eliminate spam. The "honeypot" field is "address". When a bot fills in the "address" field, an exception is thrown (as designed). However, this generates the following entry in the site's error_log:
Looking at the WB-generated php code on the specified lines, I see:
Is it normal for the "Spam detected" honeypot code to generate a fatal error entry in error_log? This does not happen when an exception is thrown for an invalid email address.
Code: Select all
[25-Mar-2025 12:42:06 UTC] PHP Fatal error: Uncaught Exception: Spam detected.
<br> in /home/mysite/public_html/contact-the-crew.php:21
Stack trace:
#0 {main}
thrown in /home/mysite/public_html/contact-the-crew.php on line 21
Code: Select all
17 $internalfields = array ("submit", "reset", "send", "filesize", "formid", "captcha", "recaptcha_challenge_field", "recaptcha_response_field", "g-recaptcha-response", "h- captcha-response", "address");
18 if (!empty($_POST['address']))
19 {
20 $error .= "Spam detected.\n<br>";
21 throw new Exception($error);
22 }