From 521008a6981fa380fac78ffd74fa01bfd977d547 Mon Sep 17 00:00:00 2001
From: Laurent Destailleur <eldy@destailleur.fr>
Date: Sat, 1 Oct 2016 17:27:52 +0200
Subject: [PATCH] FIX #5746 chrome php Try a fix. Not sure it solved all
 problems reported

---
 htdocs/core/lib/functions.lib.php                   |  2 +-
 htdocs/core/modules/syslog/mod_syslog_chromephp.php | 11 +++++++++--
 2 files changed, 10 insertions(+), 3 deletions(-)

diff --git a/htdocs/core/lib/functions.lib.php b/htdocs/core/lib/functions.lib.php
index 8320e4ec672..e1e1b833248 100644
--- a/htdocs/core/lib/functions.lib.php
+++ b/htdocs/core/lib/functions.lib.php
@@ -5365,7 +5365,7 @@ function printCommonFooter($zone='private')
     	
     	print '<!-- If page_y set, we set scollbar with it -->'."\n";
     	print "page_y=getParameterByName('page_y', 0);";
-    	print "if (page_y > 0) $('html, body').scrollTop(page_y);";
+    	print "if (page_y > 0) $('html, body').scrollTop(page_y);\n";
     	
     	print '<!-- Set handler to add page_y param on some a href links -->'."\n";
     	print 'jQuery(".reposition").click(function() {
diff --git a/htdocs/core/modules/syslog/mod_syslog_chromephp.php b/htdocs/core/modules/syslog/mod_syslog_chromephp.php
index adcaa9d7f00..42a660ab0ae 100644
--- a/htdocs/core/modules/syslog/mod_syslog_chromephp.php
+++ b/htdocs/core/modules/syslog/mod_syslog_chromephp.php
@@ -121,7 +121,14 @@ class mod_syslog_chromephp extends LogHandler implements LogHandlerInterface
 
 		if (! file_exists($conf->global->SYSLOG_CHROMEPHP_INCLUDEPATH.'/ChromePhp.php') && ! file_exists($conf->global->SYSLOG_CHROMEPHP_INCLUDEPATH.'/ChromePhp.class.php'))
 		{
-			$errors[] = $langs->trans("ErrorFailedToOpenFile", 'ChromePhp.class.php or ChromePhp.php');
+			if (is_object($langs))   // $langs may not be defined yet.
+			{
+			    $errors[] = $langs->trans("ErrorFailedToOpenFile", 'ChromePhp.class.php or ChromePhp.php');
+			}
+			else
+			{
+		        $errors[] = "ErrorFailedToOpenFile ChromePhp.class.php or ChromePhp.php";
+			}
 		}
 
 		return $errors;
@@ -151,7 +158,7 @@ class mod_syslog_chromephp extends LogHandler implements LogHandlerInterface
 		    $res = @include_once('ChromePhp.php');
 		    if (! $res) $res=@include_once('ChromePhp.class.php');
 			set_include_path($oldinclude);
-
+			
 			ob_start();	// To be sure headers are not flushed until all page is completely processed
 			if ($content['level'] == LOG_ERR) ChromePhp::error($content['message']);
 			elseif ($content['level'] == LOG_WARNING) ChromePhp::warn($content['message']);
-- 
GitLab