Fix #1627 suspected errors in PHP 8.0

This commit is contained in:
Kijin Sung 2021-02-19 01:05:28 +09:00
parent 7d22aad8d1
commit 05cef078f2
3 changed files with 21 additions and 3 deletions

View file

@ -3822,7 +3822,7 @@ class memberController extends member
{
// pass
}
elseif (!isset($args->{$formInfo->name}) || trim($args->{$formInfo->name} ?? '') === '')
elseif (!isset($args->{$formInfo->name}) || $this->_checkEmpty($args->{$formInfo->name} ?? ''))
{
if (in_array($formInfo->name, $not_required_if_indirect_insert) && !preg_match('/^procMember.+/i', Context::get('act')))
{
@ -3918,6 +3918,24 @@ class memberController extends member
return new BaseObject;
}
/**
* Check if a variable is empty.
*
* @param mixed $var
* @return bool
*/
protected function _checkEmpty($var)
{
if (is_array($var))
{
return implode('', array_map('trim', $var)) === '';
}
else
{
return trim(strval($var)) === '';
}
}
/**
* @deprecated
* @return void

View file

@ -542,6 +542,7 @@ class memberModel extends member
public static function getMemberGroups($member_srl, $site_srl = 0, $force_reload = false)
{
// cache controll
$member_srl = intval($member_srl);
$cache_key = sprintf('member:member_groups:%d', $member_srl);
$group_list = Rhymix\Framework\Cache::get($cache_key);
@ -552,7 +553,7 @@ class memberModel extends member
$args = new stdClass();
$args->member_srl = $member_srl;
$output = executeQueryArray('member.getMemberGroups', $args);
$group_list = $output->data;
$group_list = $output->data ?: [];
if (!count($group_list))
{
$default_group = self::getDefaultGroup(0);

View file

@ -10,7 +10,6 @@
<conditions>
<condition operation="equal" column="b.member_srl" var="member_srl" filter="number" notnull="notnull" />
<condition operation="equal" column="b.group_srl" default="a.group_srl" pipe="and" />
<condition operation="equal" column="a.site_srl" var="site_srl" default="0" pipe="and" />
</conditions>
<navigation>
<index var="sort_index" default="a.list_order" order="asc" />