PR-6.2-dev Architecture Pending

User tests: Successful: Unsuccessful:

avatar joomdonation
joomdonation
25 Apr 2026

Pull Request resolves # .

  • 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

The SiteApplication, AdministratorApplication, and ApiApplication all called $this->loadDocument() without passing $document argument, causing an internal fallback to the deprecated method Factory::getDocument() call.

This PR introduces createDocument() method on CMSApplication to create document object which bring the following improvements:

  • Use dependencies (language, document factory) which are necessary to create document directly from the application rather than the static Factory.
  • Avoid calling deprecated method Factory::getDocument() which was planned to remove in Joomla 7
  • Consistent with how language is created and injected into application

Testing Instructions

  • Use Joomla 6.2 (Joomla 6.1 is also OK)
  • Apply patch, and access to random pages from frontend and backend of your site. If you are familiar with web services, try to execute a request with web service, too

Actual result BEFORE applying this Pull Request

Works. But use deprecated code for creating document object for application

Expected result AFTER applying this Pull Request

Works without using deprecated code for creating document object for application

Link to documentations

Please select:

  • No documentation changes for guide.joomla.org needed
  • No documentation changes for manual.joomla.org needed
avatar joomdonation joomdonation - open - 25 Apr 2026
avatar joomdonation joomdonation - change - 25 Apr 2026
Status New ⇒ Pending
avatar joomla-cms-bot joomla-cms-bot - change - 25 Apr 2026
Category ⇒ Libraries
avatar joomdonation joomdonation - change - 25 Apr 2026
Labels Added: PR-6.2-dev
avatar joomdonation joomdonation - change - 18 Jun 2026
Labels Added: Architecture
avatar joomla-cms-bot joomla-cms-bot - change - 20 Jun 2026
Category Libraries ⇒ Installation Libraries
bf22b77 20 Jun 2026 avatar joomdonation CS
avatar joomla-cms-bot joomla-cms-bot - change - 20 Jun 2026
Category Libraries Installation ⇒ Libraries
avatar HLeithner
HLeithner - comment - 24 Jun 2026

I would suggest change the Factory::getDocument() and Factory::createDocument() to use the "new application" methods, so we have only one location where a document is created.

Additionally I would move createDocument() to WebApplication and also move the loadDocument change to the WebApplication.

Additonally wrap all Factory::$document = $document code into the "b/c plugin switch" COMPAT_JOOMLA_7.

reference: #47911

and I think move it to 7.0

avatar laoneo
laoneo - comment - 24 Jun 2026

I would not make the createDocument function in the application class public. But I do agree that the factory should use the document from the app and not vice versa. Therefore we can remove createDocument in the Factory and route getDocument in factory to the app.

avatar joomdonation
joomdonation - comment - 25 Jun 2026

Thanks for the feedback. Below are details response:

I would suggest change the Factory::getDocument() and Factory::createDocument() to use the "new application" methods, so we have only one location where a document is created.

This is not safe. The "new application" needs language available in application to create document. That is only available after application Initialise phase. So if someone calls Factory::getDocument() before that for whatever reason, it will be broken.

Additionally I would move createDocument() to WebApplication and also move the loadDocument change to the WebApplication.

This is not possible because WebApplication does not have container injected, so we do not have necessary services to create documents there.

I would not make the createDocument function in the application class public

Yes, that could not be public because it can only be used at certain phase in application life cycle. It is protected on purpose and can only be used internal for now.

avatar muhme muhme - test_item - 17 Oct 2026 - Tested successfully
avatar muhme
muhme - comment - 17 Oct 2026

I have tested this item ✅ successfully on 015ce89

