SuiteCRM 7.12.x & 7.13.x PHP 8.0.x

Hi,

due to the eol of PHP 7 I have to upgrade to PHP 8.0.x
I tried 7.12.8 and 7.13.0
a look in the compatbility matrix say that SuiteCRM should be compatible with PHP 8.0.x

After switching to PHP 8.0.26 I got a lot of errors in LOG and SuiteCRM didnt work correctly.

(Domainname.com is fake)

some Example errors:

AH01071: Got error ‘/include/Sugar_Smarty.php(151): Smarty->fetch()\n#3 /var/www/vhosts/domainname.com/httpdocs/crm/include/TemplateHandler/TemplateHandler.php(365): Sugar_Smarty->fetch()\n#4 /var/www/vhosts/domainname.com/httpdocs/crm/include/SearchForm/SearchForm2.php(309): TemplateHandler->displayTemplate()\n#5 /var/www/vhosts/domainname.com/httpdocs/crm/include/MVC/View/views/view.list.php(368): SearchForm->display()\n#6 /var/www/vhosts/domainname.com/httpdocs/crm/include/MVC/View/views/view.list.php(274): ViewList…’, referer: https://domainname.com/crm/index.php?action=ajaxui

AH01071: Got error ‘PHP message: PHP Warning: Undefined array key “moduleList” in /var/www/vhosts/domainname.com/domainname.com/cache/smarty/templates_c/%%F6^F60^F609237E%%_headerModuleList.tpl.php on line 28PHP message: PHP Warning: Trying to access array offset on value of type null in /var/www/vhosts/domainname.com/domainname.com/cache/smarty/templates_c/%%F6^F60^F609237E%%_headerModuleList.tpl.php on line 28PHP message: PHP Warning: Undefined array key “moduleList” in /var/www/vhosts/domainname.com/domainname.com/cache/smarty/templates_c/%%F6^F60^F609237E%%_headerModuleList.tpl.php on line 28PHP message: PHP Warning: Trying to access array offset on value of type null in /var/www/vhosts/domainname.com/domainname.com/cache/smarty/templates_c/%%F6^F60^F609237E%%_headerModuleList.tpl.php on line 28PHP message: PHP Warning: Undefined array key “moduleList” in /var/www/vhosts/domainname.com/domainname.com/cache/smarty/templates_c/%%F6^F60^F609237E%%_headerModuleList.tpl.php on line 28PHP message: PHP Warning: Trying to access array offset on value of type null in /var/www/vhosts/domainname.com/domainname.com/cache/smarty/templates_c/%%F6^F60^F609237E%%_headerModuleList.tpl.php on line 28PHP message: PHP Warning: Undefined array key “moduleList” in /var/www/vhosts/domainname.com/domainname.com/cache/smarty/templates_c/%%F6^F60^F609237E%%_headerModuleList.tpl.php on line 28PHP message: PHP Warning: Trying to access array offset on value of type null in /var/www/vhosts/domainname.com/domainname.com/cache/smarty/templates_c/%%F6^F60^F609237E%%_headerModuleList.tpl.php on line 28PHP message: PHP Warning: Undefined array key “moduleList” in /var/www/vhosts/domainname.com/domainname.com/cache/smarty/templates_c/%%F6^F60^F609237E%%_headerModuleList.tpl.php on line 28PHP message: PHP Warning: Trying to access array offset on value of type null in /var/www/vhosts/domainname.com/domainname.com/cache/smarty/templates_c/%%F6^F60^F609237E%%_headerModuleList.tpl.php on line 28PHP message: PHP Warning: Undefined array key “moduleList” in /var/www/vhosts/domainname.com/domainname.com/cache/smarty/templates_c/%%F6^F60^F609237E%%_headerModuleList.tpl.php on line 28PHP message: PHP Warning: Trying to access array offset on value of type null in /var/www/vhosts/domainname.com/domainname.com/cache/smarty/templates_c/%%F6^F60^F609237E%%_headerModuleList.tpl.php on line 28PHP message: PHP Warning: Undefined array key “moduleList” in /var/www/vhosts/domainname.com/domainname.com/cache/smarty/templates_c/%%F6^F60^F609237E%%_headerModuleList.tpl.php on line 28PHP message: PHP Warning: Trying to access array offset on value of type null in /var/www/vhosts/domainname.com/domainname.com/cache/smarty/templates_c/%%F6^F60^F609237E%%_headerModuleList.tpl.php on line 28PHP message: PHP Warning: Undefined array key “moduleList” in /var/www/vhosts/domainname.com/domainname.com/cache/smarty/templates_c/%%F6^F60^F609237E%%_headerModuleList.tpl.php on line 28PHP message: PHP Warning: Trying to access array offset on value of type null in /var/www/vhosts/domainname.com/domainname.com/cache/smarty/templates_c/%%F6^F60^F609237E%%_headerModuleList.tpl.php on line 28PHP message: PHP Warning: Undefined array key “moduleList” in /var/www/vhosts/domainname.com/domainname.com/cache/smarty/templates_c/%%F6^F60^F609237E%%_headerModuleList.tpl.php on line 28PHP message: PHP Warning: Trying to access array offset on value of type null in /var/www/vhosts/domainname.com/domainname.com/cache/smarty/templates_c/%%F6^F60^F609237E%%_headerModuleList.tpl.php on line 28PHP message: PHP Warning: Undefined array key “moduleList” in /var/www/vhosts/domainname.com/domainname.com/cache/smarty/templates_c/%%F6^F60^F609237E%%_headerModuleList.tpl.php on line 28PHP message: PHP Warning: Trying to access array offset on value of type null in /var/www/vhosts/domainname.com/domainname.com/cache/smarty/templates_c/%%F6^F60^F609237E%%_headerModuleList.tpl.php on line 28PHP message: PHP Warning: Undefined array key “Administration” in /var/www/vhosts/domainname.com/domainname.com/cache/smarty/templates_c/%%F6^F60^F609237E%%_headerModuleList.tpl.php on line 72PHP message: PHP Warning: Undefined array key “Administration” in /var/www/vhosts/domainname.com/domainname.com/cache/smarty/templates_c/%%F6^F60^F609237E%%_headerModuleList.tpl.php on line 215PHP message: PHP Warning: Undefined array key “LBL_SEARCH_BUTTON” in /var/www/vhosts/domainname.com/domainname.com/cache/smarty/templates_c/%%F6^F60^F609237E%%_headerModuleList.tpl.php on line 662PHP message: PHP Fatal error: Uncaught Error: Call to undefined function opcache_get_status() in /var/www/vhosts/domainname.com/domainname.com/include/SugarCache/SugarCache.php:168\nStack trace:\n#0 /var/www/vhosts/domainname.com/domainname.com/include/utils/sugar_file_utils.php(236): SugarCache::cleanFile()\n#1 /var/www/vhosts/domainname.com/domainname.com/include/SugarObjects/VardefManager.php(190): sugar_file_put_contents_atomic()\n#2 /var/www/vhosts/domainname.com/domainname.com/include/SugarObjects/VardefManager.php(303): VardefManager::saveCache()\n#3 /var/www/vhosts/domainname.com/domainname.com/modules/DynamicFields/DynamicField.php(243): VardefManager::refreshVardefs()\n#4 /var/www/vhosts/domainname.com/domainname.com/modules/DynamicFields/DynamicField.php(196): DynamicField->saveToVardef()\n#5 /var/www/vhosts/domainname.com/domainname.com/modules/DynamicFields/DynamicField.php(110): DynamicField->buildCache()\n#6 /var/www/vhosts/domainname.com/domainname.com/data/SugarBean.php(527): DynamicField->setup…’, referer: https://domainname.com/index.php?action=ajaxui

