From: Hypolite Petovan Date: Wed, 13 Dec 2017 02:17:46 +0000 (-0500) Subject: Use Exceptions for User::create X-Git-Url: https://git.mxchange.org/?a=commitdiff_plain;h=f834d1d145feda6606f95d3577d321bf5548fbb8;p=friendica-addons.git Use Exceptions for User::create --- diff --git a/ldapauth/ldapauth.php b/ldapauth/ldapauth.php index a0b270e3..63ccbe91 100644 --- a/ldapauth/ldapauth.php +++ b/ldapauth/ldapauth.php @@ -177,11 +177,12 @@ function ldap_autocreateaccount($ldap_autocreateaccount, $username, $password, $ if (empty($results)) { if (strlen($email) > 0 && strlen($name) > 0) { $arr = array('username' => $name, 'nickname' => $username, 'email' => $email, 'password' => $password, 'verified' => 1); - $result = User::create($arr); - if ($result['success']) { + + try { + User::create($arr); logger("ldapauth: account " . $username . " created"); - } else { - logger("ldapauth: account " . $username . " was not created ! : " . implode($result)); + } catch (Exception $ex) { + logger("ldapauth: account " . $username . " was not created ! : " . $ex->getMessage()); } } else { logger("ldapauth: unable to create account, no email or nickname found");