Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:100516 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 87761 invoked from network); 11 Sep 2017 08:30:29 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 11 Sep 2017 08:30:29 -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:35743] helo=smtp.opensides.be) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 63/95-10715-4A946B95 for ; Mon, 11 Sep 2017 04:30:29 -0400 Received: from localhost (localhost [127.0.0.1]) by smtp.opensides.be (Postfix) with ESMTP id BDD181AF610 for ; Mon, 11 Sep 2017 10:30:25 +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 5vGWQsS1WPJk for ; Mon, 11 Sep 2017 10:30:25 +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 1D74D1AF612 for ; Mon, 11 Sep 2017 10:30:24 +0200 (CEST) To: PHP Internals Date: Mon, 11 Sep 2017 10:30:07 +0200 Message-ID: <1961441.cvpjKsKsi1@mcmic-probook> Organization: OpenSides User-Agent: KMail/5.2.3 (Linux/4.9.0-3-amd64; KDE/5.28.0; x86_64; ; ) MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="UTF-8" Subject: LDAP method API to give access to the result object From: come@opensides.be (=?ISO-8859-1?Q?C=F4me?= Chilliet) Hello, I=E2=80=99m working on adding controls support to php-ldap, so far sending = controls to the server works fine. I would now like to be able to get the controls returned by the server. This can easily be done when methods are returning the result object, like = ldap_search does, in which case calling ldap_parse_result on the result obj= ect gives access to the controls. But for all methods returning a boolean, I need to add some way to get the = result object back. These methods are: ldap_bind, ldap_sasl_bind, ldap_add, ldap_mod_replace, l= dap_modify (which actually is an alias on ldap_mod_replace), ldap_mod_add, = ldap_mod_del, ldap_delete, ldap_modify_batch, ldap_compare and ldap_rename. I can see 4 solutions: =2D Return a result object instead of the boolean, but that would be breaki= ng BC and would mean the caller have to call ldap_parse_result just to now = if it worked, it will bloat code most likely. =2D Add an optional out parameter getting filled with the result if it=E2= =80=99s there. That=E2=80=99s a bit ugly and would get messy if we need to = add more parameters later. =2D Store the result object and add an ldap_get_result() method to get the = result from the last ldap call. This is close to what is done for errors. I= don=E2=80=99t like this very much because is means storing in memory an ob= ject without knowing if it will be used, and complex ldap calls will need o= ne more method call. =2D Creating separate methods which returns the result object. This is what= was done by the controls patches outthere, and what is done in the C API a= s well. That would result in ldap_bind_ext, ldap_add_ext, =E2=80=A6 which p= eople would use when they need to parse the result themselves. So I would go toward the 4th option but I=E2=80=99m interested in any opini= on on this, or any remarks. C=C3=B4me