Open st-anton opened 2 years ago
Here's what I did to fix that PHP warning:
Change \plugins\attachments\attachments_for_content\attachments_for_content.php on lines 826-828:
// See if the options apply to this article
$created_by = (int) $attachments[0]->created_by;
$catid = (int) $attachments[0]->catid;
This this:
// See if the options apply to this article
// (Revised for PHP7)
if(is_object($attachments))
{
$created_by = (int) $attachments[0]->created_by;
$catid = (int) $attachments[0]->catid;
}
else
{
$created_by = false;
$catid = false;
}
please use last version available for Joomla 4.x Joomla 5.x https://github.com/jmcameron/attachments/releases/tag/v4.0.1
On some pages (I don't know the reason), there are warnings in the page on top of the content: `Warning: Undefined array key 0 in \plugins\attachments\attachments_for_content\attachments_for_content.php on line 827
Warning: Attempt to read property "created_by" on null in \plugins\attachments\attachments_for_content\attachments_for_content.php on line 827
Warning: Undefined array key 0 in \plugins\attachments\attachments_for_content\attachments_for_content.php on line 828
Warning: Attempt to read property "catid" on null in \plugins\attachments\attachments_for_content\attachments_for_content.php on line 828`