Skip to content

Commit

Permalink
fix(plugins): now checks plugin instances before parsing priorities
Browse files Browse the repository at this point in the history
The code was calling ElggPlugin methods without validating instances
  • Loading branch information
hypeJunction committed Jul 9, 2016
1 parent 056d2bb commit 26d21f8
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions engine/classes/ElggPluginPackage.php
Original file line number Diff line number Diff line change
Expand Up @@ -503,18 +503,25 @@ private function checkDepPlugin(array $dep, array $plugins, $inverse = false) {
private function checkDepPriority(array $dep, array $plugins, $inverse = false) {
// grab the \ElggPlugin using this package.
$plugin_package = elgg_get_plugin_from_id($this->getID());
$plugin_priority = $plugin_package->getPriority();
if (!$plugin_package) {
return array(
'status' => true,
'value' => 'uninstalled'
);
}

$test_plugin = elgg_get_plugin_from_id($dep['plugin']);

// If this isn't a plugin or the plugin isn't installed or active
// priority doesn't matter. Use requires to check if a plugin is active.
if (!$plugin_package || !$test_plugin || !$test_plugin->isActive()) {
if (!$test_plugin || !$test_plugin->isActive()) {
return array(
'status' => true,
'value' => 'uninstalled'
);
}

$plugin_priority = $plugin_package->getPriority();
$test_plugin_priority = $test_plugin->getPriority();

switch ($dep['priority']) {
Expand Down

0 comments on commit 26d21f8

Please sign in to comment.