Fix deprecation warnings in PHP 8.2

This commit is contained in:
Kijin Sung 2023-01-16 22:42:04 +09:00
parent f7f20a0825
commit e0a041bb3d
5 changed files with 10 additions and 7 deletions

View file

@ -44,7 +44,7 @@ class Validator
* custom message list * custom message list
* @var array * @var array
*/ */
var $_messages; var $_message;
/** /**
* custom field name list * custom field name list

View file

@ -8,6 +8,7 @@
* @package /classes/xml * @package /classes/xml
* @version 0.1 * @version 0.1
*/ */
#[AllowDynamicProperties]
class Xml_Node_ class Xml_Node_
{ {

View file

@ -185,6 +185,7 @@ function clean_path($path)
*/ */
function escape($str, $double_escape = true, $except_lang_code = false) function escape($str, $double_escape = true, $except_lang_code = false)
{ {
$str = (string)$str;
if ($except_lang_code && preg_match('/^\$user_lang->userLang[0-9]+$/', $str)) if ($except_lang_code && preg_match('/^\$user_lang->userLang[0-9]+$/', $str))
{ {
return $str; return $str;
@ -204,7 +205,7 @@ function escape($str, $double_escape = true, $except_lang_code = false)
*/ */
function escape_css($str) function escape_css($str)
{ {
return preg_replace('/[^a-zA-Z0-9_.#\/-]/', '', $str); return preg_replace('/[^a-zA-Z0-9_.#\/-]/', '', (string)$str);
} }
/** /**
@ -229,7 +230,7 @@ function escape_js($str)
*/ */
function escape_sqstr($str) function escape_sqstr($str)
{ {
return str_replace(array('\\0', '\\"'), array('', '"'), addslashes($str)); return str_replace(array('\\0', '\\"'), array('', '"'), addslashes((string)$str));
} }
/** /**
@ -241,7 +242,7 @@ function escape_sqstr($str)
*/ */
function escape_dqstr($str) function escape_dqstr($str)
{ {
return str_replace(array('\\0', "\\'", '$'), array('', "'", '\\$'), addslashes($str)); return str_replace(array('\\0', "\\'", '$'), array('', "'", '\\$'), addslashes((string)$str));
} }
/** /**
@ -258,6 +259,7 @@ function escape_dqstr($str)
function explode_with_escape($delimiter, $str, $limit = 0, $escape_char = '\\') function explode_with_escape($delimiter, $str, $limit = 0, $escape_char = '\\')
{ {
if ($limit < 1) $limit = 0; if ($limit < 1) $limit = 0;
$str = (string)$str;
$result = array(); $result = array();
$split = preg_split('/(?<!' . preg_quote($escape_char, '/') . ')' . preg_quote($delimiter, '/') . '/', $str, $limit); $split = preg_split('/(?<!' . preg_quote($escape_char, '/') . ')' . preg_quote($delimiter, '/') . '/', $str, $limit);
foreach ($split as $piece) foreach ($split as $piece)

View file

@ -55,8 +55,8 @@ class MemberAdminModel extends Member
case 'disable' : $args->is_denied = 'Y';break; case 'disable' : $args->is_denied = 'Y';break;
} }
$search_target = trim(Context::get('search_target')); $search_target = trim(Context::get('search_target') ?? '');
$search_keyword = trim(Context::get('search_keyword')); $search_keyword = trim(Context::get('search_keyword') ?? '');
if($search_target && $search_keyword) if($search_target && $search_keyword)
{ {

View file

@ -498,7 +498,7 @@ class MemberModel extends Member
{ {
foreach($extra_vars as $key => $val) foreach($extra_vars as $key => $val)
{ {
if(!is_array($val) && !is_object($val) && strpos($val, '|@|') !== FALSE) if(!is_null($val) && !is_array($val) && !is_object($val) && strpos($val, '|@|') !== FALSE)
{ {
$val = explode('|@|', $val); $val = explode('|@|', $val);
} }