title: PHP ldap_bind "exception"
body: <p>This is my code and it is working corrently.</p>
  
  <pre><code>$authenticated = ldap_bind($conn, $this-&gt;username . "@" . $servidor_dominio, $this-&gt;password);
  </code></pre>
  
  <p>The description of this function specifies that it returns bool. When the user types an incorrect combination of username and password I get an error from the server:</p>
  
  <pre><code>Error 500. ldap_bind(): Unable to bind to server: Invalid credentials
  </code></pre>
  
  <p>This is truly a PHP Warning but it stops the execution of my app. It even shows the stack trace page (I'm working with Yii PHP Framework).</p>
  
  <p>I tried capturing an exception putting the ldap_bind() call inside a try/catch block:</p>
  
  <pre><code>try {
      $authenticated = ldap_bind($conn, $this-&gt;username . "@" . $servidor_dominio, $this-&gt;password);
  } catch (Exception $exc) {
      echo $exc-&gt;getTraceAsString();
  }
  </code></pre>
  
  <p>It doesn't catch any exception and I'm still getting the same error:</p>
  
  <pre><code>Error 500 ldap_bind(): Unable to bind to server: Invalid credentials
  </code></pre>
  
  <p>Can someone help me with this? It seems that my users miss types their login credentials too often ;-)</p>