Просмотр исходного кода

Show debug trace when debug mode on for check_return_code

Robert-Jan de Dreu 1 год назад
Родитель
Сommit
c42459af7d
2 измененных файлов с 7 добавлено и 0 удалено
  1. 1 0
      web/edit/server/index.php
  2. 6 0
      web/inc/main.php

+ 1 - 0
web/edit/server/index.php

@@ -308,6 +308,7 @@ if (!empty($_POST["save"])) {
 		unset($output);
 		$v_hostname = $_POST["v_hostname"];
 	}
+
 	if ($_SESSION["WEB_BACKEND"] == "php-fpm") {
 		// Install/remove php versions
 		if (empty($_SESSION["error_msg"])) {

+ 6 - 0
web/inc/main.php

@@ -179,6 +179,12 @@ function check_return_code($return_var, $output) {
 		if (empty($error)) {
 			$error = sprintf(_("Error code: %s"), $return_var);
 		}
+
+		// Add backtrace if debug mode is activated to find out the cause
+		if ($_SESSION["DEBUG_MODE"] == "true") {
+			$error .= " | DEBUG BACKTRACE: " . var_export(debug_backtrace(), true);
+		}
+
 		$_SESSION["error_msg"] = $error;
 	}
 }