Call to a member function getPublished() on null OJS 3.2.0-2

PHP 7.3 MySql 8.0.xx
IIS
@asmecher

I have checked the permissions, they are correct, even Everyone has modification access on the cache… I do not know what to do next…kindly help

[23-Apr-2020 14:35:10 Asia/Karachi] PHP Fatal error: Uncaught Error: Call to a member function getPublished() on null in E:\websites\ojs\journal\cache\t_compile\ad8495e4b9ac5b46519f7e408bb2c0f8a8ac0eb3^acf1fc671fe3149386beb488bd42d95154e9d6f3_0.app.frontendpagessearchAuthor.php:48
Stack trace:
#0 E:\websites\ojs\journal\lib\pkp\lib\vendor\smarty\smarty\libs\sysplugins\smarty_template_resource_base.php(123): content_5ea15b600f5cb5_39081421(Object(Smarty_Internal_Template))
#1 E:\websites\ojs\journal\lib\pkp\lib\vendor\smarty\smarty\libs\sysplugins\smarty_template_compiled.php(114): Smarty_Template_Resource_Base->getRenderedTemplateCode(Object(Smarty_Internal_Template))
#2 E:\websites\ojs\journal\lib\pkp\lib\vendor\smarty\smarty\libs\sysplugins\smarty_internal_template.php(216): Smarty_Template_Compiled->render(Object(Smarty_Internal_Template))
#3 E:\websites\ojs\journal\lib\pkp\lib\vendor\smarty\smarty\libs\sysplugins\smarty_internal_templatebase.php(232): Smarty_Internal_Template->render(false, 1)
#4 E:\websites\ojs\journal\lib\pkp\lib\vendor\smarty\smarty\libs\sysplugins\smarty_internal_templatebase.php(134): Smarty_Internal_TemplateBase->_execute(Object(Smarty_Internal_Template), NULL, ‘ad8495e4b9ac5b4…’, NULL, 1)
#5 E:\websites\ojs\journal\lib\pkp\classes\template\PKPTemplateManager.inc.php(905): Smarty_Internal_TemplateBase->display(‘frontend/pages/…’, NULL, ‘ad8495e4b9ac5b4…’, NULL)
#6 E:\websites\ojs\journal\pages\search\SearchHandler.inc.php(274): PKPTemplateManager->display(‘frontend/pages/…’)
#7 E:\websites\ojs\journal\lib\pkp\classes\core\PKPRouter.inc.php(391): SearchHandler->authors(Array, Object(Request))
#8 E:\websites\ojs\journal\lib\pkp\classes\core\PKPPageRouter.inc.php(231): PKPRouter->_authorizeInitializeAndCallRequest(Array, Object(Request), Array, false)
#9 E:\websites\ojs\journal\lib\pkp\classes\core\Dispatcher.inc.php(143): PKPPageRouter->route(Object(Request))
#10 E:\websites\ojs\journal\lib\pkp\classes\core\PKPApplication.inc.php(278): Dispatcher->dispatch(Object(Request))
#11 E:\websites\ojs\journal\index.php(68): PKPApplication->execute()
#12 {main}
thrown in E:\websites\ojs\journal\cache\t_compile\ad8495e4b9ac5b46519f7e408bb2c0f8a8ac0eb3^acf1fc671fe3149386beb488bd42d95154e9d6f3_0.app.frontendpagessearchAuthor.php on line 48
[23-Apr-2020 14:35:56 Asia/Karachi] ojs2: 404 Not Found

I have noticed that while searching some Authors this error appears there too. A sample is attached
image
It comes with some of the authors…
Hope it may be helpful in diagnosing the issue? @asmecher @Vitaliy

Hi @Farhan_Abbas,

Try applying either of the commits linked from SearchHandler::authors() can encounter fatal error with unpublished publications · Issue #5793 · pkp/pkp-lib · GitHub. (They’re both equivalent, just attached to different branches.)

Regards,
Alec Smecher
Public Knowledge Project Team

Thanks for your prompt reply but I do not understand what do you mean by applying the commit? Please let me know do I have to download any files???
Regards,

I applied the said changes but error is still there…
image

Hi @Farhan_Abbas,

