ajnyga / funding

Funding plugin integrates Crossref Funder registry to OJS3 and OMP3
GNU General Public License v3.0
6 stars 19 forks source link

PHP Fatal error: Call to a member function getId() on null #46

Closed kirchnerf closed 21 hours ago

kirchnerf commented 6 months ago

We use OMP 3.3.0.17 and the Funding Plugin in version 2.1.4.2. As soon as the plugin is activated, it is no longer possible to open a publication on the website. The following error message appears in the Apache log:

`PHP Fatal error: Uncaught Error: Call to a member function getId() on null in /srv/www/htdocs/omp/plugins/generic/funding/FundingPlugin.inc.php:182 Stack trace:

0 /srv/www/htdocs/omp/lib/pkp/classes/plugins/HookRegistry.inc.php(107): FundingPlugin->addSubmissionDisplay()

1 /srv/www/htdocs/omp/lib/pkp/classes/template/PKPTemplateManager.inc.php(1577): HookRegistry::call()

2 /srv/www/htdocs/omp/cache/t_compile/4838d1eb315c43da6fc0c608df23899f50941f69^1a43403fc96a795020edfbc1cc6004aa859621c9_0.app.frontendobjectsmonograph_full.tpl.php(796): PKPTemplateManager->smartyCallHook()

3 /srv/www/htdocs/omp/lib/pkp/lib/vendor/smarty/smarty/libs/sysplugins/smarty_template_resource_base.php(123): content_663a1a5f6f5c42_95435398()

4 /srv/www/htdocs/omp/lib/pkp/lib/vendor/smarty/smarty/libs/sysplugins/smarty_template_compiled.php(114): Smarty_Template_Resource_Base->getRenderedTemplateCode()

5 /srv/www/htdocs/omp/lib/pkp/lib/vendor/smarty/smarty/libs/sysplugins/smarty_internal_template.php(217): Smarty_Template_Compiled->render()

6 /srv/www/htdocs/omp/lib/pkp/lib/vendor/smarty/smarty/libs/sysplugins/smarty_internal_template.php(386): Smarty_Internal_Template->render()

7 /srv/www/htdocs/omp/cache/t_compile/4838d1eb315c43da6fc0c608df23899f50941f69^fad89cb5a0797f0c714bbc0b3dbced067d74491e_0.app.frontendpagesbook.tpl.php(31): Smarty_Internal_Template->_subTemplateRender()

8 /srv/www/htdocs/omp/lib/pkp/lib/vendor/smarty/smarty/libs/sysplugins/smarty_template_resource_base.php(123): content_663a1a5f61ee79_79407083()

9 /srv/www/htdocs/omp/lib/pkp/lib/vendor/smarty/smarty/libs/sysplugins/smarty_template_compiled.php(114): Smarty_Template_Resource_Base->getRenderedTemplateCode()

10 /srv/www/htdocs/omp/lib/pkp/lib/vendor/smarty/smarty/libs/sysplugins/smarty_internal_template.php(217): Smarty_Template_Compiled->render()

11 /srv/www/htdocs/omp/lib/pkp/lib/vendor/smarty/smarty/libs/sysplugins/smarty_internal_templatebase.php(238): Smarty_Internal_Template->render()

12 /srv/www/htdocs/omp/lib/pkp/lib/vendor/smarty/smarty/libs/sysplugins/smarty_internal_templatebase.php(134): Smarty_Internal_TemplateBase->_execute()

13 /srv/www/htdocs/omp/lib/pkp/classes/template/PKPTemplateManager.inc.php(1246): Smarty_Internal_TemplateBase->display()

14 /srv/www/htdocs/omp/pages/catalog/CatalogBookHandler.inc.php(205): PKPTemplateManager->display()

15 /srv/www/htdocs/omp/lib/pkp/classes/core/PKPRouter.inc.php(397): CatalogBookHandler->book()

16 /srv/www/htdocs/omp/lib/pkp/classes/core/PKPPageRouter.inc.php(246): PKPRouter->_authorizeInitializeAndCallRequest()

17 /srv/www/htdocs/omp/lib/pkp/classes/core/Dispatcher.inc.php(144): PKPPageRouter->route()

18 /srv/www/htdocs/omp/lib/pkp/classes/core/PKPApplication.inc.php(360): Dispatcher->dispatch()

19 /srv/www/htdocs/omp/index.php(64): PKPApplication->execute()

20 {main}

thrown in /srv/www/htdocs/omp/plugins/generic/funding/FundingPlugin.inc.php on line 182`

The problem is that the key 'monograph' does not exist in the array of template variables ($templateMgr->get_template_vars('monograph')). In my opinion, the key you are looking for in OMP should be 'publishedSubmission'. I'm not sure, but pkp/omp#686 could be related to this.

ajnyga commented 5 months ago

Thanks I will check this

ajnyga commented 21 hours ago

sorry for the delay with, for some reason it did not affect the 3.4 branch, just the 3.3. one. But there are now new releases for both those branches.