Skip to content

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

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Sep 21, 2018

Conversation

scaytrase
Copy link
Contributor

@scaytrase scaytrase commented Sep 10, 2018

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

Copy link
Member

@nicolas-grekas nicolas-grekas left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

(with minor comment)

@@ -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 (0 !== ($errno = ldap_errno($con))) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'd suggest to write this as if ($errno = ldap_errno($con)) {

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I hoped to find something like LDAP_ERROR_NONE for better readability, but failed. Initial idea was

if (LDAP_ERROR_NONE !== ($errno = ldap_errno($con))) {

Without that your suggestion looks better, indeed, I'll fix it

@nicolas-grekas
Copy link
Member

(to be merged on master actually as that's not a bug fix but an improvement.)

@nicolas-grekas nicolas-grekas changed the title Add verbose ext-ldap error if present for easier debugging [Ldap] Add verbose ext-ldap error if present for easier debugging Sep 10, 2018
@scaytrase
Copy link
Contributor Author

@nicolas-grekas should I rebase?

@nicolas-grekas
Copy link
Member

@scaytrase if you can please yes, otherwise no worries we'll take care of it.

@scaytrase scaytrase changed the base branch from 3.4 to master September 11, 2018 11:26
@scaytrase
Copy link
Contributor Author

rebased

@nicolas-grekas
Copy link
Member

Thank you @scaytrase.

@nicolas-grekas nicolas-grekas merged commit 761415f into symfony:master Sep 21, 2018
nicolas-grekas added a commit that referenced this pull request Sep 21, 2018
…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
@scaytrase scaytrase deleted the bugfix/28149 branch September 21, 2018 11:45
@nicolas-grekas nicolas-grekas modified the milestones: next, 4.2 Nov 1, 2018
This was referenced Nov 3, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants