-
Notifications
You must be signed in to change notification settings - Fork 22
Description
When I try to view any article, I receive the following message:
"Warning: Trying to access array offset on value of type null in \plugins\attachments\framework\src\PlgAttachmentsFramework.php on line 966"
Environment:
- Joomla 5.2.3 with PHP 8.2.
- Attachments 4.1.0.
The line 966 in PlgAttachmentsFramework.php:
$attachments_list = $controller->displayString($parent_id, $this->parent_type, $parent_entity, null, true, true, false, $from, $attachment_id[$i] );
In an article without any attachments, the variable $attachment_id is null and $attachment_id[$i] cause this warning, because it isn't an array. This is source of this issue.
The proposal solution is modify the line 917 in \plugins\attachments\framework\src\PlgAttachmentsFramework.php
$attachment_id = null;
for this one:
$attachment_id [] = null;
After applying this change, the warning disappears.