HP warnings in plugins/system/sppagebuilder/sppagebuilder.php (lines 83/86) after latest update, getPageContentById() breaks popup lookup - Forum | JoomShaper
Solved SP Page Builder

HP warnings in plugins/system/sppagebuilder/sppagebuilder.php (lines 83/86) after latest update, getPageContentById() breaks popup lookup

Asked by jean luc trevilly 2 weeks ago Last activity 1 week ago

Hello,

After updating SP Page Builder to version [x.x.x] (Joomla 6.1.3, PHP 8.3, Helix Ultimate), the following warnings appear on our home page, which is an SP Page Builder page (com_sppagebuilder, view=page). They do not appear on standard Joomla article pages:

Warning: Object of class stdClass could not be converted to int in /plugins/system/sppagebuilder/sppagebuilder.php on line 83
Warning: Attempt to read property "id" on int in /plugins/system/sppagebuilder/sppagebuilder.php on line 86

The cause is in getPageContentById():

protected function getPageContentById($ids)
{
    $ids = array_map('intval', $ids ?? []);   // line 83
    $idArray = array_map(
        function ($item) {
            return $item->id;                  // line 86
        },
        $ids ?? []
    );

$ids contains objects, since the next closure reads $item->id. The new intval line converts each object to an integer first, so the closure then tries to read ->id on an int. As a result, $idArray ends up with null values, getPopupsByIds() queries for id 0, and no popup can ever be loaded through this method. We do not use popups ourselves, so the only visible effect for us is the warnings, but popups are presumably broken for anyone who does use them.

Suggested fix, which works whether $ids contains objects or plain ids:

$idArray = array_map(
    function ($item) {
        return (int) (is_object($item) ? $item->id : $item);
    },
    $ids ?? []
);

(removing the $ids = array_map('intval', ...) line)

Could you confirm and include a fix in the next release?

Thank you.

Accepted answer

Marked as the solution
Mehtaz Afsana Borsha Staff

Hello,

I have checked in with our development team, and they confirmed that this issue will be resolved in the upcoming update.

Thank you for your patience and for bringing this to our attention.

Best regards,

Mehtaz Afsana Borsha Staff

Thanks for accepting the answer.

1 more reply

Mehtaz Afsana Borsha Staff

Hello,

Thank you for bringing this to our attention, and we apologize for any inconvenience caused. I have forwarded the details to our development team for review, and they will look into resolving this issue.

Best regards,

Log in to reply.