Page 1 of 1

(solved) Trying to access array offset of type bool in ext/pgreca/pgsocial/event/listener.php

Posted: August 1st, 2023, 5:24 pm
by Mandi
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:

Code: Select all

if ($friends['status'] == 'PG_SOCIAL_FRIENDS' || $user_id == (int) $this->user->data['user_id'])
Replace with this:

Code: Select all

if ($friends['status'] ?? 'default value' == 'PG_SOCIAL_FRIENDS' || $user_id == (int) $this->user->data['user_id'])
Locate line 332 which looks like this:

Code: Select all

'PROFILE_FRIEND_ACTION'		=> $friends['status'],
Replace with this:

Code: Select all

'PROFILE_FRIEND_ACTION'		=> $friends['status'] ?? null,
Locate line 333 which looks like this:

Code: Select all

'PROFILE_FRIEND_ACT_ICON'	=> $friends['icon'],
Replace with this:

Code: Select all

'PROFILE_FRIEND_ACT_ICON'	=> $friends['icon'] ?? null,
Locate line 352 which looks like this:

Code: Select all

'GALLERY_NAME'				=> $this->social_photo->gallery_info($this->request->variable('gall', ''), $gallumb)['gallery_name'],
Replace with this:

Code: Select all

'GALLERY_NAME'				=> $this->social_photo->gallery_info($this->request->variable('gall', ''), $gallumb)['gallery_name'] ?? null,
Locate line 354 which looks like this:

Code: Select all

'GALLERY_PRIVACY'			=> $this->social_photo->gallery_info($this->request->variable('gall', ''), $gallumb)['gallery_privacy'],
Replace with this:

Code: Select all

'GALLERY_PRIVACY'			=> $this->social_photo->gallery_info($this->request->variable('gall', ''), $gallumb)['gallery_privacy'] ?? null,