Can you quote the exact error message (including stack trace) again, now that the change is in place?

Regards,
Alec Smecher
Public Knowledge Project Team

Ok, Sure, Let me have the stack trace of the error…

@asmecher
PHP Fatal error: Uncaught Error: Call to a member function getPublished() on null in E:\websites\ojs\journal\classes\search\ArticleSearch.inc.php:278
Stack trace:
#0 E:\websites\ojs\journal\plugins\generic\recommendByAuthor\RecommendByAuthorPlugin.inc.php(137): ArticleSearch->formatResults(Array)
#1 E:\websites\ojs\journal\lib\pkp\classes\plugins\HookRegistry.inc.php(107): RecommendByAuthorPlugin->callbackTemplateArticlePageFooter(‘Templates::Arti…’, Array)
#2 E:\websites\ojs\journal\lib\pkp\classes\template\PKPTemplateManager.inc.php(1237): HookRegistry::call(‘Templates::Arti…’, Array)
#3 E:\websites\ojs\journal\cache\t_compile\a4fc84a2d9d2a85c011fcc528f09577e88e2fcff^1c372c95cd85572e0fbc9a53d0323a0b229cfc78_0.app.frontendpagesarticle.tpl.php(43): PKPTemplateManager->smartyCallHook(Array, Object(Smarty_Internal_Template))
#4 E:\websites\ojs\journal\lib\pkp\lib\vendor\smarty\smarty\libs\sysplugins\smarty_template_resource_base.php(123): content_5ea7a882af5587_40803014(Object(Smarty_Internal_Template))
#5 E:\websites\ojs\journal\lib\pkp\lib\vendor\smarty\smarty\libs\sysplugins\smarty_template_compiled.php(114): Smarty_Template_Resource_Base->getRenderedTemplateCode(Object(Smarty_Internal_Template))
#6 E:\websites\ojs\journal\lib\pkp\lib\vendor\smarty\smarty\libs\sysplugins\smarty_internal_template.php(216): Smarty_Template_Compiled->render(Object(Smarty_Internal_Template))
#7 E:\websites\ojs\journal\lib\pkp\lib\vendor\smarty\smarty\libs\sysplugins\smarty_internal_templatebase.php(232): Smarty_Internal_Template->render(false, 1)
#8 E:\websites\ojs\journal\lib\pkp\lib\vendor\smarty\smarty\libs\sysplugins\smarty_internal_templatebase.php(134): Smarty_Internal_TemplateBase->_execute(Object(Smarty_Internal_Template), NULL, ‘a4fc84a2d9d2a85…’, NULL, 1)
#9 E:\websites\ojs\journal\lib\pkp\classes\template\PKPTemplateManager.inc.php(905): Smarty_Internal_TemplateBase->display(‘frontend/pages/…’, NULL, ‘a4fc84a2d9d2a85…’, NULL)
#10 E:\websites\ojs\journal\pages\article\ArticleHandler.inc.php(282): PKPTemplateManager->display(‘frontend/pages/…’)
#11 E:\websites\ojs\journal\lib\pkp\classes\core\PKPRouter.inc.php(391): ArticleHandler->view(Array, Object(Request))
#12 E:\websites\ojs\journal\lib\pkp\classes\core\PKPPageRouter.inc.php(231): PKPRouter->_authorizeInitializeAndCallRequest(Array, Object(Request), Array, false)
#13 E:\websites\ojs\journal\lib\pkp\classes\core\Dispatcher.inc.php(143): PKPPageRouter->route(Object(Request))
#14 E:\websites\ojs\journal\lib\pkp\classes\core\PKPApplication.inc.php(278): Dispatcher->dispatch(Object(Request))
#15 E:\websites\ojs\journal\index.php(68): PKPApplication->execute()
#16 {main}
thrown in E:\websites\ojs\journal\classes\search\ArticleSearch.inc.php on line 278

Hi @Farhan_Abbas,

Hmm, this is tricky to test without a use case to work with locally. However, I think this will fix it:
https://github.com/pkp/ojs/commit/4f74c102d90b38c70785eb05dbd0d8f3c1383dea

Please confirm!

