PR-5.4-dev Pending

User tests: Successful: Unsuccessful:

avatar arnoldwender
arnoldwender
13 Apr 2026

Pull Request resolves #47496.

  • I read the Generative AI policy and my contribution is either not created with the help of AI or is compatible with the policy and GNU/GPL 2 or later.

Summary of Changes

AbstractView::getModel() accessed $this->_models[strtolower($name)] directly without checking whether the key exists. When getModel() is called with a model name that has not been registered via addModel(), PHP 8.x raises an undefined array key warning.

Fix: extract the key to a variable and use the null coalescing operator (?? null) instead of direct array access. Updated the @return docblock to reflect the nullable return type.

Testing Instructions

  1. Create a view that extends AbstractView.
  2. Call $view->getModel('nonexistent') without having called addModel() first.
  3. Before fix: PHP Warning: Undefined array key "nonexistent"
  4. After fix: Returns null silently, no warning.

Actual result BEFORE applying this Pull Request

PHP Warning: Undefined array key "" in libraries/src/MVC/View/AbstractView.php on line 197

Expected result AFTER applying this Pull Request

No PHP warning. getModel() returns null when the requested model has not been registered.

Link to documentations

  • No documentation changes for guide.joomla.org needed
  • No documentation changes for manual.joomla.org needed
avatar arnoldwender arnoldwender - open - 13 Apr 2026
avatar arnoldwender arnoldwender - change - 13 Apr 2026
Status New Pending
avatar joomla-cms-bot joomla-cms-bot - change - 13 Apr 2026
Category Libraries
avatar arnoldwender arnoldwender - change - 13 Apr 2026
The description was changed
avatar arnoldwender arnoldwender - edited - 13 Apr 2026
avatar arnoldwender arnoldwender - change - 15 Apr 2026
Labels Added: PR-5.4-dev
avatar arnoldwender
arnoldwender - comment - 15 Apr 2026

Rebased on latest 5.4-dev — no logical changes, only conflict resolution.

avatar arnoldwender
arnoldwender - comment - 21 Apr 2026

Rebased on latest 5.4-dev — no logical changes, only conflict-free replay of the single commit. Prior CI run had one flaky edge browser system test fail; the clean unit/integration/PHPStan matrix all passed. This push should retrigger CI.

avatar arnoldwender
arnoldwender - comment - 22 Apr 2026

Closing — opened 9 days ago, CI green, rebased twice, no review or feedback. Hard to sustain contribution effort without any engagement. The fix is here if anyone wants to continue it.

avatar arnoldwender arnoldwender - change - 22 Apr 2026
Status Pending Closed
Closed_Date 0000-00-00 00:00:00 2026-04-22 07:42:43
Closed_By arnoldwender
avatar arnoldwender arnoldwender - close - 22 Apr 2026
avatar richard67
richard67 - comment - 22 Apr 2026

Closing — opened 9 days ago, CI green, rebased twice, no review or feedback. Hard to sustain contribution effort without any engagement. The fix is here if anyone wants to continue it.

Every pull request needs 2 successful human tests by contributors different to the author, and then release managers can merge it. That can take some time sometimes. You cannot expect your PR being merged within days, especially not in a volunteer driven project where we all do not do our work on a paid base and we have regular hubs beside our activities for Joomla.

Add a Comment

Login with GitHub to post a comment