From 82e19879d56921307d4caa29331f7f42f26ed708 Mon Sep 17 00:00:00 2001 From: Regis Houssin Date: Sat, 21 May 2022 23:27:19 +0200 Subject: [PATCH] FIX php8.1 warning --- htdocs/admin/dict.php | 6 +++++- htdocs/user/perms.php | 2 +- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/htdocs/admin/dict.php b/htdocs/admin/dict.php index 2ac4fa76682..00eebf78f10 100644 --- a/htdocs/admin/dict.php +++ b/htdocs/admin/dict.php @@ -585,6 +585,10 @@ complete_dictionary_with_modules($taborder, $tabname, $tablib, $tabsql, $tabsqls $i = 0; foreach ($tabcomplete as $key => $value) { $i++; + // When a dictionnary is commented + if (!isset($tabcond[$i])) { + continue; + } $tabcomplete[$key]['id'] = $i; $tabcomplete[$key]['cond'] = $tabcond[$i]; $tabcomplete[$key]['rowid'] = $tabrowid[$i]; @@ -607,7 +611,7 @@ if (empty($sortfield)) { $tmp1 = explode(',', empty($tabcomplete[$keytable]['sqlsort']) ? '' : $tabcomplete[$keytable]['sqlsort']); $tmp2 = explode(' ', $tmp1[0]); $sortfield = preg_replace('/^.*\./', '', $tmp2[0]); - $sortorder = $tmp2[1]; + $sortorder = (!empty($tmp2[1]) ? $tmp2[1] : ''); //var_dump($sortfield);var_dump($sortorder); } diff --git a/htdocs/user/perms.php b/htdocs/user/perms.php index 889599e2fa9..55876016680 100644 --- a/htdocs/user/perms.php +++ b/htdocs/user/perms.php @@ -340,7 +340,7 @@ if ($result) { $obj = $db->fetch_object($result); // If line is for a module that does not exist anymore (absent of includes/module), we ignore it - if (empty($modules[$obj->module])) { + if (!isset($obj->module) || empty($modules[$obj->module])) { $i++; continue; }