Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:99727 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 87739 invoked from network); 3 Jul 2017 22:16:33 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 3 Jul 2017 22:16:33 -0000 X-Host-Fingerprint: 62.180.109.77 unknown Received: from [62.180.109.77] ([62.180.109.77:19439] helo=localhost.localdomain) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 16/D9-15131-F32CA595 for ; Mon, 03 Jul 2017 18:16:33 -0400 Message-ID: <16.D9.15131.F32CA595@pb1.pair.com> To: internals@lists.php.net References: <2963553.WttLOBJENj@mcmic-probook> <9a0b9d93-a8bd-0da0-dc16-971eb5d0c448@heigl.org> Date: Tue, 4 Jul 2017 00:16:27 +0200 User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.13; rv:45.0) Gecko/20100101 Thunderbird/45.2.0 MIME-Version: 1.0 In-Reply-To: <9a0b9d93-a8bd-0da0-dc16-971eb5d0c448@heigl.org> Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 8bit X-Posted-By: 62.180.109.77 Subject: Re: [PHP-DEV] Re: [RFC] LDAP EXOP From: gmblar@gmail.com (Andreas Treichel) Hey Côme, hey Andreas. > string|FALSE ldap_exop_whoami(resource $link) - The returned string is > the DN of the currently bound user. In my opinion the code is really ease to read with exceptions. try { $user = ldap_exop_whoami($link); } catch(Throwable $e) { } > string|FALSE ldap_exop_passwd(resource $link [, string $user [, string > $oldPassword [, string $newPassword]]] - The returned string is the new > password of the user. Either the given newPassword or a newly generated one. Change password of current user with a random password. ldap_exop_passwd($link); Change password of $user with a random password. ldap_exop_passwd($link, $user); Change $oldPassword of $user with a random password. ldap_exop_passwd($link, $user, $oldPassword); Change $oldPassword of $user to $newPassword. ldap_exop_passwd($link, $user, $oldPassword, $newPassword); As i wrote the four samples, i actually already like the ordering of the arguments as it seems to make sense. How is the behavior of the following? Change $oldPassword of current user to $newPassword? ldap_exop_passwd($link, '', $oldPassword, $newPassword); Change $oldPassword of $user to empty string? Or random? Or is this an error? ldap_exop_passwd($link, $user, $oldPassword, ''); My previous suggestion was to split the function into two versions to reduce the amount of arguments. string|FALSE ldap_exop_passwd(resource $link, string $user, string $newPassword [, string $oldPassword]) string|FALSE ldap_exop_random_passwd(resource $link, string $user [, string $oldPassword]) > Or is that complete and utter nonsense? Maybe, so lets talk about the functions. i dont like the unnecessary references. But if the references makes more sense in this situation, please use them.