php 5.5 ldap_connect 个问题

php 5.5 ldap_connect problems

从 php.net 复制了此脚本并输入了错误的 url。 由于某些原因,即使连接细节完全错误,此脚本也不会死掉。

$ldaphost = "notaldapurl.com";  
$ldapport = 389; 


$ldapconn = ldap_connect($ldaphost, $ldapport)
          or die("die not connect to $ldaphost");

var_dump($ldapconn);

此脚本的输出是 resource(2) of type (ldap link)

附加信息是我正在运行 php 5.5

来自文档...

When OpenLDAP 2.x.x is used, ldap_connect() will always return a resource as it does not actually connect but just initializes the connecting parameters. The actual connect happens with the next calls to ldap_* funcs, usually with ldap_bind().

http://php.net/manual/en/function.ldap-connect.php