From 1fcb77427e0130ae9f7d1fec5da24d3db74b4e18 Mon Sep 17 00:00:00 2001 From: onli Date: Tue, 16 Mar 2021 19:36:54 +0100 Subject: [PATCH] php8 compat fix: $lang and $cond['joins'] unset before access --- include/functions_config.inc.php | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/include/functions_config.inc.php b/include/functions_config.inc.php index 37249fc2..24112f44 100644 --- a/include/functions_config.inc.php +++ b/include/functions_config.inc.php @@ -1055,7 +1055,9 @@ function serendipity_getSessionLanguage() { } // cache the result - if ($lang) $serendipity['detected_lang'] = $lang; + if (isset($lang) && $lang) { + $serendipity['detected_lang'] = $lang; + } // try configuration: blog default language if (empty($lang) && $serendipity['lang']) { @@ -1918,6 +1920,10 @@ function serendipity_ACL_SQL(&$cond, $append_category = false, $type = 'category $read_id_sql = 0; } + if (! array_key_exists('joins', $cond) ) { + $cond['joins'] = ''; + } + if ($append_category) { if ($append_category !== 'limited') { $cond['joins'] .= " LEFT JOIN {$serendipity['dbPrefix']}entrycat ec @@ -1941,10 +1947,6 @@ function serendipity_ACL_SQL(&$cond, $append_category = false, $type = 'category break; } - if (! array_key_exists('joins', $cond) ) { - $cond['joins'] = ''; - } - $cond['joins'] .= " LEFT JOIN {$serendipity['dbPrefix']}authorgroups AS acl_a ON acl_a.authorid = " . $read_id . " LEFT JOIN {$serendipity['dbPrefix']}access AS acl_acc