RTC Unit/System Tests bug PR-6.0-dev Pending

User tests: Successful: Unsuccessful:

avatar Fedik
Fedik
3 Aug 2025

Pull Request for Issue #45682 .

Summary of Changes

Reverting of #45431, and added a few comments.
As discussed in #45682, these override still needed for components that runs without MVCFactory and Dispatcher.

Testing Instructions

Code review.

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
avatar Fedik Fedik - open - 3 Aug 2025
avatar Fedik Fedik - change - 3 Aug 2025
Status New Pending
avatar joomla-cms-bot joomla-cms-bot - change - 3 Aug 2025
Category Libraries Unit Tests
avatar laoneo
laoneo - comment - 3 Aug 2025

Does really all need to be reverted? Or would it be enough for getDispatcher?

avatar Fedik
Fedik - comment - 3 Aug 2025

I think it is fine, better to be safe.
All events related things is delayed to 7 at least, anyway

avatar PhocaCz
PhocaCz - comment - 16 Aug 2025

Hi @Fedik, thanks a lot for your attention.

Now a question, probably for someone else, what exactly is the problem:

Having this:

public function getDispatcher()
{
    if (!$this->dispatcher) {
        return Factory::getContainer()->get(DispatcherInterface::class);
    }

    return $this->dispatcher;
}

instead of this:

public function getDispatcher()
{
    if (!$this->dispatcher) {
        @trigger_error(
            \sprintf('Dispatcher for %s should be set through MVC factory. It will throw an exception in 7.0', __CLASS__),
            E_USER_DEPRECATED
        );

        return Factory::getContainer()->get(DispatcherInterface::class);
    }

    return $this->dispatcher;
}

or in future, instead of nothing.

Yes, you understand it correctly, what is the exact reason for removing this piece of code either now or in the future?

It seems logical to me. The system does not have a dispatcher, so it creates one. We proceed in the same way with all the parameters in the settings. The system does not have a parameter value, so rather than throwing an error, it simply selects the default value. I would assume the same here. The system does not have a dispatcher, so we simply take the default.

I understand the ideological reasons, but I am more concerned with the practical ones. Let me explain with an example:

From an ideological point of view, we will remove File::exists or Folder::exists because we can simply do this using pure PHP (although not 100%, because we still use Path::clean inside these functions). I understand that. But from a practical point of view, this will eliminate backward compatibility for 95% of extensions, which will ultimately hurt Joomla users.

Is removing three lines really beneficial for the overall ecosystem?

Thank you.

avatar PhocaCz PhocaCz - test_item - 16 Aug 2025 - Tested successfully
avatar PhocaCz
PhocaCz - comment - 16 Aug 2025

I have tested this item ✅ successfully on 5323414

Before change:
Call to a member function getGroup() on null based on empty filterForm object

After change:
Everything is OK.


This comment was created with the J!Tracker Application at issues.joomla.org/tracker/joomla-cms/45823.
avatar Fedik
Fedik - comment - 16 Aug 2025

In all other places getDispatcher() will throw an exception when it was not set.
Model/View should not be different.

The dispatcher should be set while creating the class instance via constructor or setter method. For components which uses service providers and MVCFactory this will happen automatically.

We added this code to give to extensions time to adopt. If they creating Model/View instance outside of MVCFactory they should set dispatcher on their own.

We should at some point get away from using Factory::getContainer() in such way. At least that the idea.

avatar OctavianC OctavianC - test_item - 1 Sep 2025 - Tested successfully
avatar OctavianC
OctavianC - comment - 1 Sep 2025

I have tested this item ✅ successfully on 5323414


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

avatar richard67 richard67 - change - 2 Sep 2025
Status Pending Ready to Commit
Labels Added: bug PR-6.0-dev Unit/System Tests
avatar richard67
richard67 - comment - 2 Sep 2025

RTC


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

avatar Bodge-IT Bodge-IT - change - 10 Sep 2025
Labels Added: RTC
avatar Bodge-IT Bodge-IT - change - 10 Sep 2025
Status Ready to Commit Fixed in Code Base
Closed_Date 0000-00-00 00:00:00 2025-09-10 17:56:31
Closed_By Bodge-IT
avatar Bodge-IT Bodge-IT - close - 10 Sep 2025
avatar Bodge-IT Bodge-IT - merge - 10 Sep 2025
avatar Bodge-IT
Bodge-IT - comment - 10 Sep 2025

Thanks @Fedik and @PhocaCz, @OctavianC for the tests

avatar laoneo
laoneo - comment - 10 Sep 2025

Don't forget to revert the manual pr as well.

Add a Comment

Login with GitHub to post a comment