1. Error in PHP 7.4: Illegal offset type in isset or empty. See Figure 1.

JSON
{
"errors": [
{
"debugMessage": "Illegal offset type in isset or empty",
"message": "Internal server error",
"extensions": {
"category": "internal"
},
"locations": [
{
"line": 3,
"column": 5
}
],
"path": [
"onlineStore",
"theme"
],
"trace": []
}
],
"data": {
"onlineStore": {
"theme": null,
"__typename": "OnlineStore"
},
"__typename": "Query"
}
}
2. The code is as follows:
PHP
if (isset($setting['settingId']) && isset($currentSettings[$setting['settingId']])) {
$setting = $setting + [
'value' => $currentSettings[$setting['settingId']],
];
}
3. Print $setting; its value is an object. See Figure 2.

Plaintext
Array
(
[info] => Carousel title, module title, product title, etc.
[label] =>
[type] => HEADER
[default] =>
[content] => Title
[id] => Modules\OnlineStoreThemeGraphQL\Resolver\Id Object
(
[prefixes:protected] => Array
(
[0] => 96b1c8b9-5b18-4760-9e26-50ab009ac011
[1] => settings
[2] => 0
)
)
[__typename] => ThemeSettingHeader
[settingId] => Modules\OnlineStoreThemeGraphQL\Resolver\Id Object
(
[prefixes:protected] => Array
(
[0] => 96b1c8b9-5b18-4760-9e26-50ab009ac011
[1] => settings
[2] => 0
)
)
)
4. Convert $setting[‘settingId’] to a string.
PHP
$settingId = isset($setting['settingId']) ? (string) $setting['settingId'] : null;
// 获取当前设置值
if (isset($settingId) && isset($currentSettings[$settingId])) {
$setting = $setting + [
'value' => $currentSettings[$setting['settingId']],
];
}
5. The converted string value is printed as follows:
Plaintext
96b1c8b9-5b18-4760-9e26-50ab009ac011/settings/0
6. No more errors.
