Skip to content

Conversation

heiglandreas
Copy link
Contributor

This PR introduces a new constant that can be used to retrieve more detailed error messages.

This addresses https://bugs.php.net/bug.php?id=47222 and https://bugs.php.net/bug.php?id=38864

The new constant LDAP_OPT_DIAGNOSTIC_MESSAGE is defined in PHP when the underlying library provides (and understands) it. This is at least the case in the current OpenLDAP-implementation.

Thanks to Johnny Willer who provided the solution at http://stackoverflow.com/questions/28765077/get-number-of-ad-errors-with-ldap-and-php-ldap-function-return-unprecise-error/28816473#28816473

This commit introduces a new constant that can be used to retrieve more
detailed error messages.

This fixes #47222

The new constant LDAP_OPT_DIAGNOSTIC_MESSAGE is defined in PHP when the
underlying library provides (and understands) it. This is the case in
the current OpenLDAP-implementation.

Tanks to Johnny Willer who provided the solution at http://stackoverflow.com/questions/28765077/get-number-of-ad-errors-with-ldap-and-php-ldap-function-return-unprecise-error/28816473#28816473
@jpauli
Copy link
Member

jpauli commented May 12, 2015

Merged

@jpauli jpauli closed this May 12, 2015
@ghost
Copy link

ghost commented May 26, 2016

Forgive the amateur question, is it possible to apply this patch without installing an entire new version of php? I am not ready to upgrade our current version of php until I'm certain that our code base will not break, but we need this particular functionality.

@jpauli
Copy link
Member

jpauli commented May 26, 2016

You can cherry-pick it and rebuild PHP to try it if you want

@ghost
Copy link

ghost commented May 26, 2016

How would I go about doing that? My apologies for the daft question.

Is there a website with instructions that I can read, or should I just google it?

@heiglandreas
Copy link
Contributor Author

havent tested yet, but the patch only introduces the constant to php. When you know the value of the constant in OpenLDAP you can pass that instead of the constant using the ldap_set_option function.

@ghost
Copy link

ghost commented May 26, 2016

If I understand correctly, I can just paste the three lines of code into ldap.c, and then I would need to recompile the php project to rebuild it, correct?

@heiglandreas
Copy link
Contributor Author

That should work. But you can also do the following without changing your PHP-Version:

$extendedMessage = '';
ldap_get_option($ldapHandle, 0x0032, $extendedMessage); 

That's also described here: http://stackoverflow.com/questions/28765077/get-number-of-ad-errors-with-ldap-and-php-ldap-function-return-unprecise-error/28816473#28816473

@ghost
Copy link

ghost commented May 26, 2016

Thanks, got it set up, I was able to diagnose the issue we were encountering and got it resolved. :)

@heiglandreas
Copy link
Contributor Author

Great to hear! Anything we should know to improve the ldap-component furter?

@ghost
Copy link

ghost commented May 26, 2016

This is probably not directly related to the ldap-component, I'm not sure. Setting up PHP to accept ldaps connections is a pain. I have to convert the certificate to a different format, and then have PHP manually import the certificates when they're called. These are the instructions I had to use to get PHP to use ldaps:
http://greg.cathell.net/php_ldap_ssl.html

@heiglandreas
Copy link
Contributor Author

Ahh..... Well, no! The only part we can manage is the last line, so to say. The ldap_connect. Everything else is specific to the windows implementation on the LDAP-Server and LDAP-Client side, so I doubt that we can do something there.

Nevertheless I'll see whether we can link to that "hot-to" in the documentation of the ldap-component.

Thanks for sharing!

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