8000 feature #28424 [Ldap] Add verbose ext-ldap error if present for easie… · symfony/symfony@ea2a65c · GitHub
[go: up one dir, main page]

Skip to content

Commit ea2a65c

Browse files
feature #28424 [Ldap] Add verbose ext-ldap error if present for easier 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
2 parents a55853d + 761415f commit ea2a65c

File tree

1 file changed

+6
-1
lines changed
  • src/Symfony/Component/Ldap/Adapter/ExtLdap

1 file changed

+6
-1
lines changed

src/Symfony/Component/Ldap/Adapter/ExtLdap/Query.php

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,12 @@ public function execute()
8989
}
9090

9191
if (false === $this->search) {
92-
throw new LdapException(sprintf('Could not complete search with dn "%s", query "%s" and filters "%s".', $this->dn, $this->query, implode(',', $this->options['filter'])));
92+
$ldapError = '';
93+
if ($errno = ldap_errno($con)) {
94+
$ldapError = sprintf(' LDAP error was [%d] %s', $errno, ldap_error($con));
95+
}
96+
97+
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));
9398
}
9499

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

0 commit comments

Comments
 (0)
0