List of users can't be loaded - Log shows a DivisionByZero

Describe the issue or problem
After upgrade from 2.4.8-0 to 3.3.0-16, when I visit the list of users, page keep loading (circle turning) and in server’s log I got the following error:

[Wed Jan 03 18:35:06.794092 2024] [php:error] [pid 27] [client 192.168.93.2:38038] PHP Fatal error:  Uncaught DivisionByZeroError: Division by zero in /var/www/html/lib/pkp/classes/db/DAOResultFactory.inc.php:146\nStack trace:\n#0 /var/www/html/lib/pkp/classes/template/PKPTemplateManager.inc.php(1504): DAOResultFactory->getPageCount()\n#1 /var/www/html/cache/t_compile/6a52d53546771992184fc2b87d88184a2e294e0e^190a5206d1275dc2778fc7b49f0a6119e83e959e_0.app.controllersgridfeaturegridPaging.tpl.php(31): PKPTemplateManager->smartyPageInfo()\n#2 /var/www/html/lib/pkp/lib/vendor/smarty/smarty/libs/sysplugins/smarty_template_resource_base.php(123): content_6595a8dac1bb25_82846821()\n#3 /var/www/html/lib/pkp/lib/vendor/smarty/smarty/libs/sysplugins/smarty_template_compiled.php(114): Smarty_Template_Resource_Base->getRenderedTemplateCode()\n#4 /var/www/html/lib/pkp/lib/vendor/smarty/smarty/libs/sysplugins/smarty_internal_template.php(217): Smarty_Template_Compiled->render()\n#5 /var/www/html/lib/pkp/lib/vendor/smarty/smarty/libs/sysplugins/smarty_internal_templatebase.php(238): Smarty_Internal_Template->render()\n#6 /var/www/html/lib/pkp/lib/vendor/smarty/smarty/libs/sysplugins/smarty_internal_templatebase.php(116): Smarty_Internal_TemplateBase->_execute()\n#7 /var/www/html/lib/pkp/classes/template/PKPTemplateManager.inc.php(1090): Smarty_Internal_TemplateBase->fetch()\n#8 /var/www/html/lib/pkp/classes/controllers/grid/feature/PagingFeature.inc.php(53): PKPTemplateManager->fetch()\n#9 /var/www/html/lib/pkp/classes/controllers/grid/feature/GridFeature.inc.php(84): PagingFeature->fetchUIElements()\n#10 /var/www/html/lib/pkp/classes/controllers/grid/feature/GeneralPagingFeature.inc.php(84): GridFeature->setOptions()\n#11 /var/www/html/lib/pkp/classes/controllers/grid/feature/GridFeature.inc.php(216): GeneralPagingFeature->setOptions()\n#12 /var/www/html/lib/pkp/classes/controllers/grid/GridHandler.inc.php(965): GridFeature->fetchGrid()\n#13 /var/www/html/lib/pkp/classes/controllers/grid/GridHandler.inc.php(648): GridHandler->callFeaturesHook()\n#14 /var/www/html/lib/pkp/classes/core/PKPRouter.inc.php(397): GridHandler->fetchGrid()\n#15 /var/www/html/lib/pkp/classes/core/PKPComponentRouter.inc.php(257): PKPRouter->_authorizeInitializeAndCallRequest()\n#16 /var/www/html/lib/pkp/classes/core/Dispatcher.inc.php(144): PKPComponentRouter->route()\n#17 /var/www/html/lib/pkp/classes/core/PKPApplication.inc.php(360): Dispatcher->dispatch()\n#18 /var/www/html/index.php(68): PKPApplication->execute()\n#19 {main}\n  thrown in /var/www/html/lib/pkp/classes/db/DAOResultFactory.inc.php on line 146, referer: https://estudisescenics-test.institutdelteatre.cat/index.php/ees/management/settings/access
[Wed Jan 03 18:35:08.020296 2024] [php:error] [pid 22] [client 192.168.93.2:36640] PHP Fatal error:  Uncaught DivisionByZeroError: Division by zero in /var/www/html/lib/pkp/classes/db/DAOResultFactory.inc.php:146\nStack trace:\n#0 /var/www/html/lib/pkp/classes/template/PKPTemplateManager.inc.php(1504): DAOResultFactory->getPageCount()\n#1 /var/www/html/cache/t_compile/6a52d53546771992184fc2b87d88184a2e294e0e^190a5206d1275dc2778fc7b49f0a6119e83e959e_0.app.controllersgridfeaturegridPaging.tpl.php(31): PKPTemplateManager->smartyPageInfo()\n#2 /var/www/html/lib/pkp/lib/vendor/smarty/smarty/libs/sysplugins/smarty_template_resource_base.php(123): content_6595a8dac1bb25_82846821()\n#3 /var/www/html/lib/pkp/lib/vendor/smarty/smarty/libs/sysplugins/smarty_template_compiled.php(114): Smarty_Template_Resource_Base->getRenderedTemplateCode()\n#4 /var/www/html/lib/pkp/lib/vendor/smarty/smarty/libs/sysplugins/smarty_internal_template.php(217): Smarty_Template_Compiled->render()\n#5 /var/www/html/lib/pkp/lib/vendor/smarty/smarty/libs/sysplugins/smarty_internal_templatebase.php(238): Smarty_Internal_Template->render()\n#6 /var/www/html/lib/pkp/lib/vendor/smarty/smarty/libs/sysplugins/smarty_internal_templatebase.php(116): Smarty_Internal_TemplateBase->_execute()\n#7 /var/www/html/lib/pkp/classes/template/PKPTemplateManager.inc.php(1090): Smarty_Internal_TemplateBase->fetch()\n#8 /var/www/html/lib/pkp/classes/controllers/grid/feature/PagingFeature.inc.php(53): PKPTemplateManager->fetch()\n#9 /var/www/html/lib/pkp/classes/controllers/grid/feature/GridFeature.inc.php(84): PagingFeature->fetchUIElements()\n#10 /var/www/html/lib/pkp/classes/controllers/grid/feature/GeneralPagingFeature.inc.php(84): GridFeature->setOptions()\n#11 /var/www/html/lib/pkp/classes/controllers/grid/feature/GridFeature.inc.php(216): GeneralPagingFeature->setOptions()\n#12 /var/www/html/lib/pkp/classes/controllers/grid/GridHandler.inc.php(965): GridFeature->fetchGrid()\n#13 /var/www/html/lib/pkp/classes/controllers/grid/GridHandler.inc.php(648): GridHandler->callFeaturesHook()\n#14 /var/www/html/lib/pkp/classes/core/PKPRouter.inc.php(397): GridHandler->fetchGrid()\n#15 /var/www/html/lib/pkp/classes/core/PKPComponentRouter.inc.php(257): PKPRouter->_authorizeInitializeAndCallRequest()\n#16 /var/www/html/lib/pkp/classes/core/Dispatcher.inc.php(144): PKPComponentRouter->route()\n#17 /var/www/html/lib/pkp/classes/core/PKPApplication.inc.php(360): Dispatcher->dispatch()\n#18 /var/www/html/index.php(68): PKPApplication->execute()\n#19 {main}\n  thrown in /var/www/html/lib/pkp/classes/db/DAOResultFactory.inc.php on line 146, referer: https://estudisescenics-test.institutdelteatre.cat/index.php/ees/management/settings/access