Regards,
Alec Smecher
Public Knowledge Project Team

1 Like

Yes, the above modification worked and there is not this error any more… just left with the “file_put_contents” problem which we are discussing on another thread…
Thanks a lot for your kind help… :slight_smile:

Regards,
Farhan

Hello @asmecher,
The above issue has started to appear again and alongwith that, another error is appearing in the logs.

PHP Fatal error: Uncaught Error: Call to a member function getData() on null in E:\websites\ojs\journal\classes\issue\IssueAction.inc.php:34
Stack trace:
#0 E:\websites\ojs\journal\pages\search\SearchHandler.inc.php(252): IssueAction->subscriptionRequired(NULL, NULL)
#1 E:\websites\ojs\journal\lib\pkp\classes\core\PKPRouter.inc.php(391): SearchHandler->authors(Array, Object(Request))
#2 E:\websites\ojs\journal\lib\pkp\classes\core\PKPPageRouter.inc.php(231): PKPRouter->_authorizeInitializeAndCallRequest(Array, Object(Request), Array, false)
#3 E:\websites\ojs\journal\lib\pkp\classes\core\Dispatcher.inc.php(143): PKPPageRouter->route(Object(Request))
#4 E:\websites\ojs\journal\lib\pkp\classes\core\PKPApplication.inc.php(278): Dispatcher->dispatch(Object(Request))
#5 E:\websites\ojs\journal\index.php(68): PKPApplication->execute()
#6 {main}
thrown in E:\websites\ojs\journal\classes\issue\IssueAction.inc.php on line 34

Please have a look and let me know how can I fix this?
I shall be really grateful to you.

Regards,

Greetings,

I am using OJS 3.1.1-4, PHP 7.2 and PostgreSQL.
I get a similar error when I try to schedule an article for publication:

PHP Fatal error: Uncaught Error: Call to a member function getPublished() on null

Summary

in /var/www/html/journal/controllers/tab/issueEntry/form/IssueEntryPublicationMetadataForm.inc.php:262\nStack trace:\n#0 /var/www/html/journal/controllers/tab/issueEntry/IssueEntryTabHandler.inc.php(124): IssueEntryPublicationMetadataForm->execute(Object(Request))\n#1 /var/www/html/journal/lib/pkp/classes/core/PKPRouter.inc.php(390): IssueEntryTabHandler->savePublicationMetadataForm(Array, Object(Request))\n#2 /var/www/html/journal/lib/pkp/classes/core/PKPComponentRouter.inc.php(257): PKPRouter->_authorizeInitializeAndCallRequest(Array, Object(Request), Array)\n#3 /var/www/html/journal/lib/pkp/classes/core/Dispatcher.inc.php(134): PKPComponentRouter->route(Object(Request))\n#4 /var/www/html/journal/lib/pkp/classes/core/PKPApplication.inc.php(247): Dispatcher->dispatch(Object(Request))\n#5 /var/www/html/journal/index.php(68): PKPApplication->execute()\n#6 {main}\n thrown in /var/www/html/journal/controllers/tab/issueEntry/form/IssueEntryPublicationMetadataForm.inc.php on line 262, referer: http://domain/index.php/test/workflow/index/835/5

I suspect the solution in my case might be different.

Talk soon,
Juan Castro
Universidad del Valle

Hi @jpcv222,

That’s a different issue; I suspect it arises from your database containing an entry in published_articles that refers to an issue_id that does not exist in the issues table. I’d suggest reviewing your database for that situation, and correcting it if you find one.

Regards,
Alec Smecher
Public Knowledge Project Team

Hi, @asmecher
I already try SearchHandler::authors() can encounter fatal error with unpublished publications · Issue #5793 · pkp/pkp-lib · GitHub and pkp/pkp-lib#5793 Add check to ensure content is designated against an… · pkp/ojs@4f74c10 · GitHub, but the problem still exist.

And the file : f9cbad54bc17edf9cd863b38d6dce3361ce3799b^acf1fc671fe3149386beb488bd42d95154e9d6f3_0.app.frontendpagessearchAuthor.php I can’t found in the t_compile folder. Why this error still exist while the file is not there?

Thank you.

Regards,
Agung Prasetyo