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