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-07-02 14:27:23 +0200 |
commit | 3ae1ec4d2a4f10f8cc54c4fc933ef1fe9ea9ff25 (patch) | |
tree | f99e7206245d084dabe913d0b4ede51053c3a6d5 /lib/private | |
parent | 491c031c0cebd4e10db70f84a94b1446a24b9780 (diff) | |
download | nextcloud-server-3ae1ec4d2a4f10f8cc54c4fc933ef1fe9ea9ff25.tar.gz nextcloud-server-3ae1ec4d2a4f10f8cc54c4fc933ef1fe9ea9ff25.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')
-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 eff025e511e..53792c70d27 100644 --- a/lib/private/Accounts/AccountManager.php +++ b/lib/private/Accounts/AccountManager.php @@ -153,6 +153,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) { |