Tested with JBT on 6.2-dev and with Blog Sample Data installed

  • Seen before PR
    • Tested on backend
      • administrator/index.php?option=com_content&view=articles
      • administrator/index.php?option=com_content&view=article&layout=edit&id=11
      • administrator/index.php?option=com_categories&view=categories&extension=com_content
      • administrator/index.php?option=com_categories&view=category&layout=edit&id=2&extension=com_content
      • administrator/index.php?option=com_tags&view=tags
      • administrator/index.php?option=com_fields&view=fields&context=com_content.article
      • administrator/index.php?option=com_fields&view=groups&context=com_content.article
      • administrator/index.php?option=com_menus&view=menus
      • administrator/index.php?option=com_menus&view=items&menutype=
      • administrator/index.php?option=com_banners&view=banners
      • administrator/index.php?option=com_contact&view=contacts
      • administrator/index.php?option=com_users&view=users
      • administrator/index.php?option=com_users&view=groups
      • administrator/index.php?option=com_installer&view=languages
      • administrator/index.php?option=com_languages&view=overrides
      • administrator/index.php?option=com_templates&view=styles&client_id=0
      • administrator/index.php?option=com_config
      • administrator/index.php?option=com_installer&view=manage
    • Tested API GET
      • api_call "GET" "/v1/content/articles"
      • api_call "GET" "/v1/content/articles/1"
      • api_call "GET" "/v1/content/categories"
      • api_call "GET" "/v1/content/categories/1"
      • api_call "GET" "/v1/content/tags"
      • api_call "GET" "/v1/content/fields"
      • api_call "GET" "/v1/content/fieldgroups"
      • api_call "GET" "/v1/menus/site"
      • api_call "GET" "/v1/menus/site/items"
      • api_call "GET" "/v1/banners"
      • api_call "GET" "/v1/contacts"
      • api_call "GET" "/v1/users"
      • api_call "GET" "/v1/usergroups"
      • api_call "GET" "/v1/languages/content"
      • api_call "GET" "/v1/languages/overrides/site/en-GB"
      • api_call "GET" "/v1/templates/styles/site"
      • api_call "GET" "/v1/config/application"
      • api_call "GET" "/v1/extensions"
  • Applied PR with Patch Tester
    • Tested with backend
      • all URLs above are still working w/o errors
    • Tested with API
      • Identical output, except lastvisitDate
    • There are no unusual Joomla and PHP log messages, except:
      • ⚠️ With api_call "GET" "/v1/languages/overrides/site/en-GB" there is a deprectation before this PR and mentioned in #48630
        • strtoupper(): Passing null to parameter #1 ($string) of type string is deprecated in OverridesModel.php on line 100

This comment was created with the J!Tracker Application at issues.joomla.org/tracker/joomla-cms/47685.
avatar muhme
muhme - comment - 17 Oct 2026

I have tested this item ✅ successfully on 015ce89

Tested with JBT on 6.2-dev and with Blog Sample Data installed

  • Seen before PR
    • Tested on backend
      • administrator/index.php?option=com_content&view=articles
      • administrator/index.php?option=com_content&view=article&layout=edit&id=11
      • administrator/index.php?option=com_categories&view=categories&extension=com_content
      • administrator/index.php?option=com_categories&view=category&layout=edit&id=2&extension=com_content
      • administrator/index.php?option=com_tags&view=tags
      • administrator/index.php?option=com_fields&view=fields&context=com_content.article
      • administrator/index.php?option=com_fields&view=groups&context=com_content.article
      • administrator/index.php?option=com_menus&view=menus
      • administrator/index.php?option=com_menus&view=items&menutype=
      • administrator/index.php?option=com_banners&view=banners
      • administrator/index.php?option=com_contact&view=contacts
      • administrator/index.php?option=com_users&view=users
      • administrator/index.php?option=com_users&view=groups
      • administrator/index.php?option=com_installer&view=languages
      • administrator/index.php?option=com_languages&view=overrides
      • administrator/index.php?option=com_templates&view=styles&client_id=0
      • administrator/index.php?option=com_config
      • administrator/index.php?option=com_installer&view=manage
    • Tested API GET
      • api_call "GET" "/v1/content/articles"
      • api_call "GET" "/v1/content/articles/1"
      • api_call "GET" "/v1/content/categories"
      • api_call "GET" "/v1/content/categories/1"
      • api_call "GET" "/v1/content/tags"
      • api_call "GET" "/v1/content/fields"
      • api_call "GET" "/v1/content/fieldgroups"
      • api_call "GET" "/v1/menus/site"
      • api_call "GET" "/v1/menus/site/items"
      • api_call "GET" "/v1/banners"
      • api_call "GET" "/v1/contacts"
      • api_call "GET" "/v1/users"
      • api_call "GET" "/v1/usergroups"
      • api_call "GET" "/v1/languages/content"
      • api_call "GET" "/v1/languages/overrides/site/en-GB"
      • api_call "GET" "/v1/templates/styles/site"
      • api_call "GET" "/v1/config/application"
      • api_call "GET" "/v1/extensions"
  • Applied PR with Patch Tester
    • Tested with backend
      • all URLs above are still working w/o errors
    • Tested with API
      • Identical output, except lastvisitDate
    • There are no unusual Joomla and PHP log messages, except:
      • ⚠️ With api_call "GET" "/v1/languages/overrides/site/en-GB" there is a deprectation before this PR and mentioned in #48630
        • strtoupper(): Passing null to parameter #1 ($string) of type string is deprecated in OverridesModel.php on line 100

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

Add a Comment

Login with GitHub to post a comment