Bootstrap 3 - PHP Fatal error: Uncaught Error: Call to a member function getPageCount() on array

Hi,
Bootstrap theme (master branch) is installed with OJS 3.3.0.5

Everytime I access the index journal page (multi journal home site) in Bootstrap 3 theme, It is throwing the following php fatal error:

[12-Apr-2021 11:02:24 Asia/Riyadh] PHP Fatal error:  Uncaught Error: Call to a member function getPageCount() on array in /home/seisense/journal.seisense.com/cache/t_compile/65bfc3e024c2e9104f46e23b73376a9455e3df0e^51cfb9321c891ada9323e7942962579e7e4324d1_0.app.frontendpagesindexSite.tp.php:116
Stack trace:
#0 /home/seisense/journal.seisense.com/lib/pkp/lib/vendor/smarty/smarty/libs/sysplugins/smarty_template_resource_base.php(123): content_6073fcbd741b57_51377967(Object(Smarty_Internal_Template))
#1 /home/seisense/journal.seisense.com/lib/pkp/lib/vendor/smarty/smarty/libs/sysplugins/smarty_template_compiled.php(114): Smarty_Template_Resource_Base->getRenderedTemplateCode(Object(Smarty_Internal_Template))
#2 /home/seisense/journal.seisense.com/lib/pkp/lib/vendor/smarty/smarty/libs/sysplugins/smarty_internal_template.php(216): Smarty_Template_Compiled->render(Object(Smarty_Internal_Template))
#3 /home/seisense/journal.seisense.com/lib/pkp/lib/vendor/smarty/smarty/libs/sysplugins/smarty_internal_templatebase.php(232): Smarty_Internal_Template->render(false, 1)
#4 in /home/seisense/journal.seisense.com/cache/t_compile/65bfc3e024c2e9104f46e23b73376a9455e3df0e^51cfb9321c891ada9323e7942962579e7e4324d1_0.app.frontendpagesindexSite.tp.php on line 116

Looking for your expert advice.

Hi @seisense

This appears to be a bug in the theme. I’ll file and issue but for now you probably want to switch your theme to something else to prevent downtime.

Best,
Jason

@jnugent ,
I’ll be waiting for the fix. thanks

Hi @seisense

This should be fixed now

Best,
Jason

Thanks @jnugent for your prompt action with a fix. I have applied your provided solution and that fatal error is not appearing in the error log. Yet a new fatal error (it was not there before) is appearing now in the error log as below:

[13-Apr-2021 20:30:51 Asia/Riyadh] PHP Fatal error:  Uncaught Error: Call to a member function getBestId() on null in /home/seisense/journal.seisense.com/cache/t_compile/21234be0524f21c29fca0068e67ad8b03075f11e^7cf1cd52b8ba8108de77f197078de34b733dd394_0.app.frontendobjectsarticlesum.php:25
Stack trace:
#0 /home/seisense/journal.seisense.com/lib/pkp/lib/vendor/smarty/smarty/libs/sysplugins/smarty_template_resource_base.php(123): content_6075a7006f33b8_40488047(Object(Smarty_Internal_Template))
#1 /home/seisense/journal.seisense.com/lib/pkp/lib/vendor/smarty/smarty/libs/sysplugins/smarty_template_compiled.php(114): Smarty_Template_Resource_Base->getRenderedTemplateCode(Object(Smarty_Internal_Template))
#2 /home/seisense/journal.seisense.com/lib/pkp/lib/vendor/smarty/smarty/libs/sysplugins/smarty_internal_template.php(216): Smarty_Template_Compiled->render(Object(Smarty_Internal_Template))
#3 /home/seisense/journal.seisense.com/lib/pkp/lib/vendor/smarty/smarty/libs/sysplugins/smarty_internal_template.php(385): Smarty_Internal_Template->render()
#4 /home/seisense/j in /home/seisense/journal.seisense.com/cache/t_compile/21234be0524f21c29fca0068e67ad8b03075f11e^7cf1cd52b8ba8108de77f197078de34b733dd394_0.app.frontendobjectsarticlesum.php on line 25

Please suggest a solution for this error.
Thanks

I’m not really sure what to say about that one, because if I am reading that correctly, the plugin is complaining about the fact that $article is null on this line:

But that’s a pretty common thing and it’s lifted directly from the default template that ships with OJS 3.3. And if that theme was broken, we’d definitely know about it.

Can you please try a different theme or the default theme? And also, let me know how you installed the bootstrap theme.

Jason

Hi @jnugent ,
I have downloaded the master branch of bootstrap3 from github and installed it through cpanel. I found the same issue is reported here in this post as well

Although, it is marked as solved, yet I do not understand what steps are taken to solve this issue.

How to reproduce this fatal error
Go to the search page and try to search using any term, it does not return any search results and PHP fatal error is produced.

In versions table Bootstrap 3 theme is showing the version as 3.2.0.3
Looking forward to your guidance.
Thanks

@jnugent ,
I have finally solved the issue (please correct me if I did something wrong here)

1- Deleted the bootstrap 3 theme and installed it from within the OJS plugin area
2- Indexsite was not working, so I replaced the complete code of indexSite.tpl with the code provided here in the link (simply deleting the lines 75-81 were not solving the problem, then I noticed that the code provided in the link below is different than the one I have in my indexSite.tpl. So I simply replaced my indexSite.tpl code with the new one.)

and now everything is back to normal.
Thanks

Hi @seisense

If you installed the plugin from within OJS (the plugin gallery) you may have not grabbed the version of the theme that had my fix. Nate merged it into the main branch, and the plugin gallery installs whatever tag is appropriate for the version of OJS you’re running. I’m assuming that Nate will create a new tag with the fix at some point.

But I’m glad you have it sorted out now.

Best
Jason