Skip to content

Commit f04ea7c

Browse files
minor symfony#52498 [Ldap] Set exception code to ldap error number (johannes85)
This PR was merged into the 6.4 branch. Discussion ---------- [Ldap] Set exception code to ldap error number | Q | A | ------------- | --- | Branch? | 6.4 | Bug fix? | no | New feature? | no | Deprecations? | no | License | MIT To be conistent with symfony@db46f3b, also add the LDAP error number to the exception in this case. This is especially useful to perform a reconnect for long running php processes without doing something like this: ```if(str_contains($ex->getMessage(), 'LDAP error was [-1]')) {``` Or to check for a ```[32] No such object``` error. Commits ------- aa20487 Set exception code to ldap error number
2 parents 1984b96 + aa20487 commit f04ea7c

File tree

1 file changed

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

1 file changed

+1
-1
lines changed

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -110,7 +110,7 @@ public function execute(): CollectionInterface
110110
$this->resetPagination();
111111
}
112112

113-
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));
113+
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), $errno);
114114
}
115115

116116
$this->results[] = $search;

0 commit comments

Comments
 (0)