Fix remainder of unit test warnings in PHP 8.0

This commit is contained in:
Kijin Sung 2021-01-29 00:36:24 +09:00
parent e368cb2f2a
commit 334b1cc277
8 changed files with 30 additions and 19 deletions

View file

@ -114,8 +114,8 @@ class Password
{
if (class_exists('\MemberModel'))
{
$config = \MemberModel::getInstance()->getMemberConfig();
$algorithm = $config->password_hashing_algorithm;
$config = @\MemberModel::getInstance()->getMemberConfig();
$algorithm = $config->password_hashing_algorithm ?? '';
if (strval($algorithm) === '')
{
$algorithm = 'md5';
@ -137,8 +137,8 @@ class Password
{
if (class_exists('\MemberModel'))
{
$config = \MemberModel::getInstance()->getMemberConfig();
$work_factor = $config->password_hashing_work_factor;
$config = @\MemberModel::getInstance()->getMemberConfig();
$work_factor = $config->password_hashing_work_factor ?? 10;
if (!$work_factor || $work_factor < 4 || $work_factor > 31)
{
$work_factor = 10;

View file

@ -690,12 +690,12 @@ class SMS
}
// If message subject is not supported, prepend it to the content instead.
if ($item->subject && !$spec[strtolower($item->type) . '_subject_supported'])
if (isset($item->subject) && $item->subject && !$spec[strtolower($item->type) . '_subject_supported'])
{
$content = $item->subject . "\n" . $content;
unset($item->subject);
}
elseif ($item->subject && $this->_getLengthInCharset($item->subject, $spec[strtolower($item->type) . '_max_length_in_charset']) > $spec[strtolower($item->type) . '_subject_max_length'])
elseif (isset($item->subject) && $item->subject && $this->_getLengthInCharset($item->subject, $spec[strtolower($item->type) . '_max_length_in_charset']) > $spec[strtolower($item->type) . '_subject_max_length'])
{
$subject_parts = $this->_splitString($item->subject, $spec[strtolower($item->type) . '_subject_max_length'], $spec[strtolower($item->type) . '_max_length_in_charset']);
$subject_short = array_shift($subject_parts);
@ -750,7 +750,7 @@ class SMS
$cloneitem = clone $item;
// Determine the best message type for this part.
if ($cloneitem->type !== 'SMS' && !$cloneitem->subject)
if ($cloneitem->type !== 'SMS' && (!isset($cloneitem->subject) || !$cloneitem->subject))
{
$cloneitem->type = $attachment ? 'MMS' : ($this->_getLengthInCharset($content_part, $spec['sms_max_length_in_charset']) > $spec['sms_max_length'] ? 'LMS' : 'SMS');
}