[OJS 3.3.0.8] mergeUsers.php ends with error

Hi PKP team I have a issue with the OJS 3.3.0.8 version, I have executed the command line script mergerUsers.php to clean my OJS from spam users. I have my list of usernames which I suspect them as spam accounts. However some of these can’t be merged, the script gave the following error message:

[desarrollo@oa revistas_unam_ojs3308]$ php tools/mergeUsers.php publicaciones aprofesorps

PHP Fatal error:  Uncaught Error: Call to a member function getUsername() on null in /var/www/html/revistas_unam_ojs3308/lib/pkp/classes/services/PKPSubmissionFileService.inc.php:478
Stack trace:
#0 /var/www/html/revistas_unam_ojs3308/lib/pkp/classes/user/PKPUserAction.inc.php(36): PKP\Services\PKPSubmissionFileService->edit()
#1 /var/www/html/revistas_unam_ojs3308/classes/user/UserAction.inc.php(24): PKPUserAction->mergeUsers()
#2 /var/www/html/revistas_unam_ojs3308/lib/pkp/classes/cliTool/MergeUsersTool.inc.php(95): UserAction->mergeUsers()
#3 /var/www/html/revistas_unam_ojs3308/tools/mergeUsers.php(21): MergeUsersTool->execute()
#4 {main}
  thrown in /var/www/html/revistas_unam_ojs3308/lib/pkp/classes/services/PKPSubmissionFileService.inc.php on line 478

The environment is:

PHP 7.4.32
MySQL Ver 8.0.31
OJS 3.3.0.8

How can I resolve this error and accomplish correctly the merge of these spam users? Thanks for your help.

Hi @juancure

This issue seems to be related to a data error. Could you please run the SQL query from this thread and check whether something is returned?

Best,
Israel

Hi @israel.cefrin thanks for answering. I have run the query from the thread you mentioned.

SELECT sf.submission_file_id FROM submission_files sf LEFT JOIN notes n ON (sf.assoc_id = n.note_id) WHERE sf.assoc_type = 520 AND n.note_id IS NULL;

And this returned 11 rows, so I have proceeded to remove them. However the problem persisted. I have turn on the database debug output

debug = On

and after execute the mergeUser script I have seen that the proccess stopped in the following lines:

SELECT * FROM sessions WHERE session_id = ?
["6i1qslu0u6egi6rh7ogont2nmr"]
Database query
INSERT INTO sessions
				(session_id, ip_address, user_agent, created, last_used, remember, data, domain)
				VALUES
				(?, ?, ?, ?, ?, ?, ?, ?)
["6i1qslu0u6egi6rh7ogont2nmr","","",1670982816,1670982816,0,"",""]
PHP Fatal error:  Uncaught Error: Call to a member function getUsername() on null in /var/www/html/revistas_unam_ojs3308/lib/pkp/classes/services/PKPSubmissionFileService.inc.php:478
Stack trace:
#0 /var/www/html/revistas_unam_ojs3308/lib/pkp/classes/user/PKPUserAction.inc.php(36): PKP\Services\PKPSubmissionFileService->edit()
#1 /var/www/html/revistas_unam_ojs3308/classes/user/UserAction.inc.php(24): PKPUserAction->mergeUsers()
#2 /var/www/html/revistas_unam_ojs3308/lib/pkp/classes/cliTool/MergeUsersTool.inc.php(95): UserAction->mergeUsers()
#3 /var/www/html/revistas_unam_ojs3308/tools/mergeUsers.php(21): MergeUsersTool->execute()
#4 {main}
  thrown in /var/www/html/revistas_unam_ojs3308/lib/pkp/classes/services/PKPSubmissionFileService.inc.php on line 478
Database query
UPDATE sessions
				SET
					user_id = ?,
					ip_address = ?,
					user_agent = ?,
					created = ?,
					last_used = ?,
					remember = ?,
					data = ?,
					domain = ?
				WHERE session_id = ?
[null,"","",1670982816,1670982816,0,"","","6i1qslu0u6egi6rh7ogont2nmr"]

I think that it’s important to mention one of the users, who I try to merge into, in the first try couldn’t be merged until the second try, but this doesn’t happen always.

Well I hope with this information someone could help me, thanks in advance.
Best regards.

Hi @juancure

Could you please check whether this patch manages your issue:

Best,
Israel

1 Like