Page 1 of 1

(solved) Trying to access array offset on value of type bool in ext/pgreca/pgsocial/social/social_zebra.php

Posted: August 1st, 2023, 9:21 pm
by Mandi
Noticed these errors when on the main index page when not signed in (ie Guest):

[phpBB Debug] PHP Warning: in file [ROOT]/ext/pgreca/pgsocial/social/social_zebra.php on line 125: Trying to access array offset on value of type bool
[phpBB Debug] PHP Warning: in file [ROOT]/ext/pgreca/pgsocial/social/social_zebra.php on line 135: Trying to access array offset on value of type bool
[phpBB Debug] PHP Warning: in file [ROOT]/ext/pgreca/pgsocial/social/social_zebra.php on line 135: Trying to access array offset on value of type bool
[phpBB Debug] PHP Warning: in file [ROOT]/ext/pgreca/pgsocial/social/social_zebra.php on line 135: Trying to access array offset on value of type bool
[phpBB Debug] PHP Warning: in file [ROOT]/ext/pgreca/pgsocial/social/social_zebra.php on line 136: Trying to access array offset on value of type bool
[phpBB Debug] PHP Warning: in file [ROOT]/ext/pgreca/pgsocial/social/social_zebra.php on line 136: Trying to access array offset on value of type bool
[phpBB Debug] PHP Warning: in file [ROOT]/ext/pgreca/pgsocial/social/social_zebra.php on line 136: Trying to access array offset on value of type bool
[phpBB Debug] PHP Warning: in file [ROOT]/ext/pgreca/pgsocial/social/social_zebra.php on line 137: Trying to access array offset on value of type bool

Re: Trying to access array offset on value of type bool in ext/pgreca/pgsocial/social/social_zebra.php

Posted: August 1st, 2023, 9:27 pm
by Mandi
Locate line 125 which looks like this:

Code: Select all

if (($row['user_id'] == $user_id) && ($row['zebra_id'] == $this->user->data['user_id']) && ($row['approval'] == 1))
Replace with this:

Code: Select all

if (($row['user_id'] ?? 'default value' == $user_id) && ($row['zebra_id'] == $this->user->data['user_id']) && ($row['approval'] == 1))
Locate line 135 which looks like this:

Code: Select all

'status'	=> ($row['friend'] ? 'PG_SOCIAL_FRIENDS' : ($row['approval'] ? 'PG_SOCIAL_FRIENDS_CANCEL_REQ' : ($row['foe'] ? 'PG_SOCIAL_FRIENDS_REMOVE_BLOCK' : 'PG_SOCIAL_FRIENDS_ADD'))),
Replace with this:

Code: Select all

'status'	=> ($row['friend'] ?? null ? 'PG_SOCIAL_FRIENDS' : ($row['approval'] ?? null ? 'PG_SOCIAL_FRIENDS_CANCEL_REQ' : ($row['foe'] ?? null ? 'PG_SOCIAL_FRIENDS_REMOVE_BLOCK' : 'PG_SOCIAL_FRIENDS_ADD'))),
Locate line 136 which looks like this:

Code: Select all

'icon'		=> ($row['friend'] ? 'ok' : ($row['approval'] ? 'remove' : ($row['foe'] ? 'ban-circle' : 'plus'))),
Replace with this:

Code: Select all

'icon'		=> ($row['friend'] ?? null ? 'ok' : ($row['approval'] ?? null ? 'remove' : ($row['foe'] ?? null ? 'ban-circle' : 'plus'))),
Locate line 137 which looks like this:

Code: Select all

'friends'	=> $row['friend'] ? true : false,
Replace with this:

Code: Select all

'friends'	=> $row['friend'] ?? null ? true : false,