No Code Attached Yet
avatar stesser
stesser
21 Oct 2023

Steps to reproduce the issue

Update from 4.4.0 to 5.0.0 with many plugins and based on T4 blank template.
Patch below has fixed the issue on 3 server instances.

Expected result

Website functional.

Actual result

Website failure

Joomla\CMS\Event\Module\ModuleListEvent::onSetModules(): Argument #1 ($value) must be of type array, null given, called in /hp/cn/aa/rl/www/kgs-dhs/libraries/src/Event/AbstractEvent.php on line 225

System information (as much as possible)

Linux based shared web-service

Backtrace:

TypeError in /hp/cn/aa/rl/www/kgs-dhs/libraries/src/Event/Module/ModuleListEvent.php (line 73)

ModuleListEvent->onSetModules(null) in /hp/cn/aa/rl/www/kgs-dhs/libraries/src/Event/AbstractEvent.php (line 225)

AbstractEvent->setArgument('modules', null) in /hp/cn/aa/rl/www/kgs-dhs/libraries/src/Event/AbstractEvent.php (line 115)

AbstractEvent->__construct('onPrepareModuleList', array('modules' => null, 'subject' => null)) in /hp/cn/aa/rl/www/kgs-dhs/libraries/src/Event/AbstractImmutableEvent.php (line 51)

AbstractImmutableEvent->__construct('onPrepareModuleList', array('modules' => null, 'subject' => null)) in /hp/cn/aa/rl/www/kgs-dhs/libraries/src/Event/Module/ModuleEvent.php (line 55)

ModuleEvent->__construct('onPrepareModuleList', array('modules' => null, 'subject' => null)) in /hp/cn/aa/rl/www/kgs-dhs/libraries/src/Event/Module/ModuleListEvent.php (line 48)

ModuleListEvent->__construct('onPrepareModuleList', array(null)) in /hp/cn/aa/rl/www/kgs-dhs/libraries/src/Application/EventAware.php (line 106)

WebApplication->triggerEvent('onPrepareModuleList', array(null)) in /hp/cn/aa/rl/www/kgs-dhs/administrator/cache/t4core/ModuleHelper.php (line 369)

_JModuleHelper::load() in /hp/cn/aa/rl/www/kgs-dhs/administrator/cache/t4core/ModuleHelper.php (line 88)
_JModuleHelper::getModules('debug') in /hp/cn/aa/rl/www/kgs-dhs/libraries/src/Document/Renderer/Html/ModulesRenderer.php (line 50)

ModulesRenderer->render('debug', array('style' => 'none'), null) in /hp/cn/aa/rl/www/kgs-dhs/libraries/src/Document/HtmlDocument.php (line 575)

HtmlDocument->getBuffer('modules', 'debug', array('style' => 'none')) in /hp/cn/aa/rl/www/kgs-dhs/templates/t4_bs5_blank/error.php (line 95)

require('/hp/cn/aa/rl/www/kgs-dhs/templates/t4_bs5_blank/error.php') in /hp/cn/aa/rl/www/kgs-dhs/libraries/src/Document/HtmlDocument.php (line 731)

HtmlDocument->_loadTemplate('/hp/cn/aa/rl/www/kgs-dhs/templates/t4_bs5_blank', 'error.php') in /hp/cn/aa/rl/www/kgs-dhs/libraries/src/Document/HtmlDocument.php (line 785)

HtmlDocument->_fetchTemplate(array('template' => 't4_bs5_blank', 'directory' => '/hp/cn/aa/rl/www/kgs-dhs/templates', 'debug' => false, 'csp_nonce' => null, 'templateInherits' => '', 'params' => object(Registry), 'file' => 'error.php')) in /hp/cn/aa/rl/www/kgs-dhs/libraries/src/Document/HtmlDocument.php (line 622)

HtmlDocument->parse(array('template' => 't4_bs5_blank', 'directory' => '/hp/cn/aa/rl/www/kgs-dhs/templates', 'debug' => false, 'csp_nonce' => null, 'templateInherits' => '', 'params' => object(Registry), 'file' => 'error.php')) in /hp/cn/aa/rl/www/kgs-dhs/libraries/src/Document/HtmlDocument.php (line 640)

