Hi Côme Chilliet,

> 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?

I manually tested that to make sure - yes, it's the empty string in the current 
implementation, not null.

    if (zend_parse_parameters(ZEND_NUM_ARGS(), "r|sssssss", &link, &binddn, 
&dn_len, ...) != SUCCESS) {
        RETURN_THROWS();
    }
    fprintf(stderr, "binddn=%llx binddn_len=%d\n", (long long)binddn, binddn ? 
(int) strlen(binddn) : 0);

Outputs `binddn=23ddbd8 binddn_len=0` when the second argument is null.
So yes, it's currently an empty string, but only if null is passed.

Named parameters cannot be used to skip passing those UNKNOWN parameters right 
now.
`ArgumentCountError: ldap_sasl_bind(): Argument #2 ($binddn) must be passed 
explicitly, because the default value is not known`
is the output for `ldap_sasl_bind($resource, props: $props)`

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

Reply via email to