any idea how to fix this? I can´t find an solutions here…

THX
Stefan

Focus on the FATAL. It’s probably something missing in your php.ini, or in the PHP installed modules.

Basically, for your PHP upgrade to be complete, you need to get the installed modules and configuration right.

thanks for the answer, the Server is running on Plesk and I only switched from 7.x to 8.0.x - so the Settings an Modules are 1:1 the same as before under 7.x

I checked this right now

Any Idea?

I would still investigate the same thing, because the problem seems to be there, and I don’t know if the Plesk UI is handling things correctly. If you can nail down the root cause of the issue you might be able to fix it, or it least be able to make your case to the people running the server, that something needs to be fixed…

Thank you for the reply and hint.

I play a little bit with the opcache Settins in Plesk (without touching php.ini).

opcache.enable = off (didn´t work alone),
remove the “disable_functions” string (per default “opcache_get_status” on Plesk) works

So I enabled opcache again and it still works.

So you only have to remove the “opcache_get_status” string and it will work.

btw, the errors still exists in log (also in Php 7.x.x, I checked this before)

Now I´ll test if it works stable.

Thank you much and merry Christmas :slight_smile:

Stefan

1 Like

Unfortunately, I rejoiced too soon.

At first glance, SuiteCRM seemed to work with PHP 8.0.

