PR-6.2-dev Pending

User tests: Successful: Unsuccessful:

avatar teddy-mere
teddy-mere
28 Oct 2026

Pull Request resolves #48530.

This PR is the same as #48673 by @tejaschavan724, on 6.2 branch (not 6.1).

  • 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

When upgrading from Joomla 5.4 to Joomla 6.2 via CLI e.g. php cli/joomla.php core:update, the Joomla 6.2 archive is extracted onto disk, which deploys the new Joomla 6.2 libraries/src/Installer/Installer.php.

During the finalization phase, the in-memory Joomla 5.4 updater (administrator/components/com_joomlaupdate/src/Model/UpdateModel.php line 946) invokes:

$installer->setAdapter($installer->extension->type);

In Joomla 5.4, Adapter::setAdapter($name, &$adapter = null) accepted a single argument and resolved the adapter class by name.
However, in Joomla 6 (#43792), Installer::setAdapter($name, $adapter) made $adapter a required parameter with no default value.

When the updater calls setAdapter($name) with only one argument, PHP throws a fatal error:

ArgumentCountError: Too few arguments to function Joomla\CMS\Installer\Installer::setAdapter(), 1 passed and exactly 2 expected

This PR makes $adapter optional ($adapter = null) in Installer::setAdapter():

  • If $adapter === null:
    • If the adapter is already registered in $this->adapters, it returns true.
    • Otherwise, it resolves the class by conventional name ($this->classprefix . ucfirst($name) . 'Adapter') and registers it.
  • If $adapter is provided (object or class name string), it sets it as before.

This ensures seamless backwards compatibility for transitions from Joomla 5.x to Joomla 6.2 without breaking the new Joomla 6 architecture.

Testing Instructions

  1. On a Joomla 6.2 instance, verify calling $installer->setAdapter('file') with a single argument succeeds without throwing an ArgumentCountError.
  2. Verify calling $installer->setAdapter('custom', CustomAdapter::class) or $installer->setAdapter('custom', $adapterObject) continues to work as expected.
  3. Test a Joomla 5.4 to 6.2 update via CLI (php cli/joomla.php core:update) and verify the update completes the finalisation phase without halting on setAdapter().

Actual result BEFORE applying this Pull Request

The update fails with:

Fatal error: Uncaught ArgumentCountError: Too few arguments to function Joomla\CMS\Installer\Installer::setAdapter(), 1 passed .../administrator/components/com_joomlaupdate/src/Model/UpdateModel.php on line 946 and exactly 2 expected

Expected result AFTER applying this Pull Request

The update completes successfully without argument count errors.

Link to documentations

Please select:

  • No documentation changes for guide.joomla.org needed
  • No documentation changes for manual.joomla.org needed
avatar teddy-mere teddy-mere - open - 28 Oct 2026
avatar teddy-mere teddy-mere - change - 28 Oct 2026
Status New ⇒ Pending
avatar joomla-cms-bot joomla-cms-bot - change - 28 Oct 2026
Category ⇒ Libraries
avatar tecpromotion tecpromotion - test_item - 31 Oct 2026 - Tested successfully
avatar tecpromotion
tecpromotion - comment - 31 Oct 2026

I have tested this item ✅ successfully on b1cd344

Verdict: works as intended.

Verification

Fresh Joomla 5.4.10 (DDEV, PHP 8.3, MariaDB 10.11), compat disabled / compat6 enabled, custom update source serving the official 6.2.0 update package, then php cli/joomla.php core:update:

6.2.0 package as released 6.2.0 package + this PR's Installer.php
result ArgumentCountError: Too few arguments to function Joomla\CMS\Installer\Installer::setAdapter(), 1 passed in …/UpdateModel.php on line 946 [OK] Joomla core updated successfully!
afterwards files 6.2.0, database still 5.4.10 (schema 5.4.9-2026-08-11) files and database 6.2.0 (schema 6.2.0-2026-09-15)

Testing instructions 1 and 2 (script on the updated site): setAdapter('file') returns true; setAdapter('custom', FileAdapter::class) and setAdapter('custom2', $object) work as before; an unknown class returns false. Side effect: names are now lowercased, so setAdapter('Mixed', …) followed by getAdapter('Mixed') works (before: "The mixed install adapter does not exist."). php-cs-fixer and phpstan clean.

Suggestion (non-blocking)

Add a short comment above the $adapter === null branch saying it is only there for the Joomla 5 updater (UpdateModel::finaliseUpgrade() of 5.4 still runs in memory during a CLI upgrade). In 6.x nothing calls setAdapter() with one argument, so it looks like dead code and may get removed while 5 → 6 upgrades are still supported.


This comment was created with the J!Tracker Application at issues.joomla.org/tracker/joomla-cms/48718.
avatar tecpromotion
tecpromotion - comment - 31 Oct 2026

I have tested this item ✅ successfully on b1cd344

Verdict: works as intended.

Verification

Fresh Joomla 5.4.10 (DDEV, PHP 8.3, MariaDB 10.11), compat disabled / compat6 enabled, custom update source serving the official 6.2.0 update package, then php cli/joomla.php core:update:

6.2.0 package as released 6.2.0 package + this PR's Installer.php
result ArgumentCountError: Too few arguments to function Joomla\CMS\Installer\Installer::setAdapter(), 1 passed in …/UpdateModel.php on line 946 [OK] Joomla core updated successfully!
afterwards files 6.2.0, database still 5.4.10 (schema 5.4.9-2026-08-11) files and database 6.2.0 (schema 6.2.0-2026-09-15)

Testing instructions 1 and 2 (script on the updated site): setAdapter('file') returns true; setAdapter('custom', FileAdapter::class) and setAdapter('custom2', $object) work as before; an unknown class returns false. Side effect: names are now lowercased, so setAdapter('Mixed', …) followed by getAdapter('Mixed') works (before: "The mixed install adapter does not exist."). php-cs-fixer and phpstan clean.

Suggestion (non-blocking)

Add a short comment above the $adapter === null branch saying it is only there for the Joomla 5 updater (UpdateModel::finaliseUpgrade() of 5.4 still runs in memory during a CLI upgrade). In 6.x nothing calls setAdapter() with one argument, so it looks like dead code and may get removed while 5 → 6 upgrades are still supported.


This comment was created with the J!Tracker Application at issues.joomla.org/tracker/joomla-cms/48718.
avatar teddy-mere teddy-mere - change - 1 Nov 2026
Labels Added: PR-6.2-dev
avatar teddy-mere
teddy-mere - comment - 1 Nov 2026

Thanks for the testing and the suggestion.
I've added a comment above the $adapter === null :)

Add a Comment

Login with GitHub to post a comment