Skip to content

Commit

Permalink
[4.4] json_decode of NULL in InstallerScript::getItemArray() (#40527)
Browse files Browse the repository at this point in the history
* json_decode of NULL

* Check for name in Installer Script
  • Loading branch information
Denitz committed Dec 7, 2023
1 parent 90f70c1 commit c4260cb
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions libraries/src/Installer/InstallerScript.php
Original file line number Diff line number Diff line change
Expand Up @@ -141,7 +141,7 @@ public function preflight($type, $parent)

// Abort if the extension being installed is not newer than the currently installed version
if (!$this->allowDowngrades && strtolower($type) === 'update') {
$manifest = $this->getItemArray('manifest_cache', '#__extensions', 'element', $this->extension);
$manifest = $this->getItemArray('manifest_cache', '#__extensions', 'name', $this->extension);

// Check whether we have an old release installed and skip this check when this here is the initial install.
if (!isset($manifest['version'])) {
Expand Down Expand Up @@ -301,7 +301,9 @@ public function getItemArray($element, $table, $column, $identifier)
$db->setQuery($query);

// Load the single cell and json_decode data
return json_decode($db->loadResult(), true);
$result = $db->loadResult();

return $result === null ? [] : json_decode($result, true);
}

/**
Expand Down

0 comments on commit c4260cb

Please sign in to comment.