but in operation there are still errors.

For example, printing PDFs no longer works (we have to use the old tcpdf because of layou issues) and there is also an error when saving data records.

Got error

PHP Fatal error: Uncaught TypeError: Unsupported operand types: string + int in path/include/database/DBManager.php:3093
Stack trace:
#0 path/include/database/DBManager.php(3137): DBManager->getDataChanges()
#1 path/data/SugarBean.php(6296): DBManager->getAuditDataChanges()
#2 path/data/SugarBean.php(2428): SugarBean->auditBean()
#3 path/include/SugarObjects/templates/company/Company.php(105): SugarBean->save()
#4 path/modules/Accounts/AccountFormBase.php(510): Company->save()
#5 path/modules/Accounts/Save.php(55): AccountFormBase->handleSave()
#6 path/include/MVC/View/SugarView.php(824): include_once('...')
#7 /path/...', referer: https://domain.com/index.php

Can you please try changing these two lines

to this:

    $numerator = abs(2 * ((int)trim($before_value) - (int)trim($after_value)));
    $denominator = abs((int)trim($before_value) + (int)trim($after_value));   

I hope I didn’t mess up the number of parentheses… (this moment make me recall my LISP project in University…)

Tell me if it works to solve that FATAL

Hi,

perfect. This fixed the FATAL Error.

Do you have any fix for the PDF Print Problem?

2023-01-04 15:37:09 Error 500 POST /crm/index.php?entryPoint=generatePdf HTTP/1.0 https://domain.com/s2g-crm/index.php?action=ajaxui Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/108.0.0.0 Safari/537.36 Edg/108.0.1462.54 923 Apache SSL/TLS access
2023-01-04 15:37:10 Error AH01071: Got error ‘PHP message: PHP Fatal error: Array and string offset access syntax with curly braces is no longer supported in /crm/modules/AOS_PDF_Templates/PDF_Lib/mpdf.php on line 2138’, referer: https://domain.com/crm/index.php?action=ajaxui

That file no longer exists in the latest SuiteCRM versions, mPDF was deprecated. I guess one of the reasons for the deprecation could be that it is no longer maintained? Then it would likely fail with PHP 8.0.

However these PHP 8.0 FATALs are often quite simple to solve, just simple syntax fixes (just Google that error message online to see how to fix).

OK, I´ll try to solve the PDF Problem or have to switch to the newest Version.

And thank you for your great help!!

1 Like

Hi,

with Version 7.13.4 the error comes back - in DBManager.php the lines 3094-3095 are set back to the “old buggy” code…

If you made the changes directly in core code, then it’s natural that they are not upgrade-safe… the upgrade you made changed the file back to how it was.

What this really needs is for somebody to open a pull request on GitHub! I’m on vacation right now, I won’t do it, but it’s so easy that even somebody without much technical knowledge could do it.

Hi,

enjoy your vacation!

It is already clear to me that self-made changes that do not flow into the code can be overwritten during an update.

However, there are now some comments at exactly this line, so it looks like this place has already been taken care of. However probably not correctly.

Thanks!

In that case I suggest trying to find the PR where that happened, and leaving a comment there…