Upgrade to v7.14.2 causes PHP Fatal error

Greetings,

Upgrading to v 7.14.2 showed failure of our custom code (from the Apache error.log):

— PHP Fatal error: Uncaught TypeError: Cannot access offset of type string on string in …\V7.14.2\modules\SavedSearch\SavedSearch.php:488 Stack trace:
…V7.14.2\data\SugarBean.php(5228): SavedSearch->fill_in_additional_list_fields()
…V7.14.2\data\SugarBean.php(5185): SugarBean->process_full_list_query(’ SELECT saved_…', true)
…V7.14.2\modules\someCustomAddOn\customOne.php(28): SugarBean->get_full_list(‘saved_search.na…’, ‘saved_search.se…’, true)

The code below caused no errors in prior to the PHP 8.1 upgrade (required for v7.14.2)
$sq = BeanFactory::newBean(‘SavedSearch’);
$sched=‘.schedule.’;
$where = “saved_search.search_module = ‘someCustomAddOn’ and saved_search.name<>‘$sched’”;
$q_list = $sq->get_full_list(“saved_search.name”, $where,true); ← line 28 causes the error

The PHP 8 error “Cannot access offset of type string on string in…” has been reported in upgrades of other software unrelated to SuiteCRM.
Perhaps this has been seen/resolved by some development team?

Check what’s new in PHP 8

https://www.php.net/manual/en/migration80.php

One hack is to run the upgrade on PHP 7.4, then once the upgrade is completed without any fatal error, switch to having Suite use PHP 8.1.

1 Like

Upgrading to 7.14.2 of SuiteCRM checks if PHP 8.1 is installed, regrettably.

Have no control of the [SavedSearch] SugarBean.php causing the error, since it is integral part of the SuiterCRM framework.

The problem here is that in PHP 7, this code error used to throw a ‘Warning’ and continue running, but now in PHP 8, it’s a fatal error (crash) and it stops. Don’t worry, it’s an illegal string offset error, it’s probably a pretty easy fix! To fix it in your custom code, make sure you’re not sending a parameter that will cause this illegal string offset error! At some point soon, they’ll fix it in the framework, to not crash when an illegal string offset parameter comes in!

@chris001 I just did this upgrade with these results:

7.12.14 → 7.14.2 Results…

Start PHP 8.1 —no go
Start PHP 8.0 --no go
Start PHP 7.4 — Works and you can login and everything still works, then switch to PHP 8.1 So far so good!

(addition: I think I might have started my last upgrade on PHP 8.0, when I got the white screen I switched to 7.4 and then did the rest of the upgrade in 7.4. I didn’t get any PHP version errors so maybe this is a way of bypassing).

Hey @paperless just did the upgrade. Reviewing it in my head now, I think I tried first on PHP 8.0 then when I got the blank screen, I changed the PHP version back to 7.4 refreshed the upgrade wizard and it worked, finished the upgrade and then switched to 8.1.

@paperless Which Suite version are you upgrading From?

Trying to upgrade from 7.12.1 to 7.14.2 to no avail and ended with a fresh install of 7.14.2.
Also made progress with changes to httpd.conf to accommodate php 8.1 and references to BeanFactory::newBean(‘SavedSearch’) in our code. So far so good until the next hiccup.
Thanks for your inputs.