Skip to content
Snippets Groups Projects
Unverified Commit a55d7407 authored by Tim van Dijen's avatar Tim van Dijen Committed by GitHub
Browse files

Fix unexpected side-effect

parent 08acde41
No related branches found
No related tags found
No related merge requests found
......@@ -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)) {
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment