Permalink
Browse files

fix(plugins): now checks plugin instances before parsing priorities

The code was calling ElggPlugin methods without validating instances
  • Loading branch information...
hypeJunction committed Jul 9, 2016
1 parent 056d2bb commit 26d21f886c809517890e8264ee4a6181293cad50
Showing with 9 additions and 2 deletions.
  1. +9 −2 engine/classes/ElggPluginPackage.php
@@ -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']) {

0 comments on commit 26d21f8

Please sign in to comment.