From a55d7407d4423e06e19cf72976dbe363eea2a28e Mon Sep 17 00:00:00 2001 From: Tim van Dijen <tvdijen@gmail.com> Date: Sat, 28 Jul 2018 15:42:14 +0200 Subject: [PATCH] Fix unexpected side-effect --- lib/SimpleSAML/Auth/LDAP.php | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/lib/SimpleSAML/Auth/LDAP.php b/lib/SimpleSAML/Auth/LDAP.php index d0416cc5b..0f8ad1467 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)) { -- GitLab