SuiteCRM 7.12.9, PHP8.0 - WebToPersonCapture not working

SuiteCRM: 7.12.9
PHP: v8.0

We upgraded from v7.11 to 7.12.9 and also bumped up to PHP v8.0 as it is one of the supported PHP versions with this SuiteCRM version.

However, our WebToPersonCapture webhook that was working has stopped working and spits out only the below error no matter the combination of fields we tried:

“PHP message: PHP Fatal error: Uncaught TypeError: array_key_exists(): Argument #2 ($array) must be of type array, Lead given in /var/www/html/modules/Campaigns/WebToPersonCapture.php:146”

We also have tried with bare minimum fields and it still isn’t working.
campaign_id, assigned_user_id, moduleDir, first_name, last_name, email1.

Any help is greatly appreciated.

Many thanks!

Hey
This is an issue with php 8 and suitecrm

You can downgrade your php to 7.4
or fix the line 146 by changing

 array_key_exists($person) 

to

property_exists($person)

this way is however upgrade unsafe

There are many other php8 issues in crm as well so you are probably better of switching to php7.4

1 Like

Thanks! Downgrading it to PHP7.4 works, however its out of active security support so wondered if SuiteCRM 7.13 has better support for PHP8.x

Yes
Slowly we are getting there. Like you someone points out an issue. Someone (it can be you as well) puts in a fix for that.
you can check the codebase whether your particular issue has been fixed or not

This needs to be updated in the code quickly.
Still not solved on 7.13.1 !

We did not get leads for a week !

Hi here is the full fix:

edit the file : modules/Campaigns/WebToPersonCapture.php
on line 146
replace if (array_key_exists($k, $person) || array_key_exists($k, $person->field_defs)) {
by if (property_exists($person, $k) || array_key_exists($k, $person->field_defs)) {