NextDom / nextdom-core

NextDom Core >>
https://www.nextdom.org/
GNU General Public License v3.0
21 stars 13 forks source link

plus de eqAnalyse #1577

Open fensoft opened 4 years ago

fensoft commented 4 years ago

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

Gis70 commented 4 years ago

Salut,

C'est ok chez moi avec debian 10 et NextDom 0.6.0

Le mar. 3 déc. 2019 à 21:02, fensoft notifications@github.com a écrit :

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 https://github.com/NextDom/nextdom-core/pull/1

/usr/share/nextdom/src/Helpers/PrepareView.php(341): call_user_func_array('NextDom\Control...', Array)

2 https://github.com/NextDom/nextdom-core/issues/2

/usr/share/nextdom/src/Helpers/PrepareView.php(286): NextDom\Helpers\PrepareView->getContentFromControllerRouteData(Object(Symfony\Component\Routing\Route), Array)

3 https://github.com/NextDom/nextdom-core/issues/3

/usr/share/nextdom/src/Helpers/PrepareView.php(661): NextDom\Helpers\PrepareView->getContentFromRoute('pages_routes.ym...', 'eqAnalyse', Array)

4 https://github.com/NextDom/nextdom-core/pull/4

/usr/share/nextdom/src/Helpers/PrepareView.php(468): NextDom\Helpers\PrepareView->getContent(Array, 'eqAnalyse', NULL)

5 https://github.com/NextDom/nextdom-core/issues/5

/usr/share/nextdom/src/Helpers/Router.php(155): NextDom\Helpers\PrepareView->showContent()

6 https://github.com/NextDom/nextdom-core/issues/6

/usr/share/nextdom/src/Helpers/Router.php(94): NextDom\Helpers\Router->desktopView()

7 https://github.com/NextDom/nextdom-core/issues/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

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/NextDom/nextdom-core/issues/1577?email_source=notifications&email_token=AD6SCTHSN2BOS6SNC6ZSGODQW23ONA5CNFSM4JU5YIX2YY3PNVWWK3TUL52HS4DFUVEXG43VMWVGG33NNVSW45C7NFSM4H5ZGSTA, or unsubscribe https://github.com/notifications/unsubscribe-auth/AD6SCTB5I4JPMBBU2LK6VGDQW23ONANCNFSM4JU5YIXQ .

fensoft commented 4 years ago

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" https://github.com/NextDom/nextdom-core/blob/05a750961e93996aceba1180b029c2935fe5ae1e/src/core.php#L101 mais ça n'est pas le cas (on déréférence des pointeurs nuls).

fensoft commented 4 years ago

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 = [];