Fix member info page error when the email id length is 1

PHP Exception: ValueError #0 "str_repeat(): Argument #2 ($times) must be greater than or equal to 0" in modules/member/member.view.php on line 168
This commit is contained in:
conory 2024-01-09 00:33:40 +09:00
parent 1a913c3e49
commit 47f8ec2cde

View file

@ -165,7 +165,14 @@ class MemberView extends Member
if($logged_info->is_admin != 'Y' && ($member_info->member_srl != $logged_info->member_srl))
{
list($email_id, $email_host) = explode('@', $member_info->email_address);
$protect_id = substr($email_id, 0, 2) . str_repeat('*', strlen($email_id)-2);
if (strlen($email_id) <= 3)
{
$protect_id = '***';
}
else
{
$protect_id = substr($email_id, 0, 2) . str_repeat('*', strlen($email_id) - 2);
}
$member_info->email_address = sprintf('%s@%s', $protect_id, $email_host);
}