diff --git a/htdocs/core/lib/functions.lib.php b/htdocs/core/lib/functions.lib.php
index fd81560491d..f1da4c852a7 100644
--- a/htdocs/core/lib/functions.lib.php
+++ b/htdocs/core/lib/functions.lib.php
@@ -6899,12 +6899,12 @@ function dol_print_error($db = null, $error = '', $errors = null)
}
$out .= "" . $langs->trans("UserAgent") . ": " . (isset($_SERVER["HTTP_USER_AGENT"]) ? dol_htmlentities($_SERVER["HTTP_USER_AGENT"], ENT_COMPAT) : '') . "
\n";
$out .= "
\n";
- $out .= "" . $langs->trans("RequestedUrl") . ": " . dol_htmlentities($_SERVER["REQUEST_URI"], ENT_COMPAT) . "
\n";
+ $out .= "" . $langs->trans("RequestedUrl") . ": " . (isset($_SERVER["REQUEST_URI"]) ? dol_htmlentities($_SERVER["REQUEST_URI"], ENT_COMPAT) : '') . "
\n";
$out .= "" . $langs->trans("Referer") . ": " . (isset($_SERVER["HTTP_REFERER"]) ? dol_htmlentities($_SERVER["HTTP_REFERER"], ENT_COMPAT) : '') . "
\n";
$out .= "" . $langs->trans("MenuManager") . ": " . (isset($conf->standard_menu) ? dol_htmlentities($conf->standard_menu, ENT_COMPAT) : '') . "
\n";
$out .= "
\n";
- $syslog .= "url=" . dol_escape_htmltag($_SERVER["REQUEST_URI"]);
- $syslog .= ", query_string=" . dol_escape_htmltag($_SERVER["QUERY_STRING"]);
+ $syslog .= "url=" . (isset($_SERVER["REQUEST_URI"]) ? dol_escape_htmltag($_SERVER["REQUEST_URI"]) : '');
+ $syslog .= ", query_string=" . (isset($_SERVER["QUERY_STRING"]) ? dol_escape_htmltag($_SERVER["QUERY_STRING"]) : '');
} else { // Mode CLI
$out .= '> ' . $langs->transnoentities("ErrorInternalErrorDetected") . ":\n" . $argv[0] . "\n";
$syslog .= "pid=" . dol_getmypid();