-
Notifications
You must be signed in to change notification settings - Fork 7.9k
Fixed warning in ldap_set_rebind_proc() #5763
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
Conversation
|
@ptomulik Where is your question regarding the empty string case? I remember that I received an email notification about it. Unfortunately, I hadn't seen that Now, I'm not exactly sure what to do.
@nikic Should we go for the first one, or do you have a better suggestion? |
I'm sorry, I've deleted it (after writing it I found it irrevelant).
I believe, empty string is still accepted after the change in
I have no strict knowledge about the purpose of
|
.. or add |
|
Especially as the current behavior is undocumented (https://www.php.net/ldap_set_rebind_proc), I think it may be acceptable to change this from "" to null in PHP 8. The current behavior is really quite unusual. However, I don't have any particular familiarity with LDAP and don't know whether removing the callback via ldap_set_rebind_proc is a common operation (I would assume no). Maybe @MCMic can chime in, who is the maintainer of this extension if I remember correctly. |
|
@ptomulik To answer the other questions: The type specified in the stub still needs to be correct, and there will be failures in debug builds if it isn't (assuming the test coverage exists). LDAP is being built in CI to check it compiles, but we don't have the necessary setup to actually run the tests. |
|
Just changed the function signature and few lines of code to make the ptomulik@barakus:$ LDAP_TEST_HOST=172.18.0.2 LDAP_TEST_BASE="dc=example,dc=org" LDAP_TEST_USER='cn=admin,dc=example,dc=org' LDAP_TEST_PASSWD='admin' sapi/cli/php ./run-tests.php ext/ldap/tests/ldap_set_rebind_proc_basic.phpt ext/ldap/tests/ldap_set_rebind_proc_error.phpt
=====================================================================
PHP : /home/ptomulik/sources/php-src/sapi/cli/php
PHP_SAPI : cli
PHP_VERSION : 8.0.0-dev
ZEND_VERSION: 4.0.0-dev
PHP_OS : Linux - Linux barakus 5.6.0-2-amd64 #1 SMP Debian 5.6.14-2 (2020-06-09) x86_64
INI actual : /home/ptomulik/sources/php-src
More .INIs :
---------------------------------------------------------------------
PHP : /home/ptomulik/sources/php-src/sapi/phpdbg/phpdbg
PHP_SAPI : phpdbg
PHP_VERSION : 8.0.0-dev
ZEND_VERSION: 4.0.0-dev
PHP_OS : Linux - Linux barakus 5.6.0-2-amd64 #1 SMP Debian 5.6.14-2 (2020-06-09) x86_64
INI actual : /home/ptomulik/sources/php-src
More .INIs :
---------------------------------------------------------------------
CWD : /home/ptomulik/sources/php-src
Extra dirs :
VALGRIND : Not used
=====================================================================
Running selected tests.
PASS ldap_set_rebind_proc() - Basic ldap_set_rebind_proc test [ext/ldap/tests/ldap_set_rebind_proc_basic.phpt]
PASS ldap_set_rebind_proc() - Testing ldap_set_rebind_proc() that should fail [ext/ldap/tests/ldap_set_rebind_proc_error.phpt]
=====================================================================
Number of tests : 2 2
Tests skipped : 0 ( 0.0%) --------
Tests warned : 0 ( 0.0%) ( 0.0%)
Tests failed : 0 ( 0.0%) ( 0.0%)
Tests passed : 2 (100.0%) (100.0%)
---------------------------------------------------------------------
Time taken : 0 seconds
===================================================================== |
36977bc to
c1d7c30
Compare
|
@ptomulik The patch looks good for me, but let's wait for Nikita's review. However, could you please also add an entry to the UPGRADING file? |
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
Done. |
3d0229b to
d134e50
Compare
|
Thanks! |
|
Hello, Sorry for the delay on looking into this, glad to see it was handled :-) I’m fine with the change to NULL, seems consistent, as long as it’s listed in UPGRADING. @ptomulik I may have missed it but what is the warning that this PR fixed, I did not find the information? |
In ldap.c around line 3766: - zend_string *callback_name = zend_get_callable_name(callback);
- php_error_docref(NULL, E_WARNING, "Two arguments expected for '%s' to be a valid callback", ZSTR_VAL(callback_name));
+ zend_argument_type_error(2, "must be a valid callback or null, %s given", zend_zval_type_name(callback));The previous version yielded something like "Two arguments expected for $callback to be a valid callback", which looked quite "non-standard". |
No description provided.