Fix deprecation warnings in PHP 8.2

This commit is contained in:
Kijin Sung 2023-01-17 00:15:12 +09:00
parent 6c844f91ef
commit 651238916b
8 changed files with 17 additions and 23 deletions

View file

@ -229,8 +229,8 @@ class XmlJsFilter extends XeXmlParser
continue;
}
$rule = trim($attrs->rule ? $attrs->rule : $attrs->filter);
$equalto = trim($attrs->equalto);
$rule = trim(strval($attrs->rule ? $attrs->rule : $attrs->filter));
$equalto = trim(strval($attrs->equalto));
$field = array();
@ -387,7 +387,7 @@ class XmlJsFilter extends XeXmlParser
$js_messages[] = sprintf("v.cast('ADD_MESSAGE',['%s','%s']);", $key, $val);
}
$callback_func = $xml_obj->filter->response->attrs->callback_func;
$callback_func = $xml_obj->filter->response->attrs->callback_func ?? null;
if(!$callback_func)
{
$callback_func = "filterAlertMessage";

View file

@ -606,11 +606,11 @@ function utf8_check($str)
{
if (function_exists('mb_check_encoding'))
{
return mb_check_encoding($str, 'UTF-8');
return mb_check_encoding((string)$str, 'UTF-8');
}
else
{
return ($str === @iconv('UTF-8', 'UTF-8', $str));
return ($str === @iconv('UTF-8', 'UTF-8', (string)$str));
}
}
@ -659,7 +659,7 @@ function utf8_mbencode($str)
$bytes = array(ord($m[0][0]), ord($m[0][1]), ord($m[0][2]), ord($m[0][3]));
$codepoint = ((0x07 & $bytes[0]) << 18) + ((0x3F & $bytes[1]) << 12) + ((0x3F & $bytes[2]) << 6) + (0x3F & $bytes[3]);
return '&#x' . dechex($codepoint) . ';';
}, $str);
}, (string)$str);
}
/**
@ -672,7 +672,7 @@ function utf8_mbencode($str)
*/
function utf8_normalize_spaces($str, $multiline = false)
{
return $multiline ? preg_replace('/((?!\x0A)[\pZ\pC])+/u', ' ', $str) : preg_replace('/[\pZ\pC]+/u', ' ', $str);
return $multiline ? preg_replace('/((?!\x0A)[\pZ\pC])+/u', ' ', (string)$str) : preg_replace('/[\pZ\pC]+/u', ' ', (string)$str);
}
/**
@ -684,7 +684,7 @@ function utf8_normalize_spaces($str, $multiline = false)
*/
function utf8_trim($str)
{
return preg_replace('/^[\s\pZ\pC]+|[\s\pZ\pC]+$/u', '', $str);
return preg_replace('/^[\s\pZ\pC]+|[\s\pZ\pC]+$/u', '', (string)$str);
}
/**

View file

@ -853,8 +853,8 @@ class CommentModel extends Comment
}
// Search options
$search_target = (isset($obj->search_target) && $obj->search_target) ? $obj->search_target : trim(Context::get('search_target'));
$search_keyword = (isset($obj->search_keyword) && $obj->search_keyword) ? $obj->search_keyword : trim(Context::get('search_keyword'));
$search_target = (isset($obj->search_target) && $obj->search_target) ? $obj->search_target : trim(Context::get('search_target') ?? '');
$search_keyword = (isset($obj->search_keyword) && $obj->search_keyword) ? $obj->search_keyword : trim(Context::get('search_keyword') ?? '');
if($search_target && $search_keyword)
{
switch($search_target)

View file

@ -1302,7 +1302,7 @@ class DocumentModel extends Document
}
// check it can use extra variable
if(!$load_extra_vars || !$extra_keys = self::getExtraKeys($obj->module_srl))
if(!$load_extra_vars || !$extra_keys = self::getExtraKeys($obj->module_srl ?? 0))
{
$args->sort_index = 'list_order';
return $args;

View file

@ -179,8 +179,8 @@ class FileAdminModel extends File
protected function _makeSearchParam(&$obj, &$args)
{
// Search options
$search_target = isset($obj->search_target)? ($obj->search_target? $obj->search_target : trim(Context::get('search_target'))) : trim(Context::get('search_target'));
$search_keyword = isset($obj->search_keyword)? ($obj->search_keyword? $obj->search_keyword : trim(Context::get('search_keyword'))) : trim(Context::get('search_keyword'));
$search_target = isset($obj->search_target)? ($obj->search_target? $obj->search_target : trim(Context::get('search_target'))) : trim(Context::get('search_target') ?? '');
$search_keyword = isset($obj->search_keyword)? ($obj->search_keyword? $obj->search_keyword : trim(Context::get('search_keyword'))) : trim(Context::get('search_keyword') ?? '');
if($search_target && $search_keyword)
{

View file

@ -31,14 +31,8 @@ class menuAdminView extends menu
Context::loadLang(RX_BASEDIR.'modules/document/lang/');
Context::loadLang(RX_BASEDIR.'modules/layout/lang/');
Context::loadLang(RX_BASEDIR.'modules/autoinstall/lang/');
$site_srl = Context::get('site_srl');
$site_module_info = Context::get('site_module_info');
if(!$site_srl)
{
if($logged_info->is_admin == 'Y' && !$site_keyword) $site_srl = 0;
else $site_srl = (int)$site_module_info->site_srl;
}
$site_srl = $site_module_info->site_srl ?? 0;
// process for unlinked modules
if($site_srl == 0)
@ -163,4 +157,4 @@ class menuAdminView extends menu
}
}
/* End of file menu.admin.view.php */
/* Location: ./modules/menu/menu.admin.view.php */
/* Location: ./modules/menu/menu.admin.view.php */

View file

@ -1034,7 +1034,7 @@ class ModuleModel extends Module
$obj->value = $val->attrs->value ?? null;
$obj->default = $val->attrs->default ?? null;
if(preg_match('/,|\|@\|/', $obj->value, $delimiter) && $delimiter[0])
if(preg_match('/,|\|@\|/', $obj->value ?? '', $delimiter) && $delimiter[0])
{
$obj->value = explode($delimiter[0], $obj->value);
}

View file

@ -85,7 +85,7 @@ class ncenterliteView extends ncenterlite
}
}
Context::set('member_info', $member_info);
Context::set('member_info', $member_info ?? null);
Context::set('notify_types', $notify_types);
Context::set('user_config', $user_config);
Context::set('user_selected', $user_selected);