[OJS 3.2.1-1 with Postgres 7] PHP Fatal error: Uncaught Error: Call to a member function getData() and getJournalId()

Hi,
the system has been showing some errors since version 3.2.0, so I keep updating to see if it corrects, but it is not yet correcting.
In the httpd log it looks like this:

 PHP Fatal error:  Uncaught Error: Call to a member function getData() on null in /var/www/ojs-3.2.1-1/pages/search/SearchHandler.inc.php:216\nStack trace:\n#0 [internal function]: SearchHandler->{closure}(NULL)\n#1 /var/www/ojs-3.2.1-1/pages/search/SearchHandler.inc.php(217): array_map(Object(Closure), Array)\n#2 /var/www/ojs-3.2.1-1/lib/pkp/classes/core/PKPRouter.inc.php(391): SearchHandler->authors(Array, Object(Request))\n#3 /var/www/ojs-3.2.1-1/lib/pkp/classes/core/PKPPageRouter.inc.php(231): PKPRouter->_authorizeInitializeAndCallRequest(Array, Object(Request), Array, false)\n#4 /var/www/ojs-3.2.1-1/lib/pkp/classes/core/Dispatcher.inc.php(143): PKPPageRouter->route(Object(Request))\n#5 /var/www/ojs-3.2.1-1/lib/pkp/classes/core/PKPApplication.inc.php(279): Dispatcher->dispatch(Object(Request))\n#6 /var/www/ojs-3.2.1-1/index.php(68): PKPApplication->execute()\n#7 {main}\n  thrown in /var/www/ojs-3.2.1-1/pages/search/SearchHandler.inc.php on line 216
PHP Fatal error:  Uncaught Error: Call to a member function getJournalId() on null in /var/www/ojs-3.2.1-1/classes/issue/IssueAction.inc.php:31\nStack trace:\n#0 /var/www/ojs-3.2.1-1/pages/search/SearchHandler.inc.php(246): IssueAction->subscriptionRequired(NULL, Object(Journal))\n#1 /var/www/ojs-3.2.1-1/lib/pkp/classes/core/PKPRouter.inc.php(391): SearchHandler->authors(Array, Object(Request))\n#2 /var/www/ojs-3.2.1-1/lib/pkp/classes/core/PKPPageRouter.inc.php(231): PKPRouter->_authorizeInitializeAndCallRequest(Array, Object(Request), Array, false)\n#3 /var/www/ojs-3.2.1-1/lib/pkp/classes/core/Dispatcher.inc.php(143): PKPPageRouter->route(Object(Request))\n#4 /var/www/ojs-3.2.1-1/lib/pkp/classes/core/PKPApplication.inc.php(279): Dispatcher->dispatch(Object(Request))\n#5 /var/www/ojs-3.2.1-1/index.php(68): PKPApplication->execute()\n#6 {main}\n  thrown in /var/www/ojs-3.2.1-1/classes/issue/IssueAction.inc.php on line 31

What could it be?

There error messages suggest either inconsistent or unexpected data, particularly in the relationship of an Author to a Publication and in an Article/Submission to an Issue.

In the first case, the Author service tries to lookup the publication for each author, but in at least one case, the Publication service doesn’t return data for a publication_id presented by an Author:

In the second case, the Article returns an issue_id, but the IssueDAO fails to return an issue with that identifier:

Are you aware of any orphaned authors or articles, where the related submission or issue may have been deleted?

Are you able to use SQL to directly query Postgres? We might be able to provide an SQL query to find the unexpected data.

1 Like

Hi, I’m sorry,
only now that I saw that answer.
I’m able to use SQL. Could you provide me with this SQL query?

I don’t know if it is related to this problem, but some journals, when we try to use the Crossref plugin, the screen is just loading, in other journals, the plugin works correctly

The error that appears is:

[Thu Oct 08 16:16:10.543782 2020] [php7:error] [pid 4699] [client 172.20.7.116:61012] PHP Fatal error:  Uncaught Error: Call to a member function getId() on null in /var/www/ojs-3.2.1-1/controllers/grid/submissions/ExportPublishedSubmissionsListGridCellProvider.inc.php:77\nStack trace:\n#0 /var/www/ojs-3.2.1-1/lib/pkp/classes/controllers/grid/GridCellProvider.inc.php(56): ExportPublishedSubmissionsListGridCellProvider->getCellActions(Object(Request), Object(GridRow), Object(GridColumn))\n#1 /var/www/ojs-3.2.1-1/lib/pkp/classes/controllers/grid/GridHandler.inc.php(1104): GridCellProvider->render(Object(Request), Object(GridRow), Object(GridColumn))\n#2 /var/www/ojs-3.2.1-1/lib/pkp/classes/controllers/grid/GridHandler.inc.php(1011): GridHandler->_renderCellInternally(Object(Request), Object(GridRow), Object(GridColumn))\n#3 /var/www/ojs-3.2.1-1/lib/pkp/classes/controllers/grid/GridHandler.inc.php(988): GridHandler->renderRowInternally(Object(Request), Object(GridRow))\n#4 /var/www/ojs-3.2.1-1/lib/pkp/classes/controllers/grid/GridHandler.inc.php(1033): GridHandler->renderRowsInternally(Object(Request), Array)\n#5 /var/ww in /var/www/ojs-3.2.1-1/controllers/grid/submissions/ExportPublishedSubmissionsListGridCellProvider.inc.php on line 77, referer: https://periodicos.ufes.br/almanaque/management/importexport/plugin/CrossRefExportPlugin

