Skip to content

Commit

Permalink
[5.0] Show proper error message when package is installed with no ext…
Browse files Browse the repository at this point in the history
…ensions (#42337)

* Update PackageAdapter.php

Avoid fatal PHP error on malformed manifest.

* Update PackageAdapter.php

Fixed issue which caused JSON parse error.

* Update PackageAdapter.php

Removed duplicated code.
  • Loading branch information
BrainforgeUK committed Dec 16, 2023
1 parent f267acd commit 98f264c
Showing 1 changed file with 9 additions and 4 deletions.
13 changes: 9 additions & 4 deletions libraries/src/Installer/Adapter/PackageAdapter.php
Original file line number Diff line number Diff line change
Expand Up @@ -115,15 +115,20 @@ protected function checkExtensionInFilesystem()
*/
protected function copyBaseFiles()
{
$folder = (string) $this->getManifest()->files->attributes()->folder;
$source = $this->parent->getPath('source');

if ($folder) {
$source .= '/' . $folder;
$attributes = $this->getManifest()->files->attributes();

if ($attributes) {
$folder = (string) $attributes->folder;

if ($folder) {
$source .= '/' . $folder;
}
}

// Install all necessary files
if (!\count($this->getManifest()->files->children())) {
if (!$this->getManifest()->files->count()) {
throw new \RuntimeException(
Text::sprintf(
'JLIB_INSTALLER_ABORT_PACK_INSTALL_NO_FILES',
Expand Down

0 comments on commit 98f264c

Please sign in to comment.