Issue when loading user notifications to a specific user

Hi everyone,

My OJS 3.3.0.10 installation has an issue that a specific user (editor role) can not load notifications, from bell button.

The following error is send to php error_log:

PHP Fatal error:  Uncaught Error: Call to a member function getFullName() on null in /lib/pkp/classes/notification/managerDelegate/QueryNotificationManager.inc.php:58
Stack trace:
#0 /lib/pkp/classes/notification/PKPNotificationManager.inc.php(418): QueryNotificationManager->getNotificationMessage(Object(Request), Object(Notification))
#1 /lib/pkp/classes/notification/PKPNotificationManager.inc.php(164): PKPNotificationManager->getByDelegate(16777249, 1048586, 24205, 'getNotification...', Array)
#2 /classes/notification/NotificationManager.inc.php(80): PKPNotificationManager->getNotificationMessage(Object(Request), Object(Notification))
#3 /lib/pkp/controllers/grid/notifications/NotificationsGridCellProvider.inc.php(45): NotificationManager->getNotificationMessage(Object(Request), Object(Notification))
#4 /lib/pkp/classe in /lib/pkp/classes/notification/managerDelegate/QueryNotificationManager.inc.php on line 58

Browser error console print an error too:

(https://domain.com/index.php/journal/$$$call$$$/grid/notifications/task-notifications-grid/fetch-grid?_=1661434969208)

I guessed that could be any issue with user name, but I tried differents values and nothing changed. The admin user has 202 active notifications and loads correctly. This issue seems to happen specifically with this user.

Beyond that, php error log has several warnings like these:

PHP Warning:  Cannot assign an empty string to a string offset in /lib/pkp/classes/core/DataObject.inc.php on line 133
PHP Warning:  Illegal string offset 'es_ES' in /lib/pkp/classes/core/DataObject.inc.php on line 133
PHP Warning:  Cannot assign an empty string to a string offset in /lib/pkp/classes/core/DataObject.inc.php on line 133
PHP Warning:  Illegal string offset 'fr_CA' in /lib/pkp/classes/core/DataObject.inc.php on line 133
PHP Warning:  Cannot assign an empty string to a string offset in /lib/pkp/classes/core/DataObject.inc.php on line 133
PHP Warning:  Illegal string offset 'pt_BR' in /lib/pkp/classes/core/DataObject.inc.php on line 133

I don’t know if logs is related one to another.

How can I solve this notification issue? Is the error log enough to find a solution?

Thanks to anyone who could help me.

Hi @geniusdesign

It sounds like there’s a Notification in the database that has a user_id that does not point to a valid user any more. Line 58 in that file means that it’s part of a _QUERY notification, so there was perhaps a note created that was cancelled out of. I suggest looking through the notifications table to see if there are notifications that have invalid ids.

For the time being, you can get the notifications to load for the user by adjusting line 58 of that file to include:

$user ? $user->getFullName() : ''

instead of just returning the name. That’ll prevent the getFullName method from being called on a null object which is what is happening.

Best
Jason