-
Notifications
You must be signed in to change notification settings - Fork 7.9k
Deprecate ldap_connect with two parameters #5177
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
Deprecate ldap_connect with two parameters #5177
Conversation
Do you plan to put this to vote? Maybe It would be worth to add this one to Nikita's list of deprecations for PHP 8. |
This is implementing the deprecation of the feature that is already marked as deprecated in the documentation since 22nd of April 2019 (https://git.php.net/?p=doc/en.git;a=commit;h=9f34a7ecf58a79efb4586dff4c21c24195479506), so there should be no vote necessary. It should already be on the list of deprecated features for PHP7.4 ;-) This could also go into the next PHP7.4 release. Currently there are no plans to remove the possibility to use the two parameters with PHP8. |
Oh, that's cool then 😊 |
Looks like the failing tests are not related to the changes in this PR. |
@derickr Any chance that we can get this change also into PHP7.4? If so, please advise what I need to do. THX |
We shouldn't deprecate anything in x.y.x releases, so your next possibility is 8.0.0. |
Would be good to mentioned this on internals maybe? Unless there already has been some discussion about it? |
AIUI, ldap_connect() called with host and port always uses plain LDAP, so for secure LDAP you already need to pass in an URI. I don't think removing support for passing host/port would be a huge BC break in practice. |
I wouldn't want to remove it (calling This PR is only about marking the usage of ldap_connect with 2 parameters as deprecated (as it is already marked in the documentation) so that people can readily adapt their code so that we can then probably remove that "feature" in PHP9 |
@heiglandreas, please rebase this to resolve the conflicts. What's the status of this PR? It clearly didn't make it into 8.0.0. Can we target 8.2.0 with it? |
626ae9f
to
f0afc8d
Compare
Rebased. Broken tests seem to be unrelated to the changes. From my side it can go in whenever it suits. Rather sooner than later! |
It is okay to introduce a deprecation in a minor version, so this looks good for PHP 8.2. |
would it be reasonable to rebase and retrigger the CI ? |
ldap_connect should be called with an LDAP-URI as parameter and not with 2 parameters as that allows much more flexibility like differentiating between ldap and ldaps or setting multiple ldap-servers. This change requires one to add null as second parameter in case the underlying library is Oracle and one wants to add wallet-details.
All tests are using ldap_connect now with an URI and not with host and port as two separarte parameters.
This adds a test to verify that calling ldap_connect with 2 parameters triggers a deprecation notice
f0afc8d
to
82bd708
Compare
I just did that. |
`ldap_control_paged_result()` is removed as of PHP 8.0.0, so this test needs to be removed as well.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you! I'm very much in favor of deprecating this, since I don't like those soft deprecations because they are so easy to overlook.
There are some minor issues to be resolved, though.
@kocsismate, regarding the docs: apparently the Oracle specific signature is no longer in the docs? Should we bring it back, or did we already discuss this?
ext/ldap/tests/ldap_deprectate_connect_with_two_parameters.phpt
Outdated
Show resolved
Hide resolved
Hmm, I'm not sure if it was ever there. I vaguely checked the git history, and I couldn't see the oracle specific signature. IMO it would be better to unify the two signatures into one (with |
Oh, right. I've just re-read a 2018 email discussion with @heiglandreas, and given that that signature is only relevant to a small minority of users, and likely confusing for the rest, we didn't document it. And there had even been thoughts about deprecating/removing that Oracle LDAP support, but that might raise issues for Solaris users, so nothing was done. |
This is the code-side implementation of what is documented since 2019. We should get this into the 8.x branch so that we actually can remove the second parameter in the next major release. |
Sadly, stuff being documented as deprecated doesn't mean it is "formally" deprecated by our current process. We have a couple of other thing like that which didn't get yeeted in 8.0. |
It has indeed not yet been discussed on internals. As currently the code internally since at least 2015 converts a host and a port into an LDAP-URI marking usage of host AND port as deprecated in the docs seemed logically. Adding a deprecation feedback for users would be the only reasonable thing to at one point make people aware that they should modify their code. Lines 957 to 967 in f56dc76
The changes in 2015 were btw done to no longer make use of the deprecated underlying C-functions. I remember that at one point the consensus of the few people involved in it, was that an internals email or even an RFC would not be necessary as the impact isn't that huge as not a lot of people are using the feature and those that do can fix that easily usually in one or two lines of code as But I'll start a discussion on internals now to make sure the process is followed. |
Is this ready to ship @heiglandreas ? Moreover, did we not deprecate the 5 param signature at the same time? The RFC seems to state that only the 2 param version is deprecated. |
Co-authored-by: Tim Düsterhus <timwolla@googlemail.com>
The 5 param signature is a separate RFC. |
As in, it was already done, or needs to be done? |
There's no Patch referenced in the Deprecate function with overloaded signatures RFC - So it looks like that still needs to be done. As there are multiple |
From my side this should be ready to go! |
A dammit! Tests fail due to the removed dot.... 🙈 |
@heiglandreas Please also have a look at the pending review comments by cmb, especially with regard to the |
ext/ldap/tests/ldap_deprectate_connect_with_two_parameters.phpt
Outdated
Show resolved
Hide resolved
Thanks @cmb69 Co-authored-by: Christoph M. Becker <cmbecker69@gmx.de>
Right, it's in that RFC. Oki Doki |
Anything else I can do to get this merged? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM. It's a bit unfortuante that the 5 argument version has no deprecation / migration path. This means we'll need to keep the code for ports even in the next major when 2 arguments are completely removed.
Erm... IIRC the migration path is to completely remove the oracle stuff from
To me that means that in PHP9 calling So in essence: PHP8.3:
PHP8.4:
PHP9:
Or did I miss something? |
@heiglandreas Heh, I only looked at the deprecate RFC, not https://wiki.php.net/rfc/deprecate_functions_with_overloaded_signatures. That's fine then! |
Should NEWS / UPGRADING be updated? |
Yes it actually should >-> I forgot |
I've now added it. @heiglandreas Can you please check that this commit looks good to you: c2cc1db? |
ldap_connect should be called with an LDAP-URI as parameter and not with 2 parameters as that allows much more flexibility like differentiating between ldap and ldaps or setting multiple ldap-servers.
This change requires one to add null as second parameter in case the underlying library is Oracle and one wants to add wallet-details.