Le Thu, 17 Sep 2020 15:03:05 +0200,
"G. P. B." <george.bany...@gmail.com> a écrit :
> A lot of the documentation is not up to date and will needs to be updated
> after
> there has been a check of the argument names for consistency with other
> extensions in regards to named params, the stubs are the source of trust.  

I think a review of ext/ldap is needed then.

> UNKNOWN means that the default value cannot be specified due to some reason
> mostly the case for arguments passed by references or funcky function
> signature
> implementation which check the number of argument passed to the function.
>   
> > I would like to fix those conflicts.
> > Basically my questions are:
> > 1) What is the difference between s and S in zend_parse_parameters and how
> > do
> >  they behave for a NULL value?  
> 
> None in regards to userland as 's' is a char* followed by a size_t ad 'S'
> is a zend_string.
> As for all internal functions which are not nullable they will coerce null
> to the respective type
> so for a string argument null would become an empty string.  

So in the example of ldap_bind:
        if (zend_parse_parameters(ZEND_NUM_ARGS(), "r|ss", &link,
&ldap_bind_dn, &ldap_bind_dnlen, &ldap_bind_pw, &ldap_bind_pwlen) != SUCCESS)
{ RETURN_THROWS(); }

With ldap_bind($link, NULL), ldap_bind_dn is not NULL but an empty string?

> > 2) What would changing = UNKNOWN to = NULL impact?    
> 
> Explicit support for nullable types in the C implementation
>   
> > 3) When a function like ldap_bind is called, is calling ldap_bind($link),
> > and
> >  ldap_bind($link, NULL) changing anything else than ZEND_NUM_ARGS?  
> 
> This relates to point 1 and 2 above, if there is no support for nullable
> types
> passing null can change the meaning of it.  

Then I think most of these needs to be changed to NULL with explicit support,
 as it was most likely what was intended. (the underlying C functions from
 libldap accepts NULL).
Also, there are tests like ldap_sasl_bind_basic.phpt which tests a NULL
 parameter.

What is the dead line for this kind of changes in ext/ldap regarding to PHP-8?

Côme

--
PHP Internals - PHP Runtime Development Mailing List
To unsubscribe, visit: https://www.php.net/unsub.php

Reply via email to