Closed enversanli closed 12 months ago
Hi @enversanli, thanks for the detailed issue, I appreciate it!
That's strange, as even the PHP docs for ldap_parse_result
display the parameter name as errorMessage
:
https://www.php.net/manual/en/function.ldap-parse-result.php
ldap_parse_result(
[LDAP\Connection](https://www.php.net/manual/en/class.ldap-connection.php) $ldap,
[LDAP\Result](https://www.php.net/manual/en/class.ldap-result.php) $result,
int &$error_code,
string &$matched_dn = null,
string &$error_message = null,
array &$referrals = null,
array &$controls = null
): bool
In your tests, is zero (0
) returned as the errorCode
? If so, then I think it's safe to remove the empty()
check on the error message here:
Let me know and then I can patch this quickly 🙏 .
Hey @stevebauman , My error code is 0 and error mesage is "Bind succeeded" . Would be good if you remove empty condition as you suggested here.
Thank you for your quick support !
Hello @stevebauman , I would like to ask about update plan. When do you plan to make the updates for the package ?
Thank you so much for your support !
Sorry for the delay @enversanli! I appreciate the ping.
I've just pushed the change. Once tests pass I'll create a new release 🙏
Ok I've just released v3.1.3 with this patch. Run composer update
and you're all set! 👍
Hello @stevebauman , Thank you so much for your support. I will update package and test it also on my project.
Again, Thank you for your support.
Happy to help @enversanli! Please drop by anytime you need assistance with LdapRecord 👍
Hello,
I am having some problems with this package, and I need your support or experience.
I have installed the package (v3) and added the necessary information to connect to the server with the following information.
Note : Username and password are not required to connect to the LDAP server. This is an OpenLDAP server and no authentication is required.
When I run the test function in accordance with the above information, I get the following error:
Vendor -> Ldap.php
When I debugged the methods executed by the test, I noticed that the successful() function is checking for the errorCode and the errorMessage after ldap_bind_ext(). As you can see in the code above, the errorMessage actually contains a success message ("Bind succeeded"). When I modified the successful() function to return true, everything is working. Please see the example below:
In this case, I get successful results when I connect directly using the Connection object as shown above.
But: If I revert my changes and the successful() function returns false again, the $e->getDetailedError() is null, causing all other function like getErrorCode() / getErrorMessage() / getDiagnosticMessage() to fail.
Do you have any information about this behavior, or do you observe anything wrong with my configuration? Note: I previously used Adldap2 package which is using ldap_bind(). So most probably the error was already present in the past, but was just not visible.
I'm waiting your support for that case. Thank you all.