]> granicus.if.org Git - php/commitdiff
Implements extended error messages
authorAndreas Heigl <andreas@heigl.org>
Tue, 5 May 2015 19:30:29 +0000 (21:30 +0200)
committerJulien Pauli <jpauli@php.net>
Tue, 12 May 2015 08:06:54 +0000 (10:06 +0200)
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

ext/ldap/ldap.c

index c64b13bab56de6e994d0c266d609040e6b6fc0b0..b1fc1e45663fdc3e90a6520999b8ed4803d599ff 100644 (file)
@@ -191,6 +191,10 @@ PHP_MINIT_FUNCTION(ldap)
        REGISTER_LONG_CONSTANT("LDAP_OPT_DEBUG_LEVEL", LDAP_OPT_DEBUG_LEVEL, CONST_PERSISTENT | CONST_CS);
 #endif
 
+#ifdef LDAP_OPT_DIAGNOSTIC_MESSAGE
+       REGISTER_LONG_CONSTANT("LDAP_OPT_DIAGNOSTIC_MESSAGE", LDAP_OPT_DIAGNOSTIC_MESSAGE, CONST_PERSISTENT | CONST_CS);
+#endif
+
 #ifdef HAVE_LDAP_SASL
        REGISTER_LONG_CONSTANT("LDAP_OPT_X_SASL_MECH", LDAP_OPT_X_SASL_MECH, CONST_PERSISTENT | CONST_CS);
        REGISTER_LONG_CONSTANT("LDAP_OPT_X_SASL_REALM", LDAP_OPT_X_SASL_REALM, CONST_PERSISTENT | CONST_CS);