NextDom/nextdom-core

plus de eqAnalyse

Opened this issue · 3 comments

Décrivez le bug
Page blanche quand on clique sur eqAnalyse

[03-Dec-2019 21:00:51 Europe/Berlin] PHP Fatal error: Uncaught Error: Call to a member function getStatus() on null in /usr/share/nextdom/src/Controller/Diagnostic/EqAnalyzeController.php:59
Stack trace:
#0 [internal function]: NextDom\Controller\Diagnostic\EqAnalyzeController::get(Array)
#1 /usr/share/nextdom/src/Helpers/PrepareView.php(341): call_user_func_array('NextDom\Control...', Array)
#2 /usr/share/nextdom/src/Helpers/PrepareView.php(286): NextDom\Helpers\PrepareView->getContentFromControllerRouteData(Object(Symfony\Component\Routing\Route), Array)
#3 /usr/share/nextdom/src/Helpers/PrepareView.php(661): NextDom\Helpers\PrepareView->getContentFromRoute('pages_routes.ym...', 'eqAnalyse', Array)
#4 /usr/share/nextdom/src/Helpers/PrepareView.php(468): NextDom\Helpers\PrepareView->getContent(Array, 'eqAnalyse', NULL)
#5 /usr/share/nextdom/src/Helpers/Router.php(155): NextDom\Helpers\PrepareView->showContent()
#6 /usr/share/nextdom/src/Helpers/Router.php(94): NextDom\Helpers\Router->desktopView()
#7 /usr/share/nextdom/index.php(66): NextDom\Helpers\Router->sh in /usr/share/nextdom/src/Controller/Diagnostic/EqAnalyzeController.php on line 59

Information matérielles

  • OS : Debian 9
  • Version NextDom : 0.6.0
Gis70 commented

Un peu plus d'info: si on a des commandes qui pointent vers un plugin + on désactive le plugin + on le supprime alors on devrait avoir un "file for plugin not found"

throw new CoreException('File ' . $pluginFile . ' for plugin ' . $purgedClassName . ' not found.');
mais ça n'est pas le cas (on déréférence des pointeurs nuls).

en modifiant vite fait src/Controller/Diagnostic/EqAnalyzeController.php c'est reparti:

diff --git a/src/Controller/Diagnostic/EqAnalyzeController.php b/src/Controller/Diagnostic/EqAnalyzeController.php
index 99a33b91..6b1ef607 100644
--- a/src/Controller/Diagnostic/EqAnalyzeController.php
+++ b/src/Controller/Diagnostic/EqAnalyzeController.php
@@ -56,7 +56,7 @@ class EqAnalyzeController extends BaseController

         $eqLogics = EqLogicManager::all();
         foreach ($eqLogics as $eqLogic) {
-            if ($eqLogic->getStatus('battery', -2) != -2) {
+            if ($eqLogic != null && $eqLogic->getStatus('battery', -2) != -2) {
                 $pageData['eqAnalyzeEqLogicList'][] = $eqLogic;
             }
         }
@@ -72,6 +72,8 @@ class EqAnalyzeController extends BaseController

         $cmdDataArray = [];
         foreach ($eqLogics as $eqLogic) {
+            if ($eqLogic == null)
+                continue;
             $cmdData = [];
             $cmdData['eqLogic'] = $eqLogic;
             $cmdData['infoCmds'] = [];
@@ -79,7 +81,7 @@ class EqAnalyzeController extends BaseController

             $eqlogicGetCmdInfo = $eqLogic->getCmd('info');
             foreach ($eqlogicGetCmdInfo as $cmd) {
-                if (count($cmd->getConfiguration('actionCheckCmd', array())) > 0) {
+                if ($cmd != null && count($cmd->getConfiguration('actionCheckCmd', array())) > 0) {
                     $data = [];
                     $data['cmd'] = $cmd;
                     $data['actions'] = [];
@@ -120,6 +122,8 @@ class EqAnalyzeController extends BaseController

         $eqLogicManagerAll = EqLogicManager::all();
         foreach ($eqLogicManagerAll as $eqLogic) {
+            if ($eqLogic == null)
+                continue;
             $hasSomeAlerts = 0;

             $listCmds = [];