HtmlDocument->render(false, array('template' => 't4_bs5_blank', 'directory' => '/hp/cn/aa/rl/www/kgs-dhs/templates', 'debug' => false, 'csp_nonce' => null, 'templateInherits' => '', 'params' => object(Registry), 'file' => 'error.php')) in /hp/cn/aa/rl/www/kgs-dhs/libraries/src/Document/ErrorDocument.php (line 139)

ErrorDocument->render(false, array('template' => 't4_bs5_blank', 'directory' => '/hp/cn/aa/rl/www/kgs-dhs/templates', 'debug' => false, 'csp_nonce' => null, 'templateInherits' => '', 'params' => object(Registry), 'file' => 'error.php')) in /hp/cn/aa/rl/www/kgs-dhs/libraries/src/Error/Renderer/HtmlRenderer.php (line 70)

HtmlRenderer->render(object(TypeError)) in /hp/cn/aa/rl/www/kgs-dhs/libraries/src/Exception/ExceptionHandler.php (line 136)

ExceptionHandler::render(object(TypeError)) in /hp/cn/aa/rl/www/kgs-dhs/libraries/src/Exception/ExceptionHandler.php (line 73)

ExceptionHandler::handleException(object(TypeError)) in /hp/cn/aa/rl/www/kgs-dhs/libraries/src/Application/CMSApplication.php (line 336)

CMSApplication->execute() in /hp/cn/aa/rl/www/kgs-dhs/includes/app.php (line 58)
require_once('/hp/cn/aa/rl/www/kgs-dhs/includes/app.php') in /hp/cn/aa/rl/www/kgs-dhs/index.php (line 32) 

Additional comments

Patch:

--- AbstractEvent.php.orig  2023-10-21 17:41:06.314834698 +0200
+++ AbstractEvent.php   2023-10-21 17:36:54.281547361 +0200
@@ -221,7 +221,7 @@
         $methodName1 = 'onSet' . $ucfirst;
         $methodName2 = 'set' . $ucfirst;

-        if (method_exists($this, $methodName1)) {
+        if (method_exists($this, $methodName1) && ($value != null)) {
             $value = $this->{$methodName1}($value);
         } elseif (method_exists($this, $methodName2)) {
             @trigger_error(
avatar stesser stesser - open - 21 Oct 2023
avatar stesser stesser - change - 21 Oct 2023
Labels Removed: ?
avatar joomla-cms-bot joomla-cms-bot - change - 21 Oct 2023
Labels Added: No Code Attached Yet
avatar joomla-cms-bot joomla-cms-bot - labeled - 21 Oct 2023
avatar stesser stesser - change - 21 Oct 2023
The description was changed
avatar stesser stesser - edited - 21 Oct 2023
avatar richard67
richard67 - comment - 21 Oct 2023

Ping @Fedik : Could you check this issue and the proposed code change? It seems it's related to the event changes in 5.0.

avatar Fedik
Fedik - comment - 21 Oct 2023

The event onPrepareModuleList accept only array now. The proposed changes is incorect.
It kind of the same to #42149

As I see from the trace the extension is overriding core ModuleHelper _JModuleHelper::load() in /hp/cn/aa/rl/www/kgs-dhs/administrator/cache/t4core/ModuleHelper.php. Because of it I would call not a core issue.

avatar richard67 richard67 - change - 21 Oct 2023
Status New Closed
Closed_Date 0000-00-00 00:00:00 2023-10-21 19:25:02
Closed_By richard67
avatar richard67 richard67 - close - 21 Oct 2023
avatar richard67
richard67 - comment - 21 Oct 2023

@stesser As @Fedik mentioned, the issue is cause by a 3rd party extension "t4core" or something like that, which overrides a core file in a way which is not compatible to Joomla 5.

Closing as not a core issue. Feel free to reopen this issue if you think this is wrong.

avatar stesser
stesser - comment - 21 Oct 2023

Thank you for the analysis of this issue. I'll open a ticket against t4core ...

Add a Comment

Login with GitHub to post a comment