Skip to content

Test ldap behavior #6338

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

Closed
wants to merge 2 commits into from
Closed

Test ldap behavior #6338

wants to merge 2 commits into from

Conversation

nikic
Copy link
Member

@nikic nikic commented Oct 14, 2020

Trying to understand a failure from #5366.

@nikic
Copy link
Member Author

nikic commented Oct 14, 2020

@MCMic It seems like there is a functional difference between passing $controls = [] to ldap_search() and not passing them at all. If I understood right, not passing them will use the controls set via ldap_set_option. I assume the same applies also to other functions accepting $controls.

In that case, we should either mark these with an UNKNOWN default value, or we should make them accept ?array, so that "null" means to use the default controls, while [] means to use no controls.

@MCMic
Copy link
Contributor

MCMic commented Oct 15, 2020

@nikic Hum, this is unfortunate.

I’m not sure what the best behavior would be.
The man page for openldap ldap_set_option says:

LDAP_OPT_SERVER_CONTROLS
Sets/gets the server-side controls to be used for all operations. This is now deprecated as modern LDAP C API provides replacements for all main operations which
accepts server-side controls as explicit arguments; see for example ldap_search_ext(3), ldap_add_ext(3), ldap_modify_ext(3) and so on. outvalue must be LDAPControl
***, and the caller is responsible of freeing the returned controls, if any, by calling ldap_controls_free(3), while invalue must be LDAPControl *const *; the li‐
brary duplicates the controls passed via invalue.

But it’s a bit late to deprecate setting server controls and some people might find it useful being able to set some kind of defaults controls.

So I guess we have to change the parameter to ?array and defaults to NULL?

@MCMic
Copy link
Contributor

MCMic commented Oct 15, 2020

@nikic If we change it to ?array = null, which versions (branches) should be targeted by the change?

@nikic
Copy link
Member Author

nikic commented Oct 15, 2020

@MCMic I'd change it for PHP-8.0/master only. We have quite a few parameters that became nullable in PHP 8 for similar reasons.

@MCMic
Copy link
Contributor

MCMic commented Oct 15, 2020

@nikic Fixed in 15a3eca

@nikic
Copy link
Member Author

nikic commented Oct 15, 2020

Thank you!

@nikic nikic closed this Oct 15, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants