Re: ldap_connect allways returns true even if logically it shouldn't?

From: Date: Mon, 19 Jun 2006 13:59:27 +0000
Subject: Re: ldap_connect allways returns true even if logically it shouldn't?
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-238280@lists.php.net to get a copy of this message
I believe the manual says that ldap_connect doesn't actually make the connection but rather it just simply sets up the connection parameters. The actual connection doesn't happen until ldap_bind is executed. - or so I recall reading some where ;-) On Jun 19, 2006, at 9:06 AM, Steve Turnbull wrote:
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/ --PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php


« previous php.general (#238280) next »