Skip to content

[Website Settings] added "Highlights" entries throw Uncaught TypeError in Highlight.php #11286

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
1 task done
krga opened this issue Apr 17, 2025 · 5 comments
Open
1 task done
Assignees
Labels
Bug:1:Minor A bug found in uncommon paths, with low consequences, limited users or has an easy workaround
Milestone

Comments

@krga
Copy link

krga commented Apr 17, 2025

Valid Title

  • I have updated the title to accurately reflect the bug description

Description

When adding two "Highlights" entries in Website Settings of default theme will lead to a thrown Uncaught TypeError in lib/pkp/classes/highlight/Highlight.php:150 and empty (white) journal start page.

Steps to Reproduce

  1. add two "Highlights" entries in Website Settings
  2. Navigate to/reload journal start page

Expected Result

Journal start page should be loaded without issues, Highlights should be shown.

Actual Result

Journal start page is rendered empty. An Uncaught TypeError is thrown and shown in the www-error.log

Environment Details

  • OJS: 3.5 RC 2 - default theme
  • OS platform: Linux
  • PHP version: 8.2.25
  • Apache version: Apache/2.4.37 (Red Hat Enterprise Linux) OpenSSL/1.1.1k
  • Database driver: mysql
  • Database server version: 10.6.17-MariaDB-log

Application Version

OJS 3.5 RC 2

Logs

[17-Apr-2025 12:10:01 Europe/Zurich] PHP Fatal error:  Uncaught TypeError: PKP\highlight\Highlight::getLocalizedUrlText(): Return value must be of type string, null returned in /www/ojs-3.5.0rc2/lib/pkp/classes/highlight/Highlight.php:150
Stack trace:
#0 /www/ojs-3.5.0rc2/cache/t_compile/00a0a0910209607cb33eb0fe6474f30ed7399ed7^22a4d55f8495a7cece78f83344c098366646ca72_0.app.frontendcomponentshighlights.tpl.php(57): PKP\highlight\Highlight->getLocalizedUrlText()
#1 /www/ojs-3.5.0rc2/lib/pkp/lib/vendor/smarty/smarty/libs/sysplugins/smarty_template_resource_base.php(123): content_6800d370c58e70_88019160()
#2 /www/ojs-3.5.0rc2/lib/pkp/lib/vendor/smarty/smarty/libs/sysplugins/smarty_template_compiled.php(114): Smarty_Template_Resource_Base->getRenderedTemplateCode()
#3 /www/ojs-3.5.0rc2/lib/pkp/lib/vendor/smarty/smarty/libs/sysplugins/smarty_internal_template.php(217): Smarty_Template_Compiled->render()
#4 /www/ojs-3.5.0rc2/lib/pkp/lib/vendor/smarty/smarty/libs/sysplugins/smarty_internal_template.php(386): Smarty_Internal_Template->render()
#5 /www/ojs-3.5.0rc2/cache/t_compile/00a0a0910209607cb33eb0fe6474f30ed7399ed7^e64e579388e5615e11e939b12134d6ae8679eba6_0.app.frontendpagesindexJournal.tpl.php(38): Smarty_Internal_Template->_subTemplateRender()
#6 /www/ojs-3.5.0rc2/lib/pkp/lib/vendor/smarty/smarty/libs/sysplugins/smarty_template_resource_base.php(123): content_67f7dc444c7c20_77395158()
#7 /www/ojs-3.5.0rc2/lib/pkp/lib/vendor/smarty/smarty/libs/sysplugins/smarty_template_compiled.php(114): Smarty_Template_Resource_Base->getRenderedTemplateCode()
#8 /www/ojs-3.5.0rc2/lib/pkp/lib/vendor/smarty/smarty/libs/sysplugins/smarty_internal_template.php(217): Smarty_Template_Compiled->render()
#9 /www/ojs-3.5.0rc2/lib/pkp/lib/vendor/smarty/smarty/libs/sysplugins/smarty_internal_templatebase.php(238): Smarty_Internal_Template->render()
#10 /www/ojs-3.5.0rc2/lib/pkp/lib/vendor/smarty/smarty/libs/sysplugins/smarty_internal_templatebase.php(134): Smarty_Internal_TemplateBase->_execute()
#11 /www/ojs-3.5.0rc2/lib/pkp/classes/template/PKPTemplateManager.php(1476): Smarty_Internal_TemplateBase->display()
#12 /www/ojs-3.5.0rc2/pages/index/IndexHandler.php(83): PKP\template\PKPTemplateManager->display()
#13 [internal function]: APP\pages\index\IndexHandler->index()
#14 /www/ojs-3.5.0rc2/lib/pkp/classes/core/PKPRouter.php(327): call_user_func()
#15 /www/ojs-3.5.0rc2/lib/pkp/classes/core/PKPPageRouter.php(249): PKP\core\PKPRouter->_authorizeInitializeAndCallRequest()
#16 /www/ojs-3.5.0rc2/lib/pkp/classes/core/Dispatcher.php(157): PKP\core\PKPPageRouter->route()
#17 /www/ojs-3.5.0rc2/lib/pkp/classes/core/PKPApplication.php(422): PKP\core\Dispatcher->dispatch()
#18 /www/ojs-3.5.0rc2/index.php(21): PKP\core\PKPApplication->execute()
#19 {main}
  thrown in /www/ojs-3.5.0rc2/lib/pkp/classes/highlight/Highlight.php on line 150

