@@ -70,12 +70,14 @@ public function bind(?string $dn = null, #[\SensitiveParameter] ?string $passwor
70
70
71
71
if (false === @ldap_bind ($ this ->connection , $ dn , $ password )) {
72
72
$ error = ldap_error ($ this ->connection );
73
- switch ( ldap_errno ($ this ->connection )) {
74
- case self ::LDAP_INVALID_CREDENTIALS :
73
+ $ errno = ldap_errno ($ this ->connection );
74
+ if ( self ::LDAP_INVALID_CREDENTIALS === $ errno ) {
75
75
throw new InvalidCredentialsException ($ error );
76
- case self ::LDAP_TIMEOUT :
76
+ }
77
+ if (self ::LDAP_TIMEOUT === $ errno ) {
77
78
throw new ConnectionTimeoutException ($ error );
78
- case self ::LDAP_ALREADY_EXISTS :
79
+ }
80
+ if (self ::LDAP_ALREADY_EXISTS === $ errno ) {
79
81
throw new AlreadyExistsException ($ error );
80
82
}
81
83
ldap_get_option ($ this ->connection , LDAP_OPT_DIAGNOSTIC_MESSAGE , $ diagnostic_message );
@@ -87,10 +89,8 @@ public function bind(?string $dn = null, #[\SensitiveParameter] ?string $passwor
87
89
88
90
/**
89
91
* @param string $password WARNING: When the LDAP server allows unauthenticated binds, a blank $password will always be valid
90
- *
91
- * @return void
92
92
*/
93
- public function sasBbind (?string $ dn = null , #[\SensitiveParameter] ?string $ password = null , ?string $ mech = null , ?string $ realm = null , ?string $ authcId = null , ?string $ authzId = null , ?string $ props = null ): void
93
+ public function saslBind (?string $ dn = null , #[\SensitiveParameter] ?string $ password = null , ?string $ mech = null , ?string $ realm = null , ?string $ authcId = null , ?string $ authzId = null , ?string $ props = null ): void
94
94
{
95
95
if (!function_exists ('ldap_sasl_bind ' )) {
96
96
throw new LdapException ('Library - missing SASL support ' );
@@ -102,12 +102,14 @@ public function sasBbind(?string $dn = null, #[\SensitiveParameter] ?string $pas
102
102
103
103
if (false === @ldap_sasl_bind ($ this ->connection , $ dn , $ password , $ mech , $ realm , $ authcId , $ authzId , $ props )) {
104
104
$ error = ldap_error ($ this ->connection );
105
- switch ( ldap_errno ($ this ->connection )) {
106
- case self ::LDAP_INVALID_CREDENTIALS :
105
+ $ errno = ldap_errno ($ this ->connection );
106
+ if ( self ::LDAP_INVALID_CREDENTIALS === $ errno ) {
107
107
throw new InvalidCredentialsException ($ error );
108
- case self ::LDAP_TIMEOUT :
108
+ }
109
+ if (self ::LDAP_TIMEOUT === $ errno ) {
109
110
throw new ConnectionTimeoutException ($ error );
110
- case self ::LDAP_ALREADY_EXISTS :
111
+ }
112
+ if (self ::LDAP_ALREADY_EXISTS === $ errno ) {
111
113
throw new AlreadyExistsException ($ error );
112
114
}
113
115
throw new ConnectionException ($ error );
@@ -119,8 +121,6 @@ public function sasBbind(?string $dn = null, #[\SensitiveParameter] ?string $pas
119
121
120
122
/**
121
123
* ldap_exop_whoami accessor, returns authenticated DN
122
- *
123
- * @return string
124
124
*/
125
125
public function whoami (): string
126
126
{
0 commit comments