diff --git a/classes/context/Context.class.php b/classes/context/Context.class.php index 1fbf807a4..22c64a8bf 100644 --- a/classes/context/Context.class.php +++ b/classes/context/Context.class.php @@ -1686,7 +1686,7 @@ class Context for($i = 0; $i < $num_args; $i += 2) { $key = $args_list[$i]; - $val = trim($args_list[$i + 1]); + $val = trim($args_list[$i + 1] ?? ''); if ($val === '') { unset($get_vars[$key]); diff --git a/classes/display/HTMLDisplayHandler.php b/classes/display/HTMLDisplayHandler.php index 325d90306..d47da79a0 100644 --- a/classes/display/HTMLDisplayHandler.php +++ b/classes/display/HTMLDisplayHandler.php @@ -107,7 +107,8 @@ class HTMLDisplayHandler 'dispPageAdminMobileContentModify' => true, 'dispPageAdminMobileContent' => true, ); - if(Context::get('module') != 'admin' && strpos(Context::get('act'), 'Admin') > 0 && !isset($x_exclude_actions[Context::get('act')])) + $current_act = Context::get('act') ?? ''; + if(Context::get('module') != 'admin' && strpos($current_act, 'Admin') !== false && !isset($x_exclude_actions[$current_act])) { $output = '
' . $output . '
'; } diff --git a/classes/module/ModuleHandler.class.php b/classes/module/ModuleHandler.class.php index 95ab2e073..69f3b697f 100644 --- a/classes/module/ModuleHandler.class.php +++ b/classes/module/ModuleHandler.class.php @@ -1109,7 +1109,7 @@ class ModuleHandler extends Handler { if($val->type == 'image') { - if(strncmp('./files/attach/images/', $val->value, 22) === 0) + if(strncmp('./files/attach/images/', $val->value ?? '', 22) === 0) { $val->value = Context::getRequestUri() . substr($val->value, 2); } diff --git a/classes/page/PageHandler.class.php b/classes/page/PageHandler.class.php index d714c8637..fd49df525 100644 --- a/classes/page/PageHandler.class.php +++ b/classes/page/PageHandler.class.php @@ -100,7 +100,7 @@ class PageHandler extends Handler implements Iterator * * @return void */ - public function rewind() + public function rewind(): void { $this->point = 0; } @@ -141,7 +141,7 @@ class PageHandler extends Handler implements Iterator * * @return void */ - public function next() + public function next(): void { $this->point++; } diff --git a/common/framework/parsers/EditorComponentParser.php b/common/framework/parsers/EditorComponentParser.php index 0ab4c73fd..8c138f315 100644 --- a/common/framework/parsers/EditorComponentParser.php +++ b/common/framework/parsers/EditorComponentParser.php @@ -34,19 +34,19 @@ class EditorComponentParser extends BaseParser // Get basic information. $info->title = self::_getChildrenByLang($xml, 'title', $lang); $info->description = self::_getChildrenByLang($xml, 'description', $lang); - $info->version = trim($xml->version); + $info->version = trim($xml->version ?? ''); $info->date = date('Ymd', strtotime($xml->date . 'T12:00:00Z')); - $info->homepage = trim($xml->homepage); - $info->license = trim($xml->license); - $info->license_link = trim($xml->license['link']); + $info->homepage = trim($xml->homepage ?? ''); + $info->license = trim($xml->license ?? ''); + $info->license_link = trim($xml->license['link'] ?? ''); $info->author = array(); foreach ($xml->author as $author) { $author_info = new \stdClass; $author_info->name = self::_getChildrenByLang($author, 'name', $lang); - $author_info->email_address = trim($author['email_address']); - $author_info->homepage = trim($author['link']); + $author_info->email_address = trim($author['email_address'] ?? ''); + $author_info->homepage = trim($author['link'] ?? ''); $info->author[] = $author_info; } diff --git a/common/functions.php b/common/functions.php index 42673fb97..e4290344f 100644 --- a/common/functions.php +++ b/common/functions.php @@ -257,7 +257,7 @@ function escape_dqstr($str) */ function explode_with_escape($delimiter, $str, $limit = 0, $escape_char = '\\') { - if ($limit < 1) $limit = null; + if ($limit < 1) $limit = 0; $result = array(); $split = preg_split('/(?= $mod) { - $output .= getNumberingPath((int)$no / $mod, $size); + $output .= getNumberingPath(intval($no / $mod), $size); } return $output; }