User tests: Successful: Unsuccessful:
Pull Request resolves #48530.
This PR is the same as #48673 by @tejaschavan724, on 6.2 branch (not 6.1).
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():
$adapter === null:
$this->adapters, it returns true.$this->classprefix . ucfirst($name) . 'Adapter') and registers it.$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.
$installer->setAdapter('file') with a single argument succeeds without throwing an ArgumentCountError.$installer->setAdapter('custom', CustomAdapter::class) or $installer->setAdapter('custom', $adapterObject) continues to work as expected.php cli/joomla.php core:update) and verify the update completes the finalisation phase without halting on setAdapter().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
The update completes successfully without argument count errors.
Please select:
| Status | New | ⇒ | Pending |
| Category | ⇒ | Libraries |
I have tested this item ✅ successfully on b1cd344
Verdict: works as intended.
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.
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.
| Labels |
Added:
PR-6.2-dev
|
||
Thanks for the testing and the suggestion.
I've added a comment above the $adapter === null :)
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),
compatdisabled /compat6enabled, custom update source serving the official 6.2.0 update package, thenphp cli/joomla.php core:update:Installer.phpArgumentCountError: Too few arguments to function Joomla\CMS\Installer\Installer::setAdapter(), 1 passed in …/UpdateModel.php on line 946[OK] Joomla core updated successfully!5.4.9-2026-08-11)6.2.0-2026-09-15)Testing instructions 1 and 2 (script on the updated site):
setAdapter('file')returnstrue;setAdapter('custom', FileAdapter::class)andsetAdapter('custom2', $object)work as before; an unknown class returnsfalse. Side effect: names are now lowercased, sosetAdapter('Mixed', …)followed bygetAdapter('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 === nullbranch 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 callssetAdapter()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.