The upgrade path was: OJS 2.4.8-0 > 2.4.8-5 > 3.2.1-6 > 3.3.0-16.
No relevant errors during the upgrade (6 review attachments missing).

What application are you using?
OJS 3.3.0-16

Additional information
Clearing server’s cache didn’t make any difference.

How could I find the wrong data in user’s table that is making the division by zero?

Hi @marc,

Check to make sure that your “items per page” settings are properly configured, both in Setup for the journal and in config.inc.php. I suspect one of those is not set.

Regards,
Alec Smecher
Public Knowledge Project Team

1 Like

You nailed it. Thanks Alec!

It was set in config.inc.php but not in Setup (/management/settings/website#setup/lists) that was set to 0 for both: Items per page and Page links.

Why nobody reported it till now? :open_mouth:

Do you want me to fill an issue in github to improve the upgrade script or with this post is enough for people to find the solution?


PD: The OJS 2.x is not “mine”. Just helping some fellows with the upgrade. :blush:

Hi @marc,

I’ve seen it reported at least once before, but unless someone wants to come up with a PR for it, we’re unlikely to devote dev time to a fix; the 2.x to 3.x upgrade process has long been retired (and isn’t in any of our maintained branches). I know there are still folks out there using it – and I really encourage them to upgrade soon!

Regards,
Alec Smecher
Public Knowledge Project Team

1 Like

This topic was automatically closed after 4 days. New replies are no longer allowed.