bug Small PR-4.4-dev PR-5.2-dev Pending

User tests: Successful: Unsuccessful:

avatar BrainforgeUK
BrainforgeUK
2 Oct 2022

Pull Request for Issue #38840 .

Summary of Changes

Gracefully handle error on module uninstallation due to error in module XML manifest file.

$clientPath = ($this->parent->extension->client_id ? JPATH_ADMINISTRATOR : JPATH_SITE);
$source = $path ?: $clientPath . '/modules/' . $extension;
      ... existing ...
$client = (string) $this->getManifest()->attributes()->client;
if (strlen($client))
{
    $this->doLoadLanguage($extension, $source, \constant('JPATH_' . strtoupper($client)));
}
else {
    $this->doLoadLanguage($extension, $source, $clientPath);
}

Testing Instructions

Install a module with this in the manifest:

Instead of:

Then try to uninstall it.

Actual result BEFORE applying this Pull Request

Uninstallation fails.

Get error Undefined constant "JPATH_"

1 () JROOT\libraries\src\Installer\Adapter\ModuleAdapter.php:370
2 constant() JROOT\libraries\src\Installer\Adapter\ModuleAdapter.php:370
3 Joomla\CMS\Installer\Adapter\ModuleAdapter->loadLanguage() JROOT\libraries\src\Installer\Adapter\ModuleAdapter.php:525
4 Joomla\CMS\Installer\Adapter\ModuleAdapter->setupUninstall() JROOT\libraries\src\Installer\InstallerAdapter.php:1150
5 Joomla\CMS\Installer\InstallerAdapter->uninstall() JROOT\libraries\src\Installer\Installer.php:875
6 Joomla\CMS\Installer\Installer->uninstall() JROOT\administrator\components\com_installer\src\Model\ManageModel.php:262

This is due to missing client="site" in module manifest.

Expected result AFTER applying this Pull Request

Uninstallation succeeds.

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 BrainforgeUK BrainforgeUK - open - 2 Oct 2022
avatar BrainforgeUK BrainforgeUK - change - 2 Oct 2022
Status New Pending
avatar joomla-cms-bot joomla-cms-bot - change - 2 Oct 2022
Category Libraries
avatar richard67
richard67 - comment - 2 Oct 2022

@BrainforgeUK Please fix the code style errors reported by drone here: https://ci.joomla.org/joomla/joomla-cms/58326/1/8 . We meanwhile use spaces (4 for each level) for indentation and not tabs like in past.

avatar richard67
richard67 - comment - 2 Oct 2022

@BrainforgeUK It seems the description is missing some details which are not shown because they contain code or markup. Please quote them so that they are shown, otherwise no reader understands the description of this PR.

avatar BrainforgeUK BrainforgeUK - change - 2 Oct 2022
Labels Added: PR-4.3-dev
avatar BrainforgeUK BrainforgeUK - change - 2 Oct 2022
The description was changed
avatar BrainforgeUK BrainforgeUK - edited - 2 Oct 2022
avatar BrainforgeUK BrainforgeUK - change - 2 Oct 2022
The description was changed
avatar BrainforgeUK BrainforgeUK - edited - 2 Oct 2022
avatar BrainforgeUK BrainforgeUK - change - 2 Oct 2022
The description was changed
avatar BrainforgeUK BrainforgeUK - edited - 2 Oct 2022
avatar BrainforgeUK
BrainforgeUK - comment - 2 Oct 2022

Tabs removed and pull request description improved.

avatar richard67
richard67 - comment - 2 Oct 2022

@BrainforgeUK The pull request description still does not show your code because you haven't quoted it into `` quotes.

avatar richard67
richard67 - comment - 2 Oct 2022

P.S. You also haven't made a selection among the check boxes if there are documentation changes required or not.

avatar BrainforgeUK BrainforgeUK - change - 3 Oct 2022
The description was changed
avatar BrainforgeUK BrainforgeUK - edited - 3 Oct 2022
avatar BrainforgeUK BrainforgeUK - change - 3 Oct 2022
The description was changed
avatar BrainforgeUK BrainforgeUK - edited - 3 Oct 2022
avatar BrainforgeUK BrainforgeUK - change - 3 Oct 2022
The description was changed
avatar BrainforgeUK BrainforgeUK - edited - 3 Oct 2022
avatar BrainforgeUK BrainforgeUK - change - 27 May 2023
Labels Added: bug ?
avatar BrainforgeUK BrainforgeUK - change - 27 May 2023
The description was changed
avatar BrainforgeUK BrainforgeUK - edited - 27 May 2023
avatar BrainforgeUK
BrainforgeUK - comment - 27 May 2023

What's happending with this pull request?

avatar alikon
alikon - comment - 27 May 2023

as usual, it needs 2 successful tests, and/or a RL decision

avatar alikon
alikon - comment - 27 May 2023

also
can you please have a look at https://ci.joomla.org/joomla/joomla-cms/66125/1/8

avatar obuisard obuisard - change - 15 Jul 2023
Title
[4.2] #38840 Module uninstallation error handling
[4.3] #38840 Module uninstallation error handling
avatar obuisard obuisard - edited - 15 Jul 2023
avatar BrainforgeUK
BrainforgeUK - comment - 11 Aug 2023

Does this require any action on my part?

avatar HLeithner
HLeithner - comment - 30 Sep 2023

This pull request has been automatically rebased to 4.4-dev.

avatar heelc29
heelc29 - comment - 24 Oct 2023

Is this PR similar to #36692?

avatar HLeithner HLeithner - change - 24 Apr 2024
Title
[4.3] #38840 Module uninstallation error handling
[4.4] #38840 Module uninstallation error handling
avatar HLeithner HLeithner - edited - 24 Apr 2024
avatar HLeithner
HLeithner - comment - 15 Nov 2024

This pull request has been automatically rebased to 5.2-dev.

avatar HLeithner HLeithner - change - 15 Nov 2024
Title
[4.4] #38840 Module uninstallation error handling
[5.2] #38840 Module uninstallation error handling
avatar HLeithner HLeithner - edited - 15 Nov 2024
avatar Hackwar
Hackwar - comment - 16 Jan 2025

Can you please fix the conflict?

avatar joomdonation joomdonation - change - 18 Jan 2025
Status Pending Closed
Closed_Date 0000-00-00 00:00:00 2025-01-18 08:31:07
Closed_By joomdonation
Labels Added: Small PR-4.4-dev PR-5.2-dev
Removed: PR-4.3-dev ?
avatar joomdonation joomdonation - close - 18 Jan 2025
avatar joomdonation
joomdonation - comment - 18 Jan 2025

Thanks @BrainforgeUK for the PR. As mentioned by @heelc29, the issue was fixed by the already merged PR #36692 (the code is a bit different, but fixed the same issue when client attribute is missing from the module).

For that reason, I'm closing this PR. Feel free to re-open it if needed.

Thanks !

Add a Comment

Login with GitHub to post a comment