Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:99709 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 44254 invoked from network); 3 Jul 2017 15:42:07 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 3 Jul 2017 15:42:07 -0000 Authentication-Results: pb1.pair.com header.from=come@opensides.be; sender-id=pass Authentication-Results: pb1.pair.com smtp.mail=come@opensides.be; spf=pass; sender-id=pass Received-SPF: pass (pb1.pair.com: domain opensides.be designates 195.154.20.141 as permitted sender) X-PHP-List-Original-Sender: come@opensides.be X-Host-Fingerprint: 195.154.20.141 smtp.opensides.be Received: from [195.154.20.141] ([195.154.20.141:41090] helo=smtp.opensides.be) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 67/23-15131-DC56A595 for ; Mon, 03 Jul 2017 11:42:06 -0400 Received: from localhost (localhost [127.0.0.1]) by smtp.opensides.be (Postfix) with ESMTP id BCD9777D34 for ; Mon, 3 Jul 2017 17:42:02 +0200 (CEST) X-Virus-Scanned: Debian amavisd-new at opensides.be Received: from smtp.opensides.be ([127.0.0.1]) by localhost (smtp.opensides.be [127.0.0.1]) (amavisd-new, port 10024) with LMTP id CguVG63d1x7n for ; Mon, 3 Jul 2017 17:42:00 +0200 (CEST) Received: from mcmic-probook.localnet (63.120.199.77.rev.sfr.net [77.199.120.63]) by smtp.opensides.be (Postfix) with ESMTPSA id E8C4B77BDA for ; Mon, 3 Jul 2017 17:42:00 +0200 (CEST) To: internals@lists.php.net Date: Mon, 03 Jul 2017 17:41:41 +0200 Message-ID: <22047139.crhYHZD0IP@mcmic-probook> Organization: OpenSides User-Agent: KMail/4.14.1 (Linux/3.16.0-4-amd64; KDE/4.14.2; x86_64; ; ) In-Reply-To: References: <2963553.WttLOBJENj@mcmic-probook> MIME-Version: 1.0 Content-Type: multipart/signed; boundary="nextPart2030150.tvuyc5jthi"; micalg="pgp-sha256"; protocol="application/pgp-signature" Subject: Re: [PHP-DEV] Re: [RFC] LDAP EXOP From: come@opensides.be (=?ISO-8859-1?Q?C=F4me?= Chilliet) --nextPart2030150.tvuyc5jthi Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" Le lundi 3 juillet 2017, 17:04:02 Andreas Treichel a =C3=A9crit : > i dont see the benefit to return a single value with a reference. >=20 > Without a reference the function can used as an argument: > doSomethingWithTheUserName(ldap_whoami($link)); Where do you handle errors in this case? For me returning a mixed will result in: $identity =3D ldap_exop_whoami($link); if ($identity !=3D=3D FALSE) { =09// do something with $identity } else { =09// handle errors } While with the reference it=E2=80=99s cleaner: if (ldap_exop_whoami($link, $identity)) { =09// do something with $identity } else { =09// handle errors } It seems both solutions exists in existing LDAP methods: https://secure.php.net/manual/en/function.ldap-get-option.php https://secure.php.net/manual/en/function.ldap-get-dn.php The other thing I liked about using bool return and a reference is that= it will allow all ldap_exop_* methods to be consistent, all returning = a boolean and filling as many reference parameters as needed (from 0 to= whatever). > same with the return statement of a method: >=20 > class MyLdap > { > public function getCurrentUser(): string > { > return ldap_whoami($this->link); > } > } >=20 > class MyLdap > { > function getCurrentUser(): string > { > ldap_whoami($this->link, $username); > return $username; > } > } This is a valid point. C=C3=B4me --nextPart2030150.tvuyc5jthi Content-Type: application/pgp-signature; name="signature.asc" Content-Description: This is a digitally signed message part. Content-Transfer-Encoding: 7Bit -----BEGIN PGP SIGNATURE----- Version: GnuPG v2 iQIcBAABCAAGBQJZWmW5AAoJEKhk2MPOyw4AE+MP/2SdXGjrTGmlYMDOCtC6EsQg NOQuI3VKQRA/TPYMTvPXL6vusG//LMcJcbiVkI4hIUg5IR2xg4Q4RF1l2oMYLZtR bMHHgJeBroXk2E9lzac3/XRuGNFYuiVIQAQPXpU2z7zW9P9oS0pQHg+q7n08CvSJ ZsLw996Kmxv4Ly7XtXNTzk44ghlNnqclgOmYZlynScAM8p6c9GgDXi9eZ1FHJejK xNaMaWwEMAI3potZgaMlDUwkKuPf50S/zpUmAQD7YSWX/2+krEOcUNSNnCADCmsk Xoq0UXnGPRD5jwMlsnWC63aA6683HqTbMwayuHl5PT3yP76r4MdrW3T1/l1iJnxZ RwQM4N/89Iv2t+a/caQpdtHABK9b/ehql3Gs5CUQCPdF8ea3sV6SdGvyiN3HQgk0 UzrM/Q7L7vLz0aH62d32whJNbu366+86VxLpwvAMoGA750caLpHCemp/yFJaG4NT 3gN0RiWyBvV92GI2PlsWPmsGNJ03REHqYfoEiw+xJZP2kWrySm+r4v4jq+CUySux Q581SHqFUX7FEi+dmc1e4ju5QWmjEOTm/wt84j04ntL7PxF36nL2I4booxQjW8qz PCV8klGMK4SuMcDHKXfUZL1lJ4r7L321as76FB9tR97EGr4T3KuXxXZ3tPhA3Pxs iEhy9jo7oo8j8X5Tpzin =X3be -----END PGP SIGNATURE----- --nextPart2030150.tvuyc5jthi--