Should I open another topic for this problem?
image

Can you try:

SELECT * FROM authors LEFT JOIN submissions ON (authors.submission_id = submissions.submission_id) WHERE submissions.submission_id IS NULL;

and

SELECT * FROM published_submissions LEFT JOIN issues ON (published_submissions.issue_id = issues.issue_id) WHERE issues.issue_id IS NULL;

This seems to be another instance of the case where a published submission does not have an issue associated with it. The second query above may identify these.

Does version 3.2.1.1 have published_submissions table? I can’t see such table in that version, it only exist in older version. I checked it in a fresh install. Am I missing something?

I also did not find published_submissions table. Would there be a corresponding table in this new version 3.2.1-1?

This sql returned 4663 records. Can I just delete these records?

In 3.2, the published_submissions table is removed in favor of the publications table and issue associations via publication_settings. The revised query would look something like:

SELECT * 
FROM publications JOIN publication_settings ON (publications.publication_id = publication_settings.publication_id AND publication_settings.setting_name = 'issueId')
LEFT JOIN issues ON (publication_settings.setting_value = issues.issue_id)
WHERE issues.issue_id IS NULL;
1 Like

Before deleting them, it would be helpful to get an idea of why you would have so many author records with no submission assigned. Note that this is not a list of users with an author role, but no submission. This is rather a list of authors where the submission was perhaps deleted. Any ideas on how these records came to exist?

Hi, thank you very much for your help.

I thought because we have been working with the same database since 2013, perhaps with the updates some old records may have remained. But today, I ran the sql again and increased it from 4663 to 4700 records.
Can I just delete these records without any problems?
What could be causing the number of authors to increase without submission?

@Adriano_Jose, do you see any patterns of interest in the query:

SELECT
  authors.author_id,
  authors.submission_id,
  authors.email,
  family.setting_value family_name,
  given.setting_value given_name
FROM 
  authors LEFT JOIN submissions ON (authors.submission_id = submissions.submission_id)
  LEFT JOIN author_settings family ON (family.author_id = authors.author_id AND family.setting_name = "familyName")
  LEFT JOIN author_settings given ON (given.author_id = authors.author_id AND given.setting_name = "givenName")
WHERE
  submissions.submission_id IS NULL;

?
Are the submission_id values present or blank?

@asmecher, @NateWr, any thoughts on what in OJS 3.2 might allow for new entries in the authors table, without a corresponding entry in the submissions table?

Hi @ctgraham/all,

In OJS 3.2.x, the authors.submission_id column is deprecated and shouldn’t be used. Instead, join authors to publications and from there to submissions:

SELECT s.submission_id FROM authors a
JOIN publications p ON (a.publication_id = p.publication_id)
JOIN submissions s ON (p.submission_id = s.submission_id);

This was changed to permit versioning of metadata that includes different author lists for each version of a submission’s metadata.

Regards,
Alec Smecher
Public Knowledge Project Team

@Adriano_Jose, this means the correct query to find records associated with your first error will be:

SELECT * 
FROM authors LEFT JOIN publications ON (authors.publication_id = publications.publication_id)
WHERE publications.publication_id IS NULL;

Hi, @ctgraham,
I ran this query and 30 records appeared. Look at the first ones.

Captura de Tela 2020-11-05 às 15.20.27

Can I delete all 30 author_id?
Do I have to delete it in some other table or just in the authors?

If you look at the associated submissions for these records, do they exist? Do you see the authors normally on those submissions?

You appear to have two distinct situations here, based on the first column publication_id (bigint):

  1. publication_id is null, but submission_id is present. This may just be a submission pending publication.
  2. publication_id and submission_id is present. This seems like the publication may have been deleted.

Can you tell from the editorial user interface what the current status for these submissions are?

