Skip to content

[6.0] Prevent error if ListView does not have filter form#46689

Merged
Bodge-IT merged 2 commits intojoomla:6.0-devfrom
joomdonation:fix_listview
Jan 25, 2026
Merged

[6.0] Prevent error if ListView does not have filter form#46689
Bodge-IT merged 2 commits intojoomla:6.0-devfrom
joomdonation:fix_listview

Conversation

@joomdonation
Copy link
Copy Markdown
Contributor

@joomdonation joomdonation commented Jan 14, 2026

Pull Request for Issue # .

Summary of Changes

Extensions can use the ListView class without defining a filter form. In this case, the $filterForm property remains null, which can lead to a fatal error when the view attempts to access it without a null check.

This PR adds a guard check to safely handle the absence of a filter form and prevent a fatal error.

Testing Instructions

  • Use Joomla 6
  • Install the attached com_items component. It is a very basic component created by Gitub copilot for testing
    com_items.zip
  • Access to Components -> Items

Actual Result BEFORE Applying This Pull Request

You got fatal error Call to a member function addControlField() on null due to missing null check in ListView class

Expected Result AFTER Applying This Pull Request

No error anymore. You see a screen displays list of items (empty until you add items to it). You might see a warning Deprecated: substr(): Passing null to parameter #1 ($string) of type string is deprecated in but ignore it for now. The main thing is fatal error is sorted by this PR.

Link to documentations

Please select:

  • Documentation link for docs.joomla.org:

  • No documentation changes for docs.joomla.org needed

  • Pull Request link for manual.joomla.org:

  • No documentation changes for manual.joomla.org needed

@richard67
Copy link
Copy Markdown
Member

@joomdonation As this PR is made for the 6.0-dev branch: Is this a bug fix specific for 6.x? or does the issue which it fixes also exist in 5.4-dev? In this case the PR should be made for the 5.4-dev branch. Or if it counts as a new feature, then for the 6.1-dev branch. See https://github.com/joomla/joomla-cms?tab=readme-ov-file#which-branch-should-my-pull-request-target .

@joomdonation
Copy link
Copy Markdown
Contributor Author

joomdonation commented Jan 14, 2026

@richard67 It is a bug fix for 6.0-dev branch only. The issue was introduced by my PR for 6.0-dev #46165

@richard67 richard67 added the bug label Jan 14, 2026
@ceford
Copy link
Copy Markdown
Contributor

ceford commented Jan 17, 2026

I have tested this item ✅ successfully on adb8c1b


This comment was created with the J!Tracker Application at issues.joomla.org/tracker/joomla-cms/46689.

1 similar comment
@Fedik
Copy link
Copy Markdown
Member

Fedik commented Jan 17, 2026

I have tested this item ✅ successfully on adb8c1b


This comment was created with the J!Tracker Application at issues.joomla.org/tracker/joomla-cms/46689.

@Fedik
Copy link
Copy Markdown
Member

Fedik commented Jan 17, 2026

rtc


This comment was created with the J!Tracker Application at issues.joomla.org/tracker/joomla-cms/46689.

@joomla-cms-bot joomla-cms-bot added the RTC This Pull Request is Ready To Commit label Jan 17, 2026
@Bodge-IT Bodge-IT added this to the Joomla! 6.0.3 milestone Jan 25, 2026
@Bodge-IT Bodge-IT merged commit e46b9ac into joomla:6.0-dev Jan 25, 2026
51 checks passed
@joomla-cms-bot joomla-cms-bot removed the RTC This Pull Request is Ready To Commit label Jan 25, 2026
@Bodge-IT
Copy link
Copy Markdown
Contributor

Thanks @joomdonation for fixing, thanks @ceford & @Fedik for tests

@joomdonation joomdonation deleted the fix_listview branch February 1, 2026 09:05
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants