No Code Attached Yet
avatar sevaa
sevaa
27 Oct 2025

In Joomla 4, the following works:

$modelcat = new Joomla\Component\Content\Site\Model\CategoryModel();
$category = $modelcat->getCategory();

In Joomla 5, it crashes with the error "Uncaught Throwable of type Error thrown with message "Call to a member function get() on null"". The exception is thrown in CategoryModel::getCategory() on components/com_content/src/Model/CategoryModel.php:338:

if (!empty($this->state->get('params'))) {

because the "state" data member is null out of the CategoryModel constructor. It worked in Joomla 4 because the corresponding line in getCategory would go instead:

if (isset($this->state->params)) {

and isset would return false if state is null.

Observed on the JA Playschool template by JoomlArt, with a menu item of type "Gallery List". Reproduces on a fresh install.

avatar sevaa sevaa - open - 27 Oct 2025
avatar sevaa sevaa - change - 27 Oct 2025
Labels Removed: ?
avatar joomla-cms-bot joomla-cms-bot - change - 27 Oct 2025
Labels Added: No Code Attached Yet
avatar joomla-cms-bot joomla-cms-bot - labeled - 27 Oct 2025
avatar heelc29
heelc29 - comment - 28 Oct 2025

Hi Seva, this issue has already been reported #46311 and should fixed with #46316. It will be included in the next releases 5.4.1/6.0.1

avatar sevaa sevaa - change - 28 Oct 2025
Status New Closed
Closed_Date 0000-00-00 00:00:00 2025-10-28 14:48:24
Closed_By sevaa
avatar sevaa sevaa - close - 28 Oct 2025
avatar sevaa
sevaa - comment - 28 Oct 2025

Thanks. Closing as duplicate.

Add a Comment

Login with GitHub to post a comment