elisseck / com.elisseck.civihoneypot

Simple honeypot fields for CiviCRM Contribute forms
Other
3 stars 6 forks source link

Fatal error with PHP8 #20

Open TomCrawshaw opened 1 year ago

TomCrawshaw commented 1 year ago

Running Civi 5.59.2 under Backdrop with PHP8.0, we get a fatal error when registering for an event: TypeError: in_array(): Argument #2 ($haystack) must be of type array, null given in in_array() (line 40 of /var/www/vhosts/weyarun.org.uk/httpdocs/backdrop_demo/files/civicrm/ext/com.elisseck.civihoneypot-master/civihoneypot.php).

Disabling extension resolves this

elisseck commented 1 year ago

Looks like a bug where the array can be empty if the user does not pick an option when configuring. Would accept a PR if you have time, I probably won't be able to get to this for a little while.

As a workaround you can fill out the event settings at the route /civicrm/honeypot/settings. Either check off "protect all events" OR choose at least one event from the list above.

image

@TomCrawshaw I also encourage you to try out this newer extension by Matt Wire that has implemented most of the concepts from this extension and more useful features as well. I think the only thing it doesn't have is IP bans: https://lab.civicrm.org/extensions/formprotection.