Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:119426 Return-Path: Delivered-To: mailing list internals@lists.php.net Received: (qmail 1343 invoked from network); 27 Jan 2023 15:54:04 -0000 Received: from unknown (HELO php-smtp4.php.net) (45.112.84.5) by pb1.pair.com with SMTP; 27 Jan 2023 15:54:03 -0000 Received: from php-smtp4.php.net (localhost [127.0.0.1]) by php-smtp4.php.net (Postfix) with ESMTP id EF7A71804F7 for ; Fri, 27 Jan 2023 07:54:02 -0800 (PST) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on php-smtp4.php.net X-Spam-Level: X-Spam-Status: No, score=-2.8 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_LOW, RCVD_IN_MSPIKE_H3,RCVD_IN_MSPIKE_WL,SPF_HELO_PASS,SPF_NONE, T_SCC_BODY_TEXT_LINE autolearn=no autolearn_force=no version=3.4.2 X-Spam-ASN: AS19151 66.111.4.0/24 X-Spam-Virus: No X-Envelope-From: Received: from out4-smtp.messagingengine.com (out4-smtp.messagingengine.com [66.111.4.28]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange ECDHE (P-256) server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by php-smtp4.php.net (Postfix) with ESMTPS for ; Fri, 27 Jan 2023 07:54:02 -0800 (PST) Received: from compute4.internal (compute4.nyi.internal [10.202.2.44]) by mailout.nyi.internal (Postfix) with ESMTP id 693745C0152 for ; Fri, 27 Jan 2023 10:54:00 -0500 (EST) Received: from imap50 ([10.202.2.100]) by compute4.internal (MEProxy); Fri, 27 Jan 2023 10:54:00 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= garfieldtech.com; h=cc:content-type:date:date:from:from :in-reply-to:in-reply-to:message-id:mime-version:references :reply-to:sender:subject:subject:to:to; s=fm3; t=1674834840; x= 1674921240; bh=cWGCT9mSM/i5bLqu8DX2I9wWA0zWnKC1FadzQTaw7hw=; b=A mO+SCS50DpHILmcUa0inbKvhJmaxFnqkHR2Loe26Y7NrScCiBjQoiMZR5AinMeKG 7jg4fu9yaPNQHnRRHsH0uSJx3MN5ujShLBFD0/ZytMkzKugnwqicqoYKADxz5rsS 4etoCrAKFsLhss/z5JIGjS75zeidSzWp14z6d6m2XGD+zSf7QSvqelhCuEDtLay6 2Nt94+JvQmuhyL7qEx5bvc1B+K/u5Bd2ZOiEEFtXFyz3O3Toulecq7+zbJQV7EPr v9LYVDSlpzXnEaZHXYuguQSNEKH9UmW4rA5Vz0kAPmUlLnRZz4WhLX+OYdX1/zmE +dIyQ1k1SIc35qASvFtow== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:content-type:date:date:feedback-id :feedback-id:from:from:in-reply-to:in-reply-to:message-id :mime-version:references:reply-to:sender:subject:subject:to:to :x-me-proxy:x-me-proxy:x-me-sender:x-me-sender:x-sasl-enc; s= fm3; t=1674834840; x=1674921240; bh=cWGCT9mSM/i5bLqu8DX2I9wWA0zW nKC1FadzQTaw7hw=; b=GmrgoHfOvC8982WHQPCg5ltpJfZPzdJl8ljUOLY8/ZMD pTkXmnPmcQxWgdJfWUmjco//LloTtFvKkccphJYDoLanzSkiixaYklwbFX5/sB/x CUmfeWNLEmpZkxBUO53VGnm+c4r88JMfBNhSboZemIA5CWUSKwbZkMj/cVs+jIUq ErZIiCBcw16NTp4OIpa5/1islavr9DXvoNNQQ/6s7ot6TiDz0WvfETS/j0ZH/hGz uSXoFDXBLi6uz/5hanpUFVewOfaT3FwwpULYbQ2hg13udCfVVOYrL/rRqDI+PTGW 8zhpecrKx1vuABV6apmkvnHs8f3qv1JUqpkkUQZRog== X-ME-Sender: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedvhedruddviedgkedtucetufdoteggodetrfdotf fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfqfgfvpdfurfetoffkrfgpnffqhgen uceurghilhhouhhtmecufedttdenucesvcftvggtihhpihgvnhhtshculddquddttddmne cujfgurhepofgfggfkjghffffhvffutgesthdtredtreertdenucfhrhhomhepfdfnrghr rhihucfirghrfhhivghlugdfuceolhgrrhhrhiesghgrrhhfihgvlhguthgvtghhrdgtoh hmqeenucggtffrrghtthgvrhhnpeefteevffetteeuueekgeejffduueehtdfhveefheei hfehgeehffehtdehgfeljeenucffohhmrghinhepphhhphdrnhgvthdpghhithhhuhgsrd gtohhmnecuvehluhhsthgvrhfuihiivgeptdenucfrrghrrghmpehmrghilhhfrhhomhep lhgrrhhrhiesghgrrhhfihgvlhguthgvtghhrdgtohhm X-ME-Proxy: Feedback-ID: i8414410d:Fastmail Received: by mailuser.nyi.internal (Postfix, from userid 501) id 106251700090; Fri, 27 Jan 2023 10:53:59 -0500 (EST) X-Mailer: MessagingEngine.com Webmail Interface User-Agent: Cyrus-JMAP/3.9.0-alpha0-85-gd6d859e0cf-fm-20230116.001-gd6d859e0 Mime-Version: 1.0 Message-ID: In-Reply-To: References: Date: Fri, 27 Jan 2023 09:53:39 -0600 To: "php internals" Content-Type: text/plain Subject: Re: [PHP-DEV] Deprecate ldap_connect with host and port as separate arguments From: larry@garfieldtech.com ("Larry Garfield") On Fri, Jan 27, 2023, at 3:00 AM, Andreas Heigl wrote: > Hey Folks. > > I think it would be a good idea to deprecate calling ldap_connect with 2 > parameters host and port. > > Wait: What? > > Currently there are three ways one can call ldap_connect. > > 1. With a string $ldap_uri > 2. With a string $host and an int $port, > 3. With even more parameters for those that did compile PHP with OracleLDAP. > > The 3rd way of calling it is not even documented in the docs as it is a > very niche edge-case that would only confuse most people. > > The 2nd way of calling the function is based on the since some years > deprecated underlying ldap_open function. Internally we already moved to > the underlying ldap_initialize-function that requires passing an > LDAP-URI. For that we are already converting the passed host and port > into an LDAP-URI of the form 'ldap://$host:$port'. > > This already illustrates one of the issues that this way of calling the > function implies: It is not possible to use ldaps as a schema using that > way of calling ldap_connect as it will always use ldap as schema. No > matter which port is passed. > > A second reason why I think we should deprecate calling ldap_connect > with two parameters is, that it does not allow one to pass multiple > ldap-servers as it is possible using the LDAP-URI. > > This is for sure a BC-break but in my opinion a rather small one as > there are not many users actually using it and there is a clear and easy > migration path for those that use it: Instead of calling > > ldap_connect($host, $port) > > one calls > > ldap_connect("ldap://$host:$port??369") > > Also most of the users should not be affected at all as they are using > 3rd party libraries that are already only using an LDAP-URI when calling > ldap_connect like Laminas\Ldap or Symfony\Ldap > > The documentation at https://www.php.net/ldap_connect also explicitly > states (for some time by now) that using host and port is considered > deprecated. > > Named parameters btw also only support ldap_connect(uri: > 'ldap://example.com') and ldap_connect(host:'example.com', port:369) > will throw an error. > > There already is a PR open[1] that implements the deprecation so that > for the upcoming PHP8 releases each call to ldap_connect with 2 > parameters would emit a deprecation message so that people have enough > time to adapt their code before we can actually remove using two > parameters in the next major release. > > Thanks for your comments. > > Cheers > > Andreas > > [1] https://github.com/php/php-src/pull/5177 This would require an RFC, obviously, but it seems reasonable to me. "Variable meaning parameters" was always a bad idea, and cleaning them up is a good idea. --Larry Garfield