diff options
author | Daniel Calviño Sánchez <danxuliu@gmail.com> | 2021-01-31 23:53:45 +0100 |
---|---|---|
committer | Daniel Calviño Sánchez <danxuliu@gmail.com> | 2021-04-23 11:44:42 +0200 |
commit | 7159a708947e29f963b634aa3af6ab5354f6bed4 (patch) | |
tree | 26e701a3e39e8d09d5cb80f94f7e7c82d868a2b6 /lib/private/Accounts/AccountManager.php | |
parent | e2c4a174f2f19761a30125bb35b348258d4c118f (diff) | |
download | nextcloud-server-7159a708947e29f963b634aa3af6ab5354f6bed4.tar.gz nextcloud-server-7159a708947e29f963b634aa3af6ab5354f6bed4.zip |
Guard against null phone number value
"parsePhoneNumber()" expects a string, so a TypeError would be thrown if
the phone number value is null.
Signed-off-by: Daniel Calviño Sánchez <danxuliu@gmail.com>
Diffstat (limited to 'lib/private/Accounts/AccountManager.php')
-rw-r--r-- | lib/private/Accounts/AccountManager.php | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/lib/private/Accounts/AccountManager.php b/lib/private/Accounts/AccountManager.php index ea8f99e0216..d5df6557c8f 100644 --- a/lib/private/Accounts/AccountManager.php +++ b/lib/private/Accounts/AccountManager.php @@ -134,6 +134,9 @@ class AccountManager implements IAccountManager { $updated = true; if (isset($data[self::PROPERTY_PHONE]) && $data[self::PROPERTY_PHONE]['value'] !== '') { + // Sanitize null value. + $data[self::PROPERTY_PHONE]['value'] = $data[self::PROPERTY_PHONE]['value'] ?? ''; + try { $data[self::PROPERTY_PHONE]['value'] = $this->parsePhoneNumber($data[self::PROPERTY_PHONE]['value']); } catch (\InvalidArgumentException $e) { |