From e612f53494815752782977d120bfe37f0213885c Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Mon, 14 Dec 2020 13:01:25 +0100 Subject: [PATCH] Fix warning --- htdocs/core/lib/functions.lib.php | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/htdocs/core/lib/functions.lib.php b/htdocs/core/lib/functions.lib.php index e67269b71ba..f846ea55787 100644 --- a/htdocs/core/lib/functions.lib.php +++ b/htdocs/core/lib/functions.lib.php @@ -5595,7 +5595,7 @@ function get_exdir($num, $level, $alpha, $withoutslash, $object, $modulepart = ' // Here, $object->id, $object->ref and $modulepart are required. //var_dump($modulepart); if (!in_array($modulepart, array('product'))) { // Test to remove - $path = dol_sanitizeFileName(empty($object->ref) ? $object->id : $object->ref); + $path = dol_sanitizeFileName(empty($object->ref) ? (string) $object->id : $object->ref); } } @@ -7127,10 +7127,11 @@ function dol_sort_array(&$array, $index, $order = 'asc', $natsort = 0, $case_sen */ function utf8_check($str) { + $str = (string) $str; // Sometimes string is an int. + // We must use here a binary strlen function (so not dol_strlen) $strLength = dol_strlen($str); - for ($i = 0; $i < $strLength; $i++) - { + for ($i = 0; $i < $strLength; $i++) { if (ord($str[$i]) < 0x80) continue; // 0bbbbbbb elseif ((ord($str[$i]) & 0xE0) == 0xC0) $n = 1; // 110bbbbb elseif ((ord($str[$i]) & 0xF0) == 0xE0) $n = 2; // 1110bbbb