From c518175244bf7cb7f5dabbd9287ef02432ece22e Mon Sep 17 00:00:00 2001 From: "B.Fatih KOZ" Date: Tue, 8 Feb 2022 00:10:58 +0300 Subject: [PATCH] Update User Model (#1396) Current GDPR compliant Private Name attribute is not compatible with multi byte strings, and when encountered it fails and returns an empty string for the name_private attribute. `substr($last_name, 0, 1)` or just `$last_name[0]` is not multi byte compatible, therefore only solution is to use `mb_substr`. It also supports encoding definitions like `mb_substr($last_name, 0, 1, 'UTF-8')` Co-authored-by: Nabeel S --- app/Models/User.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/Models/User.php b/app/Models/User.php index 59820988..8e1def5c 100755 --- a/app/Models/User.php +++ b/app/Models/User.php @@ -151,7 +151,7 @@ class User extends Authenticatable $first_name = $name_parts[0]; $last_name = $name_parts[$count - 1]; - return $first_name.' '.$last_name[0]; + return $first_name.' '.mb_substr($last_name, 0, 1); } /**