| 12
 3
 4
 5
 6
 7
 8
 9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 20
 21
 22
 23
 24
 25
 26
 27
 28
 29
 30
 31
 32
 33
 34
 35
 36
 
 | --- a/include/class_plugin.inc
+++ b/include/class_plugin.inc
@@ -1725,12 +1725,19 @@
                   // Close the process and check its return value
                   $returnCode = proc_close($process);
                   $returnOutput = preg_split("/\n/", $arr,0,PREG_SPLIT_NO_EMPTY);
+                  if (!is_array($returnOutput)) {
+                    $returnOutput = array(); // Make sure returnOutput is always an array.
+                  }
+
                   $errorOutput = preg_split("/\n/",$err,0,PREG_SPLIT_NO_EMPTY);
+                  if (!is_array($errorOutput)) {
+                    $errorOutput = array(); // Make sure returnOutput is always an array.
+                  }
               }
 
               if($returnCode != 0){
-                  @DEBUG (DEBUG_SHELL, __LINE__, __FUNCTION__, __FILE__, $command, "Execution failed code: ".$returnCode);
-                  @DEBUG (DEBUG_SHELL, __LINE__, __FUNCTION__, __FILE__, $command, "Result: ".$err);
+                  @DEBUG (DEBUG_SHELL, __LINE__, __FUNCTION__, __FILE__, $command, "Execution failed code: " . $returnCode);
+                  @DEBUG (DEBUG_SHELL, __LINE__, __FUNCTION__, __FILE__, $command, "Failure result: " . $err);
                   if($displayErrors){
                       $message= msgPool::cmdexecfailed($cmd,$command, get_class($plugin));
                       msg_dialog::display(_("Error"), $message, ERROR_DIALOG);
@@ -1738,8 +1745,9 @@
                       $message= msgPool::cmdexecfailed($cmd,"...", get_class($plugin));
                       msg_dialog::display(_("Error"), $message, ERROR_DIALOG);
                   }
-              }elseif(is_array($arr)){
-                  @DEBUG (DEBUG_SHELL, __LINE__, __FUNCTION__, __FILE__, $command, "Result: ".$arr);
+              } else {
+                @DEBUG (DEBUG_SHELL, __LINE__, __FUNCTION__, __FILE__, $command, "Success result (stdout):<br>" . implode("<br>", $returnOutput));
+                @DEBUG (DEBUG_SHELL, __LINE__, __FUNCTION__, __FILE__, $command, "Success result (stderr):<br>" . implode("<br>", $errorOutput));
               }
           } elseif($displayErrors) {
               $message= msgPool::cmdinvalid($cmd,$command, get_class($plugin));
 |