title: ldap_connect() function in php accepts any value and doesnt throw an error
body: <p>I am writing a php code to connect to my LDAP server.</p>
  
  <pre><code>$adServer = $ini['ldap'];
  $ldap = ldap_connect($adServer) or die("Could not connect to {$adServer}");
  </code></pre>
  
  <p>The Value for <code>$adServer</code> I am fetching from a configuration file. </p>
  
  <p>Looks like <code>ldap_connect()</code> is not throwing an error when I pass blank value or any other random value like "Hello". </p>
  
  <p>I tried giving the below code to check if any error message was generated. </p>
  
  <p><code>echo ldap_error($ldap)</code></p>
  
  <p>It always says 'Success'.</p>
  
  <p>Hence I am not able to authenticate if the connection was established or not to the LDAP Server and throw an appropriate error message. </p>
  
  <p>In what situation does the 'die' get triggered for <code>ldap_connect()</code> function.
  I would like to throw an appropriate error message to the end user if the Server Name provided in the configuration file is not working.</p>
  
  <p>Note: I am using Version 5.6 for PHP</p>