Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:120623 Return-Path: Delivered-To: mailing list internals@lists.php.net Received: (qmail 99949 invoked from network); 19 Jun 2023 20:17:54 -0000 Received: from unknown (HELO php-smtp4.php.net) (45.112.84.5) by pb1.pair.com with SMTP; 19 Jun 2023 20:17:54 -0000 Received: from php-smtp4.php.net (localhost [127.0.0.1]) by php-smtp4.php.net (Postfix) with ESMTP id 1CD8E1804D7 for ; Mon, 19 Jun 2023 13:17:54 -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=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_FROM,HTML_MESSAGE, RCVD_IN_DNSWL_NONE,RCVD_IN_MSPIKE_H2,SPF_HELO_NONE,SPF_PASS, T_SCC_BODY_TEXT_LINE autolearn=no autolearn_force=no version=3.4.2 X-Spam-ASN: AS15169 209.85.128.0/17 X-Spam-Virus: No X-Envelope-From: Received: from mail-wm1-f48.google.com (mail-wm1-f48.google.com [209.85.128.48]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange ECDHE (P-256) server-signature ECDSA (P-256) server-digest SHA256) (No client certificate requested) by php-smtp4.php.net (Postfix) with ESMTPS for ; Mon, 19 Jun 2023 13:17:53 -0700 (PDT) Received: by mail-wm1-f48.google.com with SMTP id 5b1f17b1804b1-3f900cd3f96so26479095e9.2 for ; Mon, 19 Jun 2023 13:17:53 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20221208; t=1687205872; x=1689797872; h=to:subject:message-id:date:from:in-reply-to:references:mime-version :from:to:cc:subject:date:message-id:reply-to; bh=gaEkHLtGqoJszrdAwD49FBUUJEAeXpKGgH+aFCmexdQ=; b=lkRHUI1kZF0liDJPTCPIE8vrzd1Kndq57OyMH3FAPAAFbg13eRi/0Dc6rflNFB+vI0 Ci2Uxy0hmlVXGSNJxnH4GiygbvukwYcXxgJ4d53ReZDCHPXomMsqTLnLUtS4WSMz/Q6C MtS3VmdfeeVep3+Qm7Thy0tUV9rJ/NceGOyAMnyakcdNEw8qZ0/AdQsf1UqIRxvP4ZO/ v7NaIdGTuz9Rmy0E+GZdg2afijmCfvKaMQ3glEvS/ZHF2dW4FGuJMXVMOC2E//01vqaa phAh+Zf75zEzkqVPA9HXskn95KktOmkaX7hk639Lh0cevPvecmA8RslHAvPiD/6wuLFw oAEg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1687205872; x=1689797872; h=to:subject:message-id:date:from:in-reply-to:references:mime-version :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=gaEkHLtGqoJszrdAwD49FBUUJEAeXpKGgH+aFCmexdQ=; b=HhQnKfWXBulivuak1y7whavD9+9NoBZ7wpdR4Uy/br4tNOKSgj8rRmlu8xgOZ1iYEj qN/YIgb08/Op6VCrem93CLAiVWT2Oa2fT5vMiLM1jA+ct7I0Qx0uzxs4TwKQn48hjtBG 4zZGNUkt1XZJiJGphMbAkQy5nDSOpl3YqT2GxfRJFEQlR+lym5/+aj7E+8N3CpB6/bUO et0c8ZGByNHgyqo/YR+wu4MiISgjBuRqdiO6cX0Syy3pxXzvncZ1qeboBNNlxqvNUS2X c1LOINhfe5CbUHyinFSgScXMaHu8eiXupW6ci9wNnakVZCjg6rBc2QUkbQ/XmUg1Sx9w fbUA== X-Gm-Message-State: AC+VfDxAlXFYkJkwdfcYq2K1nABzHIo1raRFxVcT+LGjjOGsEjLtjZJ3 0q1NZ9RUYUY8jQV17fT4n83oqTUPes6OKuMpKcZB+fm8XRYZwQ== X-Google-Smtp-Source: ACHHUZ6sVqX7ztPJJ3QmI34yeOGEEE4MFKZwD7kkdt8t4BfLgEHNigedTLzTlgVOUKugF2aLYXH7boGuuWe7KHLbsBI= X-Received: by 2002:a05:600c:3658:b0:3f9:b0fe:7e16 with SMTP id y24-20020a05600c365800b003f9b0fe7e16mr2356945wmq.28.1687205871910; Mon, 19 Jun 2023 13:17:51 -0700 (PDT) MIME-Version: 1.0 References: <108411AD-DBC4-4436-8190-7569B7A0805F@gmail.com> In-Reply-To: Date: Mon, 19 Jun 2023 22:17:40 +0200 Message-ID: To: internals@lists.php.net Content-Type: multipart/alternative; boundary="000000000000a8828905fe813ad1" Subject: Re: Fwd: [PHP-DEV] [RFC] [Discussion] Deprecate functions with overloaded signatures From: nicolas.grekas+php@gmail.com (Nicolas Grekas) --000000000000a8828905fe813ad1 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable Le mer. 14 juin 2023 =C3=A0 23:51, M=C3=A1t=C3=A9 Kocsis a =C3=A9crit : > > > > Given that you've agreed that neither signature is "primary" or "better= ", > > doesn't that argument apply equally to both signatures? If it's OK to > force > > anyone using individual callbacks to change their code, why is it not > > equally OK to force anyone using an object to change their code? > > > > As far as I remember, my reasoning was two-fold: > - naming: passing *multiple* callbacks to a function name in singular > (session_set_save_handler()) > is definitely not ideal > - a decision had to be made and I thought that keeping the OO approach in > place had less BC impact, > especially because previously I got feedback from Nicolas that they used > this version. > > > > I do wonder if this change is too disruptive relative to the benefit it > > brings, but in that case, we should just leave the whole function as it > is. > > > > In my opinion, phasing out session_set_save_handler() completely would be > worth the effort if this > was the only option to fix the overridden signature. However, it's not th= e > case, since strictly speaking, > only one of the two signatures has to be removed in order to achieve the > desired goal of the RFC. > The whole discussion about also deprecating the other one started only > because of improving naming: > it is also a nice thing to pursue but fails the cost-benefit analysis. Al= l > in all, I think neither not doing > anything, nor deprecating the whole function is a good choice. But at lea= st > I definitely want the question > to be settled with putting this to vote. > > I don't think "handler" particularly implies "object". The "handler" pass= ed > > to set_error_handler is a function, and your original suggestion for a > new > > function was "session_set_save_handlers", where "handler" would also me= an > > "function". > > > > Without any suffix at all, it seems like "set a session handler the norma= l > > way" vs "set a session a special different way"; like how > > "array_merge_recursive" is a special version of "array_merge". > > > > I think my reasoning is easier to understand if we go back to my original > suggestion: > session_set_save_handler() and session_set_save_handlers(), which would b= e > session_set_handler() and session_set_handlers() now. That was the starti= ng > point, > but you didn't like that they only differ by an "s". That's why I swapped > the "s" with "callbacks". > > According to your deduction, session_set_handler() is not the most correc= t > name indeed, but I don't think > that we always have to choose the most correct and the entirely descripti= ve > one. After all, neither the > parameters of session_set_handler() are called "$open_callback", > "$close_callback" etc., they are just > "$open", "$close" etc. and I guess they are still clear enough, given tha= t > their type is declared which > completes the missing context. > > Similarly, we all would know that the session_set_handler() function > expects an object of > SessionHandlerInterface type, while its sibling, > session_set_handler_callbacks() expects some > callbacks. Yes, having the _object suffix is the most pedantic name, but > personally, I don't really like it > because I find it ugly (and I was pretty much content with > session_set_handlers()). I'm curious about > the point of view of other people though, because if it turns out that > people generally also favor some > other name then I'm ok with a compromise. > I think we must account for a bit of history/legacy on the topic. I think session_set_save_handler(SessionHandlerInterface) is the best BC/FC path we can provide. And I don't think we should alias this function to a new name because that would require users to make a choice, and will lead to confusion, because in this case, the choice is purely cosmetic, but people will still have to get it. Nicolas --000000000000a8828905fe813ad1--