PHP Fatal error: Uncaught Exception: Spam detected.

Issues related to forms.
Post Reply
User avatar
gofrank
 
 
Posts: 196
Joined: Sun Dec 30, 2007 2:43 am
Location: Florida, USA

PHP Fatal error: Uncaught Exception: Spam detected.

Post by gofrank »

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:

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
  
Looking at the WB-generated php code on the specified lines, I see:

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   }
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.
Billing clients for your freelance work? Try Minute-2-Minute, the project management, timing, and billing system. Perfect for web developers who charge by the hour. FREE 45-day trial.
User avatar
Pablo
 
Posts: 23226
Joined: Sun Mar 28, 2004 12:00 pm
Location: Europe
Contact:

Re: PHP Fatal error: Uncaught Exception: Spam detected.

Post by Pablo »

In this context, I do not see anything wrong in the code.
To say something meaningful about this I need to see the full code.
User avatar
gofrank
 
 
Posts: 196
Joined: Sun Dec 30, 2007 2:43 am
Location: Florida, USA

Re: PHP Fatal error: Uncaught Exception: Spam detected.

Post by gofrank »

Your wish is my command: full code
Billing clients for your freelance work? Try Minute-2-Minute, the project management, timing, and billing system. Perfect for web developers who charge by the hour. FREE 45-day trial.
User avatar
Pablo
 
Posts: 23226
Joined: Sun Mar 28, 2004 12:00 pm
Location: Europe
Contact:

Re: PHP Fatal error: Uncaught Exception: Spam detected.

Post by Pablo »

Thanks, I will investigate if this can be improved.
Post Reply