From a2ca6d5ef96d936fe15ef583c742ab6a6e869527 Mon Sep 17 00:00:00 2001
From: Laurent Destailleur <eldy@destailleur.fr>
Date: Mon, 19 Jun 2017 12:50:13 +0200
Subject: [PATCH] Add warning in log if conf file setup not correct

---
 htdocs/main.inc.php | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/htdocs/main.inc.php b/htdocs/main.inc.php
index 022aa4d5e44..dc3467a185d 100644
--- a/htdocs/main.inc.php
+++ b/htdocs/main.inc.php
@@ -654,7 +654,11 @@ if (! defined('NOLOGIN'))
 	           if (constant('DOL_MAIN_URL_ROOT')) $relativepathstring = preg_replace('/^'.preg_quote(constant('DOL_MAIN_URL_ROOT'),'/').'/', '', $relativepathstring);
 	           $relativepathstring = preg_replace('/^custom\//', '', $relativepathstring);
                $relativepathstring = preg_replace('/^\//', '', $relativepathstring);
-               if (! empty($_SESSION['lastsearch_values_tmp_'.$relativepathstring]))
+               if (preg_match('/^https?:/', $relativepathstring))
+               {
+                   dol_syslog('Failted to save the search criteria. Calculation of relative page fails (check parameter $dolibarr_main_url_root in conf file match the URL you use in your browser).', LOG_WARNING);
+               }
+               elseif (! empty($_SESSION['lastsearch_values_tmp_'.$relativepathstring]))
                {
                    $_SESSION['lastsearch_values_'.$relativepathstring]=$_SESSION['lastsearch_values_tmp_'.$relativepathstring];
                    unset($_SESSION['lastsearch_values_tmp_'.$relativepathstring]);
-- 
GitLab