Plugin : diagrelationnel
Version beta du 2024-02-26 20:25:45
Bonjour @Bison , je constate des erreurs qui interviennent dans le log cron_execution (ainsi que http.error lors d’un save eqLogic).
PHP Warning: Invalid argument supplied for foreach() in /var/www/html/plugins/diagrelationnel/core/class/diagrelationnel.class.php on line 426
PHP Warning: Invalid argument supplied for foreach() in /var/www/html/plugins/diagrelationnel/core/class/diagrelationnel.class.php on line 461
Rien de bien méchant, j’ai voulu te faire un PR, mais je ne trouve par le repo !
Ligne 83 :
function get_use($_sc) {
$use = $_sc->getUse();
foreach ($use['scenario'] as $scenarioLink) {
if ($scenarioLink->getId() == $_sc->getId()) {
continue;
}
$arr[] = $scenarioLink->getId();
}
return $arr;
}
Ligne 94 :
function get_usedBy($_sc) {
$usedBy = $_sc->getUsedBy();
foreach ($usedBy['scenario'] as $scenarioLink) {
if ($scenarioLink->getId() == $_sc->getId()) {
continue;
}
$arr[] = $scenarioLink->getId();
}
return $arr;
}
Dans ces 2 fonctions il faudrait initier le tableau $arr
:
$arr = array();
PHP Warning: Invalid argument supplied for foreach() in /var/www/html/plugins/diagrelationnel/core/class/diagrelationnel.class.php on line 131
PHP Warning: Invalid argument supplied for foreach() in /var/www/html/plugins/diagrelationnel/core/class/diagrelationnel.class.php on line 145
Ligne 131 :
foreach ($cmdArray['configuration']['jeedomPreExecCmd'] as $actionCmd) {
try {
if ($actionCmd['cmd'] == 'scenario' && $actionCmd['options']['scenario_id'] == $_id) {
$action = array(
'cmdId' => $cmd->getId(),
'name' => $cmd->getEqLogic()->getHumanName() . ' [' . $cmd->getName() . ']',
'enable' => $actionCmd['options']['enable'],
'type' => 'jeedomPreExecCmd'
);
array_push($return['definedAction'], $action);
}
} catch (Exception $e) {
}
}
Ligne 145 :
foreach ($cmdArray['configuration']['jeedomPostExecCmd'] as $actionCmd) {
try {
if ($actionCmd['cmd'] == 'scenario' && $actionCmd['options']['scenario_id'] == $_id) {
$action = array(
'cmdId' => $cmd->getId(),
'name' => $cmd->getEqLogic()->getHumanName() . ' [' . $cmd->getName() . ']',
'enable' => $actionCmd['options']['enable'],
'type' => 'jeedomPostExecCmd'
);
array_push($return['definedAction'], $action);
}
} catch (Exception $e) {
}
}
jeedomPreExecCmd
& jeedomPostExecCmd
n’existe pas obligatoirement, il faudrait faire un isset() avant de lancer le foreach.
Bon W.E.