From 5cb38ece19b6922a2646ca45a01fbde90b874ae4 Mon Sep 17 00:00:00 2001
From: Laurent Destailleur <eldy@destailleur.fr>
Date: Sun, 21 May 2017 19:37:15 +0200
Subject: [PATCH] Fix travis errors

---
 htdocs/core/lib/functions.lib.php             | 2 +-
 htdocs/core/modules/DolibarrModules.class.php | 4 ++--
 2 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/htdocs/core/lib/functions.lib.php b/htdocs/core/lib/functions.lib.php
index 14f61d99590..8462cdc76ff 100644
--- a/htdocs/core/lib/functions.lib.php
+++ b/htdocs/core/lib/functions.lib.php
@@ -281,7 +281,7 @@ function GETPOST($paramname, $check='', $method=0, $filter=NULL, $options=NULL)
     	$relativepathstring = preg_replace('/^\//', '', $relativepathstring);
 	
     	// Retrieve values if restore_lastsearch_values is set and there is saved values
-    	if ($_GET['restore_lastsearch_values'] && ! empty($_SESSION['lastsearch_values_'.$relativepathstring]))        // Keep $_GET here
+    	if (! empty($_GET['restore_lastsearch_values']) && ! empty($_SESSION['lastsearch_values_'.$relativepathstring]))        // Keep $_GET here
     	{
 	        $tmp=json_decode($_SESSION['lastsearch_values_'.$relativepathstring], true);
 	        if (is_array($tmp))
diff --git a/htdocs/core/modules/DolibarrModules.class.php b/htdocs/core/modules/DolibarrModules.class.php
index cdb4ea33f73..71de341a769 100644
--- a/htdocs/core/modules/DolibarrModules.class.php
+++ b/htdocs/core/modules/DolibarrModules.class.php
@@ -848,8 +848,8 @@ class DolibarrModules           // Can not be abstract, because we need to insta
         $resql=$this->db->query($sql);
         if (! $resql) $err++;
 
-        $note=json_encode(array('authorid'=>$user->id, 'ip'=>(empty($_SERVER['REMOTE_ADDR'])?'':$_SERVER['REMOTE_ADDR'])));
-        
+        $note=json_encode(array('authorid'=>(is_object($user)?$user->id:0), 'ip'=>(empty($_SERVER['REMOTE_ADDR'])?'':$_SERVER['REMOTE_ADDR'])));
+
         $sql = "INSERT INTO ".MAIN_DB_PREFIX."const (name, value, visible, entity, note) VALUES";
         $sql.= " (".$this->db->encrypt($this->const_name,1);
         $sql.= ", ".$this->db->encrypt('1',1);
-- 
GitLab