diff --git a/lib/SimpleSAML/Auth/LDAP.php b/lib/SimpleSAML/Auth/LDAP.php index d0416cc5bc48164dc59d9b2d4ea4e56bf691322d..0f8ad1467cd4666a8c4fcec2d3d07cbe01e1aef7 100644 --- a/lib/SimpleSAML/Auth/LDAP.php +++ b/lib/SimpleSAML/Auth/LDAP.php @@ -34,7 +34,7 @@ class LDAP /** * LDAP link identifier. * - * @var resource|bool + * @var resource */ protected $ldap = null; @@ -84,10 +84,11 @@ class LDAP * Prepare a connection for to this LDAP server. Note that this function * doesn't actually connect to the server. */ - $this->ldap = @ldap_connect($hostname, $port); - if ($this->ldap === false) { + $resource = @ldap_connect($hostname, $port); + if ($resource === false) { throw $this->makeException('Library - LDAP __construct(): Unable to connect to \''.$hostname.'\'', ERR_INTERNAL); } + $this->ldap = $resource; // Enable LDAP protocol version 3 if (!@ldap_set_option($this->ldap, LDAP_OPT_PROTOCOL_VERSION, 3)) {