ldap_connect allways returns true even if logically it shouldn't?
| From: | Steve Turnbull | Date: | Mon, 19 Jun 2006 13:06:01 +0000 |
| Subject: | ldap_connect allways returns true even if logically it shouldn't? | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-238277@lists.php.net to get a copy of this message | ||
Hi
I have this code (PHP5) as part of a class to do some LDAP stuff...
public function connect()
{
$this->ds = @ldap_connect( $this->server, $this->port ); ###
This seems to return true no matter waht????
if ( $this->ds ) {
// A successful connection was made
$this->message .= 'A successful connection was made to the
LDAP server: <b>' . $this->server . "</b><br /><br /> \n";
} else {
// The connection was not successful
$this->message .= 'It was not possible to connect to the
LDAP server: <b>' . $this->server . "</b><br /> \n";
$this->message .= 'LDAP Error Message: ' .
ldap_error( $this->ds ) . "<br /> \n";
$this->message .= 'LDAP Error Number: ' .
ldap_errno( $this->ds ) . "<br /> \n";
}
}
As you can see, I am expecting a return value of true only if the
ldap_connect makes a successful connection. However, even if I pass
values which should make a false, it gives a true.
What am I missing out on here - could any one tell me why true is always
returned?
Cheers
Steve
--
Steve Turnbull
Digital Content Developer
YHGfL Foundation
e steve.turnbull@yhgfl.net
t 01724 275030
The YHGfL Foundation Disclaimer can be found at:
http://www.yhgfl.net/foundation-services/yhgfl-email-disclaimer/