Additional Information

No response

Pull Requests

pkp-lib

submodule updates

@kaitlinnewson
Copy link
Member

Hi @krga, thanks for the report - I was able to reproduce this by creating a highlight but leaving the "button label" field empty.

@kaitlinnewson kaitlinnewson added the Bug:1:Minor A bug found in uncommon paths, with low consequences, limited users or has an easy workaround label Apr 17, 2025
@kaitlinnewson kaitlinnewson added this to the 3.5 Internal milestone Apr 17, 2025
@kaitlinnewson kaitlinnewson self-assigned this Apr 17, 2025
kaitlinnewson added a commit to kaitlinnewson/pkp-lib that referenced this issue Apr 17, 2025
kaitlinnewson added a commit to kaitlinnewson/pkp-lib that referenced this issue Apr 17, 2025
kaitlinnewson added a commit to kaitlinnewson/pkp-lib that referenced this issue Apr 17, 2025
@kaitlinnewson
Copy link
Member

kaitlinnewson commented Apr 17, 2025

Hi @bozana, can you review the small PRs above? I did the PR to 3.4 as well although the highlights functionality doesn't seem fully complete there (e.g. missing the database tables needed by default) and is behind a feature flag in the config file.

kaitlinnewson added a commit to kaitlinnewson/pkp-lib that referenced this issue Apr 21, 2025
bozana added a commit that referenced this issue Apr 28, 2025
#11286 make urlText field required for highlights
bozana added a commit that referenced this issue Apr 28, 2025
#11286 make urlText field required for highlights
@bozana
Copy link
Contributor

bozana commented Apr 28, 2025

Hi @kaitlinnewson, could you also provide the submodule updates for stable-3_4_0?

kaitlinnewson added a commit to kaitlinnewson/pkp-lib that referenced this issue Apr 28, 2025
@kaitlinnewson
Copy link
Member

Hi @bozana, apologies for missing those, they are now added to the list above, thanks!

bozana added a commit that referenced this issue Apr 28, 2025
#11286 make urlText field required for highlights
@bozana
Copy link
Contributor

bozana commented Apr 28, 2025

Thanks a lot @kaitlinnewson!
All, merged, can this issue be closed?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug:1:Minor A bug found in uncommon paths, with low consequences, limited users or has an easy workaround
Projects
None yet
Development

No branches or pull requests

3 participants