From 9523bf5fbd6793e82734bbedc6b66f034a05ee57 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Thu, 14 Sep 2017 10:23:17 +0200 Subject: [PATCH 1/3] Remove useless code --- test/phpunit/PricesTest.php | 3 --- 1 file changed, 3 deletions(-) diff --git a/test/phpunit/PricesTest.php b/test/phpunit/PricesTest.php index 50c0d20ad10..d3b1efaf072 100755 --- a/test/phpunit/PricesTest.php +++ b/test/phpunit/PricesTest.php @@ -1,7 +1,4 @@ * Copyright (C) 2015 Juanjo Menent * From fe1ce5b3ac41d99d531732bda017455e8ced459d Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Thu, 14 Sep 2017 11:44:47 +0200 Subject: [PATCH 2/3] Fix php 7.2 compatibility --- htdocs/core/lib/json.lib.php | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/htdocs/core/lib/json.lib.php b/htdocs/core/lib/json.lib.php index 6b868663aa7..ac2372c5825 100644 --- a/htdocs/core/lib/json.lib.php +++ b/htdocs/core/lib/json.lib.php @@ -42,19 +42,21 @@ if (! function_exists('json_encode')) * * @param mixed $elements PHP Object to json encode * @return string Json encoded string - * @deprecated PHP >= 5.3 supports native json_encode * @see json_encode() */ function dol_json_encode($elements) { - dol_syslog('dol_json_encode() is deprecated. Please update your code to use native json_encode().', LOG_WARNING); + dol_syslog("For better permorfance, enable the native json in your PHP", LOG_WARNING); - $num=count($elements); + $num=0; if (is_object($elements)) // Count number of properties for an object { - $num=0; foreach($elements as $key => $value) $num++; } + else + { + $num=count($elements); + } //var_dump($num); // determine type From 7d5dc08a0a71b8cd4c131c1dbce08e25f90c4a35 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Fri, 8 Sep 2017 14:45:11 +0200 Subject: [PATCH 3/3] Fix PHP7.2 --- htdocs/includes/tcpdi/tcpdi.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/includes/tcpdi/tcpdi.php b/htdocs/includes/tcpdi/tcpdi.php index 48fdd8198f5..999ff99ea5b 100644 --- a/htdocs/includes/tcpdi/tcpdi.php +++ b/htdocs/includes/tcpdi/tcpdi.php @@ -580,7 +580,7 @@ class TCPDI extends FPDF_TPL { * close all files opened by parsers */ function _closeParsers() { - if ($this->state > 2 && count($this->parsers) > 0) { + if ($this->state > 2 && is_array($this->parsers) && count($this->parsers) > 0) { $this->cleanUp(); return true; }