Re: Stubs in ext/ldap

From: Date: Thu, 17 Sep 2020 13:33:41 +0000
Subject: Re: Stubs in ext/ldap
References: 1 2 3  Groups: php.internals 
Request: Send a blank email to internals+get-111883@lists.php.net to get a copy of this message
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

« previous php.internals (#111883) next »