Open J-Wick4 opened 1 year ago
This issue has been mentioned on SuiteCRM. There might be relevant details there:
Hey!
Thank you for raising this issue.
I've transferred this to the SuiteCRM-Core repo, as you've noted this is an issue you've found in SuiteCRM8
For reference's sake, it looks this is is a duplicate of the following issue: https://github.com/salesagility/SuiteCRM-Core/issues/209
I have found the solution to this bug and verified it works.
Edit the file: modules/Campaigns/WebToPersonCapture.php on line 146
Replace if (array_key_exists($k, $person) || array_key_exists($k, $person->field_defs)) {
With if (property_exists($person, $k) || array_key_exists($k, $person->field_defs)) {
Hi @J-Wick4, @clemente-raposo @johnM2401 I understand that this fix should be added to https://github.com/salesagility/SuiteCRM repository (v7.x) instead of this one. The 7.14.x is the end of PHP 7.4, so we could add it to the next ESR of 7.x.
Hi @J-Wick4, @clemente-raposo @johnM2401 I understand that this fix should be added to https://github.com/salesagility/SuiteCRM repository (v7.x) instead of this one. The 7.14.x is the end of PHP 7.4, so we could add it to the next ESR of 7.x.
I think from my research, the problem exists on both 7.x and 8.x. so maybe check both versions to be sure.
Issue
The web-to-Person form generator's output form code does not seem to work on PHP 8.0.28 and produces an Error 500 upon form submission.
Expected Behavior
Actual Behavior
Web server log ` 954216#0: *49662 FastCGI sent in stderr: "PHP message: PHP Fatal error: Uncaught TypeError: array_key_exists(): Argument salesagility/SuiteCRM#2 ($array) must be of type array, Lead given in /var/www/vhosts/mydomain.net/subdomains/crm/public/legacy/modules/Campaigns/WebToPersonCapture.php:146 Stack trace:
0 /var/www/vhosts/mydomain.net/subdomains/crm/public/legacy/include/MVC/Controller/SugarController.php(1010): require_once()
salesagility/SuiteCRM#1 /var/www/vhosts/mydomain.net/subdomains/crm/public/legacy/include/MVC/Controller/SugarController.php(465): SugarController->handleEntryPoint() salesagility/SuiteCRM#2 /var/www/vhosts/mydomain.net/subdomains/crm/public/legacy/include/MVC/Controller/SugarController.php(361): SugarController->process() salesagility/SuiteCRM#3 /var/www/vhosts/mydomain.net/subdomains/crm/public/legacy/include/MVC/SugarApplication.php(101): SugarController->execute() salesagility/SuiteCRM#4 /var/www/vhosts/mydomain.net/subdomains/crm/public/legacy/index.php(52): SugarApplication->execute() salesagility/SuiteCRM#5 /var/www/vhosts/mydomain.net/subdomains/crm/public/index.php(54): require('...') salesagility/SuiteCRM#6 {main}" while reading response header from upstream`
Possible Fix
From AI diagnostics, it suggested this:
_The error message "PHP Fatal error: Uncaught TypeError: array_key_exists(): Argument salesagility/SuiteCRM#2 ($array) must be of type array, Lead given" suggests that there is a type error in the code of the WebToPersonCapture.php file in the Campaigns module of SuiteCRM 1 . The error is caused by passing a variable of type "Lead" instead of an array to the array_key_exists() function. This error can be fixed by modifying the code in the WebToPersonCapture.php file to ensure that the correct type of variable is passed to the array_keyexists() function. It is recommended to seek the help of a developer or SuiteCRM support to fix this error.
Steps to Reproduce
Context
Your Environment
PHP 8.0.28 (PHP-FPM) PHP 7.4.33 (PHP-FPM) MariaDB 10.4 Apache 2.4.37 Rocky Linux 8.6