Fix misc warnings in PHP 8.0

This commit is contained in:
Kijin Sung 2020-12-13 21:21:10 +09:00
parent b5cdd1212e
commit 855e12a5de
7 changed files with 40 additions and 20 deletions

View file

@ -1616,7 +1616,7 @@ class Context
} }
// If $args_list contains one array, reset existing parameters and use keys & values from $args_list. // If $args_list contains one array, reset existing parameters and use keys & values from $args_list.
if (is_array($args_list[0]) && count($args_list) == 1) if (count($args_list) == 1 && is_array($args_list[0]))
{ {
$get_vars = array(); $get_vars = array();
foreach ($args_list[0] as $key => $val) foreach ($args_list[0] as $key => $val)
@ -1653,14 +1653,14 @@ class Context
unset($get_vars['vid']); unset($get_vars['vid']);
// for compatibility to lower versions // for compatibility to lower versions
$act = $get_vars['act']; $act = $get_vars['act'] ?? null;
$act_alias = array( $act_alias = array(
'dispMemberFriend' => 'dispCommunicationFriend', 'dispMemberFriend' => 'dispCommunicationFriend',
'dispMemberMessages' => 'dispCommunicationMessages', 'dispMemberMessages' => 'dispCommunicationMessages',
'dispDocumentAdminManageDocument' => 'dispDocumentManageDocument', 'dispDocumentAdminManageDocument' => 'dispDocumentManageDocument',
'dispModuleAdminSelectList' => 'dispModuleSelectList' 'dispModuleAdminSelectList' => 'dispModuleSelectList'
); );
if(isset($act_alias[$act])) if($act && isset($act_alias[$act]))
{ {
$get_vars['act'] = $act_alias[$act]; $get_vars['act'] = $act_alias[$act];
} }

View file

@ -248,11 +248,11 @@ class BaseObject
* Method to retrieve a corresponding value to a given key * Method to retrieve a corresponding value to a given key
* *
* @param string $key * @param string $key
* @return string Returns value to a given key * @return mixed Returns value to a given key
*/ */
public function get($key) public function get($key)
{ {
return $this->variables[$key]; return $this->variables[$key] ?? null;
} }
/** /**

View file

@ -161,7 +161,7 @@ class TemplateHandler
Rhymix\Framework\Storage::delete($tmpfilename); Rhymix\Framework\Storage::delete($tmpfilename);
} }
if($__templatehandler_root_tpl == $this->file) if(isset($__templatehandler_root_tpl) && $__templatehandler_root_tpl == $this->file)
{ {
$__templatehandler_root_tpl = null; $__templatehandler_root_tpl = null;
} }
@ -816,13 +816,18 @@ class TemplateHandler
case 'scss': case 'scss':
if($doUnload) if($doUnload)
{ {
$result = "Context::unloadFile('{$attr['target']}','{$attr['targetie']}','{$attr['media']}');"; $result = vsprintf("Context::unloadFile('%s', '%s', '%s';", [
$attr['target'] ?? '', $attr['targetie'] ?? '', $attr['media'] ?? '',
]);
} }
else else
{ {
$metafile = $attr['target']; $metafile = isset($attr['target']) ? $attr['target'] : '';
$metavars = ($attr['vars'] ? self::_replaceVar($attr['vars']) : ''); $metavars = isset($attr['vars']) ? ($attr['vars'] ? self::_replaceVar($attr['vars']) : '') : '';
$result = "\$__tmp=array('{$attr['target']}','{$attr['media']}','{$attr['targetie']}','{$attr['index']}'," . ($attr['vars'] ? self::_replaceVar($attr['vars']) : 'array()') . ");Context::loadFile(\$__tmp);unset(\$__tmp);"; $result = vsprintf("Context::loadFile(['%s', '%s', '%s', '%s', %s]);", [
$attr['target'] ?? '', $attr['media'] ?? '', $attr['targetie'] ?? '', $attr['index'] ?? '',
isset($attr['vars']) ? ($attr['vars'] ? self::_replaceVar($attr['vars']) : '[]') : '[]',
]);
} }
break; break;
} }

View file

@ -374,7 +374,7 @@ class Router
} }
// Try the generic mid/act pattern. // Try the generic mid/act pattern.
if ($prefix_type !== 'module' || !isset(self::$_except_modules[$args[$prefix_type]])) if (($prefix_type !== 'module' || !isset(self::$_except_modules[$args[$prefix_type]])) && isset($args['act']))
{ {
self::$_route_cache[$rewrite_level][$keys_string] = '$' . $prefix_type . '/$act'; self::$_route_cache[$rewrite_level][$keys_string] = '$' . $prefix_type . '/$act';
$internal_url = $args['act'] . (count($args2) ? ('?' . http_build_query($args2)) : ''); $internal_url = $args['act'] . (count($args2) ? ('?' . http_build_query($args2)) : '');

View file

@ -349,16 +349,16 @@ class autoinstallModel extends autoinstall
$path = substr($path, 0, strlen($path) - 1); $path = substr($path, 0, strlen($path) - 1);
} }
if(!$GLOBLAS['XE_AUTOINSTALL_PACKAGE_SRL_BY_PATH'][$path]) if(!$GLOBALS['XE_AUTOINSTALL_PACKAGE_SRL_BY_PATH'][$path])
{ {
$args = new stdClass(); $args = new stdClass();
$args->path = $path; $args->path = $path;
$output = executeQuery('autoinstall.getPackageSrlByPath', $args); $output = executeQuery('autoinstall.getPackageSrlByPath', $args);
$GLOBLAS['XE_AUTOINSTALL_PACKAGE_SRL_BY_PATH'][$path] = $output->data->package_srl; $GLOBALS['XE_AUTOINSTALL_PACKAGE_SRL_BY_PATH'][$path] = $output->data->package_srl;
} }
return $GLOBLAS['XE_AUTOINSTALL_PACKAGE_SRL_BY_PATH'][$path]; return $GLOBALS['XE_AUTOINSTALL_PACKAGE_SRL_BY_PATH'][$path];
} }
/** /**

View file

@ -1067,12 +1067,13 @@ class memberModel extends member
{ {
return null; return null;
} }
$info = null;
$member_group = self::getMemberGroups($member_srl, $site_srl); $member_group = self::getMemberGroups($member_srl, $site_srl);
$groups_info = self::getGroups($site_srl); $groups_info = self::getGroups($site_srl);
if(count($member_group) > 0 && is_array($member_group)) if(count($member_group) > 0 && is_array($member_group))
{ {
$memberGroups = array_keys($member_group); $memberGroups = array_keys($member_group);
foreach($groups_info as $group_srl=>$group_info) foreach($groups_info as $group_srl=>$group_info)
{ {
if(in_array($group_srl, $memberGroups)) if(in_array($group_srl, $memberGroups))
@ -1097,11 +1098,20 @@ class memberModel extends member
} }
} }
} }
if (!$info) $GLOBALS['__member_info__']['group_image_mark'][$member_srl] == 'N'; if (!$info)
{
$GLOBALS['__member_info__']['group_image_mark'][$member_srl] == 'N';
}
}
if (isset($GLOBALS['__member_info__']['group_image_mark'][$member_srl]) && $GLOBALS['__member_info__']['group_image_mark'][$member_srl] !== 'N')
{
return $GLOBALS['__member_info__']['group_image_mark'][$member_srl];
}
else
{
return null;
} }
if ($GLOBALS['__member_info__']['group_image_mark'][$member_srl] == 'N') return null;
return $GLOBALS['__member_info__']['group_image_mark'][$member_srl];
} }
/** /**

View file

@ -86,7 +86,12 @@ class widgetView extends widget
// module_category and module combination // module_category and module combination
if($module_categories) if($module_categories)
{ {
foreach($mid_list as $module_srl => $module) { foreach($mid_list as $module_srl => $module)
{
if(!isset($module_categories[$module->module_category_srl]))
{
$module_categories[$module->module_category_srl] = new stdClass();
}
$module_categories[$module->module_category_srl]->list[$module_srl] = $module; $module_categories[$module->module_category_srl]->list[$module_srl] = $module;
} }
} }