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

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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@xxxxxxxxx
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


[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux