Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:111881 Return-Path: Delivered-To: mailing list internals@lists.php.net Received: (qmail 89913 invoked from network); 17 Sep 2020 14:16:30 -0000 Received: from unknown (HELO php-smtp4.php.net) (45.112.84.5) by pb1.pair.com with SMTP; 17 Sep 2020 14:16:30 -0000 Received: from php-smtp4.php.net (localhost [127.0.0.1]) by php-smtp4.php.net (Postfix) with ESMTP id 93CDD1804B8 for ; Thu, 17 Sep 2020 06:25:09 -0700 (PDT) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on php-smtp4.php.net X-Spam-Level: X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,SPF_HELO_NONE, SPF_PASS autolearn=no autolearn_force=no version=3.4.2 X-Spam-Virus: No X-Envelope-From: Received: from smtp-in.fusiondirectory.org (smtp-in.opensides.be [195.154.20.156]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange ECDHE (P-256) server-signature RSA-PSS (4096 bits)) (No client certificate requested) by php-smtp4.php.net (Postfix) with ESMTPS for ; Thu, 17 Sep 2020 06:25:09 -0700 (PDT) Received: from smtp-in.fusiondirectory.org (localhost.localdomain [127.0.0.1]) by smtp-in.fusiondirectory.org (Proxmox) with ESMTP id 580D01012C6 for ; Thu, 17 Sep 2020 15:25:08 +0200 (CEST) Received: from smtp.fusiondirectory.org (smtp.fusiondirectory.org [195.154.20.141]) by smtp-in.fusiondirectory.org (Proxmox) with ESMTP id 2111E1002AB for ; Thu, 17 Sep 2020 15:25:08 +0200 (CEST) Received: from mcmic-probook.opensides.be (63.120.199.77.rev.sfr.net [77.199.120.63]) by smtp.fusiondirectory.org (Postfix) with ESMTPSA id E6DB08BC10 for ; Thu, 17 Sep 2020 15:25:07 +0200 (CEST) Date: Thu, 17 Sep 2020 15:25:07 +0200 To: PHP internals Message-ID: <20200917152507.1203e8e2@mcmic-probook.opensides.be> In-Reply-To: References: <20200917145304.4a6cfe45@mcmic-probook.opensides.be> Organization: FusionDirectory X-Mailer: Claws Mail 3.14.1 (GTK+ 2.24.31; x86_64-pc-linux-gnu) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable Subject: Re: [PHP-DEV] Stubs in ext/ldap From: come.chilliet@fusiondirectory.org (=?UTF-8?B?Q8O0bWU=?= Chilliet) Le Thu, 17 Sep 2020 15:03:05 +0200, "G. P. B." a =C3=A9crit : > 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.= =20 I think a review of ext/ldap is needed then. > UNKNOWN means that the default value cannot be specified due to some reas= on > mostly the case for arguments passed by references or funcky function > signature > implementation which check the number of argument passed to the function. > =20 > > 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? =20 >=20 > 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. =20 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) !=3D SUCC= ESS) { RETURN_THROWS(); } With ldap_bind($link, NULL), ldap_bind_dn is not NULL but an empty string? > > 2) What would changing =3D UNKNOWN to =3D NULL impact? =20 >=20 > Explicit support for nullable types in the C implementation > =20 > > 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? =20 >=20 > This relates to point 1 and 2 above, if there is no support for nullable > types > passing null can change the meaning of it. =20 Then I think most of these needs to be changed to NULL with explicit suppor= t, 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=C3=B4me