User tests: Successful: Unsuccessful:
Pull Request for Issue #46311 .
Check if model state is initialized before access
This is regression from PR #45704
Follow issue description or add following code to components\com_content\tmpl\featured\default.php
$app = \Joomla\CMS\Factory::getApplication();
$model = $app->bootComponent('com_content')->getMVCFactory()
->createModel('Category', 'Site', ['ignore_request' => false]);
$category = $model->getCategory();
var_dump($category::class);
Please select:
| Status | New | ⇒ | Pending |
| Category | ⇒ | Front End com_content |
I have tested this item ✅ successfully on 8c8290d
| Labels |
Added:
bug
PR-5.4-dev
|
||
I have tested this item ✅ successfully on b8a1198
| Status | Pending | ⇒ | Ready to Commit |
RTC
| Status | Ready to Commit | ⇒ | Fixed in Code Base |
| Closed_Date | 0000-00-00 00:00:00 | ⇒ | 2025-10-19 08:56:16 |
| Closed_By | ⇒ | richard67 | |
| Labels |
Added:
RTC
|
||
Thanks @heelc29 for the fix, and @chmst and @joomdonation for testing.
Both codes work, so I give a successful test. I would keep the old-fashioned variant, it is easier to read. This model will be often read by extension developers who are not familiar with newest PHP syntax. If the new variant is used, a comment could be helpful.