(solved) Trying to access array offset of type bool in ext/pgreca/pgsocial/event/listener.php
Posted: August 1st, 2023, 5:24 pm
Upon first installing this extension, I was greeted with a PHP Warning of trying to access array offset of type bool in the file located at /ext/pgreca/pgsocial/event/listener.php on lines 316, 332, 333, 352, 354
The following changes corrected that issue:
Locate line 316 which looks like this:
Replace with this:
Locate line 332 which looks like this:
Replace with this:
Locate line 333 which looks like this:
Replace with this:
Locate line 352 which looks like this:
Replace with this:
Locate line 354 which looks like this:
Replace with this:
The following changes corrected that issue:
Locate line 316 which looks like this:
Code: Select all
if ($friends['status'] == 'PG_SOCIAL_FRIENDS' || $user_id == (int) $this->user->data['user_id'])Code: Select all
if ($friends['status'] ?? 'default value' == 'PG_SOCIAL_FRIENDS' || $user_id == (int) $this->user->data['user_id'])Code: Select all
'PROFILE_FRIEND_ACTION' => $friends['status'],Code: Select all
'PROFILE_FRIEND_ACTION' => $friends['status'] ?? null,Code: Select all
'PROFILE_FRIEND_ACT_ICON' => $friends['icon'],Code: Select all
'PROFILE_FRIEND_ACT_ICON' => $friends['icon'] ?? null,Code: Select all
'GALLERY_NAME' => $this->social_photo->gallery_info($this->request->variable('gall', ''), $gallumb)['gallery_name'],Code: Select all
'GALLERY_NAME' => $this->social_photo->gallery_info($this->request->variable('gall', ''), $gallumb)['gallery_name'] ?? null,Code: Select all
'GALLERY_PRIVACY' => $this->social_photo->gallery_info($this->request->variable('gall', ''), $gallumb)['gallery_privacy'],Code: Select all
'GALLERY_PRIVACY' => $this->social_photo->gallery_info($this->request->variable('gall', ''), $gallumb)['gallery_privacy'] ?? null,