PHP Warning: Undefined array key “type” in sib-api-manager.php on line 87
-
Hi there,
We are encountering a number of PHP warnings on our site. Here’s the warning message:
PHP Warning: Undefined array key "type" in .../plugins/mailin/inc/sib-api-manager.php on line 87It seems to originate from the following code block:
if (!empty($attributes) && count($attributes) > 0) {
foreach ($attributes as $key => $value) {
if ($value["type"] == "multiple-choice") {
$attrs['attributes']['multiple_choice_attributes'][] = $value;
} elseif ($value["category"] == "normal") {
$attrs['attributes']['normal_attributes'][] = $value;
} elseif ($value["category"] == "category") {
$value["type"] = "category";
$attrs['attributes']['category_attributes'][] = $value;
}
}
}The issue occurs when $value[“type”] is accessed without checking if the key “type” exists (PHP8->). This could be prevented by checking the key, for example:
if (isset($value["type"]) && $value["type"] == "multiple-choice")Maybe it would be good to check if the category can have the same issue too.
Best,
-Valtteri
The topic ‘PHP Warning: Undefined array key “type” in sib-api-manager.php on line 87’ is closed to new replies.