Hi, @ctgraham,
thanks for your help.
Deleting the 30 records of the query you sent, this error is no longer showing.

 PHP Fatal error:  Uncaught Error: Call to a member function getData() on null in /var/www/ojs-3.2.1-1/pages/search/SearchHandler.inc.php:216\nStack trace:\n#0 [internal function]: SearchHandler->{closure}(NULL)\n#1 /var/www/ojs-3.2.1-1/pages/search/SearchHandler.inc.php(217): array_map(Object(Closure), Array)\n#2 /var/www/ojs-3.2.1-1/lib/pkp/classes/core/PKPRouter.inc.php(391): SearchHandler->authors(Array, Object(Request))\n#3 /var/www/ojs-3.2.1-1/lib/pkp/classes/core/PKPPageRouter.inc.php(231): PKPRouter->_authorizeInitializeAndCallRequest(Array, Object(Request), Array, false)\n#4 /var/www/ojs-3.2.1-1/lib/pkp/classes/core/Dispatcher.inc.php(143): PKPPageRouter->route(Object(Request))\n#5 /var/www/ojs-3.2.1-1/lib/pkp/classes/core/PKPApplication.inc.php(279): Dispatcher->dispatch(Object(Request))\n#6 /var/www/ojs-3.2.1-1/index.php(68): PKPApplication->execute()\n#7 {main}\n  thrown in /var/www/ojs-3.2.1-1/pages/search/SearchHandler.inc.php on line 216

I also upgraded to version 3.2.1-2 and now has the following errors:
this keeps showing up:

PHP Fatal error:  Uncaught Error: Call to a member function getJournalId() on null in /var/www/ojs-3.2.1-1/classes/issue/IssueAction.inc.php:31\nStack trace:\n#0 /var/www/ojs-3.2.1-1/pages/search/SearchHandler.inc.php(246): IssueAction->subscriptionRequired(NULL, Object(Journal))\n#1 /var/www/ojs-3.2.1-1/lib/pkp/classes/core/PKPRouter.inc.php(391): SearchHandler->authors(Array, Object(Request))\n#2 /var/www/ojs-3.2.1-1/lib/pkp/classes/core/PKPPageRouter.inc.php(231): PKPRouter->_authorizeInitializeAndCallRequest(Array, Object(Request), Array, false)\n#3 /var/www/ojs-3.2.1-1/lib/pkp/classes/core/Dispatcher.inc.php(143): PKPPageRouter->route(Object(Request))\n#4 /var/www/ojs-3.2.1-1/lib/pkp/classes/core/PKPApplication.inc.php(279): Dispatcher->dispatch(Object(Request))\n#5 /var/www/ojs-3.2.1-1/index.php(68): PKPApplication->execute()\n#6 {main}\n  thrown in /var/www/ojs-3.2.1-1/classes/issue/IssueAction.inc.php on line 31

and these three new ones:

 AH01276: Cannot serve directory /var/www/html/public/journals/22/: No matching DirectoryIndex (index.html,index.php) found, and server-generated directory index forbidden by Options directive, referer: https://periodicos.ufes.br/index.php/romanitas/article/view/18969
PHP Fatal error:  Maximum execution time of 120 seconds exceeded in /var/www/ojs-3.2.1-2/lib/pkp/lib/vendor/adodb/adodb-php/adodb.inc.php on line 1271
PHP Fatal error:  Uncaught InvalidArgumentException: Key may not be empty in /var/www/ojs-3.2.1-1/lib/pkp/lib/vendor/firebase/php-jwt/src/JWT.php:74\nStack trace:\n#0 /var/www/ojs-3.2.1-1/pages/article/ArticleHandler.inc.php(49): Firebase\\JWT\\JWT::decode(NULL, '', Array)\n#1 /var/www/ojs-3.2.1-1/lib/pkp/classes/core/PKPRouter.inc.php(383): ArticleHandler->authorize(Object(Request), Array, Array)\n#2 /var/www/ojs-3.2.1-1/lib/pkp/classes/core/PKPPageRouter.inc.php(231): PKPRouter->_authorizeInitializeAndCallRequest(Array, Object(Request), Array, false)\n#3 /var/www/ojs-3.2.1-1/lib/pkp/classes/core/Dispatcher.inc.php(143): PKPPageRouter->route(Object(Request))\n#4 /var/www/ojs-3.2.1-1/lib/pkp/classes/core/PKPApplication.inc.php(279): Dispatcher->dispatch(Object(Request))\n#5 /var/www/ojs-3.2.1-1/index.php(68): PKPApplication->execute()\n#6 {main}\n  thrown in /var/www/ojs-3.2.1-1/lib/pkp/lib/vendor/firebase/php-jwt/src/JWT.php on line 74

Could you please help me?

This suggests that there are still authors linked to publications which don’t exist.

This suggests that an article doesn’t have an issue to which it is assigned.

and

Seem to relate to invalid requests coming into the server; I would defer looking into these until other problems are resolved.

This indicates a long-running query, but there isn’t enough context in the error message to guess at what the query was.

If I were faced with this, my approach would be:

  • Review the last known working version of the site from backups. Reinstall from backup files onto a development or private server and note any known changes since that point. If needed and viable, revert to this backup.
  • Evaluate the specific authors, articles, and issues which are causing the problems. To do this, I would add debugging code into the PHP to print out the author and article and issue identifiers at the points where the errors are occurring. These articles could then be examined in the last known working backup to compare the data.

Hi @ctgraham,
Could you tell me better how to put this code, please? I don’t have enough knowledge for that.

Would sending some other sql that could show disconnected users be too difficult?

regards,
Adriano Moreno