Skip to content

Commit

Permalink
feature #28424 [Ldap] Add verbose ext-ldap error if present for easie…
Browse files Browse the repository at this point in the history
…r debugging (scaytrase)

This PR was merged into the 4.2-dev branch.

Discussion
----------

[Ldap] Add verbose ext-ldap error if present for easier debugging

| Q             | A
| ------------- | ---
| Branch?       | master (be careful when merging)
| Bug fix?      | no
| New feature?  | yes
| BC breaks?    | no
| Deprecations? | no
| Tests pass?   |
| Fixed tickets | #28149
| License       | MIT
| Doc PR        |

Added an optional message suffix if ldap_errno is not equals to 0

Commits
-------

761415f Add verbose ext-ldap error if present for easier debugging
  • Loading branch information
nicolas-grekas committed Sep 21, 2018
2 parents a55853d + 761415f commit ea2a65c
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion src/Symfony/Component/Ldap/Adapter/ExtLdap/Query.php
Expand Up @@ -89,7 +89,12 @@ public function execute()
}

if (false === $this->search) {
throw new LdapException(sprintf('Could not complete search with dn "%s", query "%s" and filters "%s".', $this->dn, $this->query, implode(',', $this->options['filter'])));
$ldapError = '';
if ($errno = ldap_errno($con)) {
$ldapError = sprintf(' LDAP error was [%d] %s', $errno, ldap_error($con));
}

throw new LdapException(sprintf('Could not complete search with dn "%s", query "%s" and filters "%s".%s', $this->dn, $this->query, implode(',', $this->options['filter']), $ldapError));
}

return new Collection($this->connection, $this);
Expand Down

0 comments on commit ea2a65c

Please sign in to comment.