PHP error with Standalone Forms
Summary
Whenever the extension is enabled I get PHP errors for Standalone Forms.
Reproduction steps + Current behaviour
- Create a common profile for standalone use e.g. a simple subscription form adding a contact.
- Check if it's working with extension disabled → contact is created
- Enable extension and enable honeypot feature for profiles on Form Protection settings page
- Try using same profile again → fatal error, no contact is created
I haven't tested other forms so far but I could reproduce the issue on three systems.
Expected behaviour
Profile works as before plus hidden honeypot field is in use.
Environment information + log entry
Tested on two Wordpress and one Drupal sites:
- CiviCRM: 5.45.1, Wordpress: 5.8.3
- CiviCRM: 5.40.4, Wordpress: 5.8.3
- CiviCRM: 5.40.4, Drupal: 7.81
Click to expand PHP error log entry (from Wordpress)
PHP Fatal error: Uncaught Error: Cannot access protected property CRM_Profile_Form_Edit::$_mode in /html/wordpress/wp-content/uploads/civicrm/ext/formprotection/Civi/Formprotection/Forms.php:55
Stack trace:
#0 /html/wordpress/wp-content/uploads/civicrm/ext/formprotection/Civi/Formprotection/Honeypot.php(97): Civi\Formprotection\Forms->isFormProtectionActive('honeypot', Object(CRM_Profile_Form_Edit))
#1 (closed) /html/wordpress/wp-content/uploads/civicrm/ext/formprotection/formprotection.php(149): Civi\Formprotection\Honeypot->buildForm(Object(CRM_Profile_Form_Edit))
#2 (closed) /html/wordpress/wp-content/plugins/civicrm/civicrm/CRM/Utils/Hook.php(275): formprotection_civicrm_buildForm('CRM_Profile_For...', Object(CRM_Profile_Form_Edit))
#3 (closed) /html/wordpress/wp-content/plugins/civicrm/civicrm/CRM/Utils/Hook/WordPress.php(136): CRM_Utils_Hook->runHooks(Array, 'civicrm_buildFo...', 2, 'CRM_Profile_For...', Object(CRM_Profile_Form_Edit), NULL, NULL, NULL, NULL)
#4 (closed) /html/wordpress/wp-content/plugins/civicrm/civicrm/Civi/Core/CiviEventDispatcher.php(2 in /html/wordpress/wp-content/uploads/civicrm/ext/formprotection/Civi/Formprotection/Forms.php