Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:116601 Return-Path: Delivered-To: mailing list internals@lists.php.net Received: (qmail 5825 invoked from network); 9 Dec 2021 11:45:17 -0000 Received: from unknown (HELO php-smtp4.php.net) (45.112.84.5) by pb1.pair.com with SMTP; 9 Dec 2021 11:45:17 -0000 Received: from php-smtp4.php.net (localhost [127.0.0.1]) by php-smtp4.php.net (Postfix) with ESMTP id 045C61804E3 for ; Thu, 9 Dec 2021 04:45:55 -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=-1.8 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,FREEMAIL_ENVFROM_END_DIGIT,FREEMAIL_FROM,NICE_REPLY_A, RCVD_IN_MSPIKE_H2,SPF_HELO_NONE,SPF_PASS autolearn=no autolearn_force=no version=3.4.2 X-Spam-ASN: AS8560 212.227.0.0/16 X-Spam-Virus: No X-Envelope-From: Received: from mout.gmx.net (mout.gmx.net [212.227.17.21]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange ECDHE (P-256) server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by php-smtp4.php.net (Postfix) with ESMTPS for ; Thu, 9 Dec 2021 04:45:53 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=gmx.net; s=badeba3b8450; t=1639053952; bh=xHfuq2nMs2gnqU1oJ005qom3VEWDLfQ8j3NaLP+PnD0=; h=X-UI-Sender-Class:Date:Subject:To:References:From:In-Reply-To; b=DjtZiadvYmMSasWTqrflUs/s3l5sXMXHhm2lif2AHCYEqmsuYMcDRfkkZpo84ARQW WKmOR9z3X2u8EcnoxuCALu1VvK3uyQwoRDzlZSx62gIh3VpZW3WSFawDdk3taO5CZk A7Azg5ad5jJjI14a8d4ZGrcKrV1A67DdYDA4g5OI= X-UI-Sender-Class: 01bb95c1-4bf8-414a-932a-4f6e2808ef9c Received: from [192.168.2.130] ([84.179.239.183]) by mail.gmx.net (mrgmx104 [212.227.17.168]) with ESMTPSA (Nemesis) id 1MrhQC-1m9oxX3wvM-00njvS; Thu, 09 Dec 2021 13:45:52 +0100 Message-ID: <39fe7e98-30c0-200f-e545-df0e334f7bea@gmx.de> Date: Thu, 9 Dec 2021 13:45:51 +0100 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:91.0) Gecko/20100101 Thunderbird/91.3.2 Content-Language: de-DE To: Rowan Tommins , internals@lists.php.net References: <02ba01d7ecbc$c0e13370$42a39a50$@webkr.de> In-Reply-To: Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable X-Provags-ID: V03:K1:VchB2x5A6YWCn2X8SDqRznQM0qoyYDoDeb3UaGeTAx/T1KsXEz0 6C8lECwcxRMeffqR88G9z2/yPy6/OUWBRU/8j/CusT1X9tTy5tcRT1sr6ga0MXD/m0sQJoT nAWxlqYZ0icsxj4YRCs5iz4a8XjV4zjSFnI6Iw9/ojPAvnienIDP5vZkJQKL1ctgeP58Q2H GynON0KIMCubG9Gp367Ug== X-UI-Out-Filterresults: notjunk:1;V03:K0:Rh4Xz6GWu1M=:ATpsFLOvUJx3Q1iQndDuiZ eT8FbSTnihAEtHfL7GaKa64ZittnHmscA8BGa3VLUHTGPjAQ3MHK7T3b02o9bHZ3vganuFjvT kwhG0vpQ1vSfwDTo2r8S75cZYc6AY88mKYb0KfHQsueCYP/nsETWfEiQPozqFIMDPYiHGvGAY dvAtyv4q6YHWIY5goYYpY66Mn+nmKCbkC9OGts6C6BOSpF1XJTbds778eM1Qeeha+VFfyqtAm UqS7U95Y8RRko9lNt3tPtz1z4buge7+9ge8iuBQLPFrF0fvVnJyHMkRc9plZl+Dc6v8VP3Awi 6W3f5zp5WrNfjEHP8ZUY7mAKNyBoO2+q+tHqroZL9rVc0QSAyHhgS+A69dv5XigTDqPRQZM7x 7ZrSvspyRhJ2+E49ZPsR7UEVergal3ssqZ8N3jwTWjZR+ebk1VYzmtJeJb1NBuamn08m9Zs7J gw2X0sFZSF6nnrFC/K1vvg2vJ7Vff60UQoLW1MWg+Nsf+jjOUBFNgMOY+H6L2bWLbHj2YlnU2 /A41iLDc8zIplPmvfcUankQqYSc0OtGlI7fbZH+qB3l0zPTZNOsiRrUGFx3zzmK6aOwWNymVc BdwnpEb/NBzCmtSGok7LOx401ANe1IiTfDlDMsJb4NA9U8tr1RWhbqGfcN62fMV1NbL3nqkXY V+p00Bo8QdaYaGffnXC6gPBwzxrffBhuPPHWTz3oS2W2WP4W2o5JVef3ucnYZ3cB2jCKGweeb v7o+MCHlSPRzgdVBNFUtNLmFtMhVlr96caTQr5cK+dVIWXUlDYhtuJ2iW8UsbhY7eSKWt7FOX C6nDjazXYA7jwowxJDq5wBK+ge/ydKymcCvY5G+ixZvgBDhjsL1GvSFqiQi/JlnHzZ7pURMlK FKbg0Ozhvt+SuY48FbpUVUxLwOuw+Q+llzPAbEo2ikohjW1Qn8M5x/PtxV9k61Ykw7nhtb7J4 ejQTRX0PX9f+r73HV7Hj8umw3tGTC75T1uFxg6weycDhkiKac2GqvO1Fr9B6Lg177lIELxe2Y 34v/b6s65eKLePBgt0dr2C24ZlVVAOqinzDV+hsyJhI6D23Hz796IcR6AQUVGFD5pS+8yVB/+ srGBw9MuKl9hnk= Subject: Re: [PHP-DEV] Allow default parameters before non-default ones? From: cmbecker69@gmx.de ("Christoph M. Becker") On 09.12.2021 at 13:03, Rowan Tommins wrote: > On 09/12/2021 05:22, Andr=C3=A9 H=C3=A4nsel wrote: > >> If I try the same thing in PHP 8.0 I get a Deprecated warning and if I >> try >> it in PHP 8.1 I get something that I don't understand: >> https://3v4l.org/cg4DA > > There are two diagnostics showing in 8.1, the deprecation on the > declaration, and a fatal error on the call. > > What's happened is that given your signature: > >> function blah($foo =3D "deffoo", $bar) { ... } > > PHP has decided it doesn't make sense, and re-interpreted it as this: > >> function blah($foo, $bar) { ... } > > Then when you try to call it: > >> blah(bar: "1"); > > You're missing the now-mandatory parameter $foo, so you get a fatal erro= r. > > > I'm not sure exactly why this behaviour has changed, and can't see any > mention in the Release or Migration pages in the manual. It's not a > *huge* break, because named params have only existed since 8.0, but it > is technically a breaking change in a minor version. > > The only relevant discussion I've found is this, where Nikita is I think > hinting at the new behaviour: https://externals.io/message/114007#114026 The new behavior has been introduced[1] quite a while after this mail had been sent. I agree with the idea outlined in the commit message. I suggest to document that in the migration guide, and in the manual prope= r. [1] =2D- Christoph M. Becker