Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:128840 X-Original-To: internals@lists.php.net Delivered-To: internals@lists.php.net Received: from php-smtp4.php.net (php-smtp4.php.net [45.112.84.5]) by lists.php.net (Postfix) with ESMTPS id 788771A00BC for ; Wed, 15 Oct 2025 04:22:00 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=php.net; s=mail; t=1760502125; bh=w/RikqFWHRrREhIMQ0kCjJO5Fie8XUUh58O61xWzkJE=; h=From:To:Subject:Date:References:In-Reply-To:From; b=XZW9ssDscgpH9lJUb+w29s+Q3KWNqw2GHbNDRJAT1aEc/YFeOxYgXHQs98zmMGnd0 ogiZWb/Bpx//gS5V5kAIMn+aAf9z16kr9SPE7/IEVwovfHDjTqtOMN/6aayNPZLi1e srBaC0JJxCIbznfSILjClDcgEXQR6nnLkkQ233hVzKWY6wJJ+eX+LPY0H2A2iyJIyS pLtHeqiqoqgpJRv7iCYfJdEO8Cq0pLgBQyct7Te3J6he6uQYTF/uUmh63wHOJ6TfOC 7UaQTtnQRNS3/6HBVNCXIIOuLqIful0dGdkDSIj1pu9nsTPoSvZKz3TMvavLox9/gL 03Oge5ypIPruw== Received: from php-smtp4.php.net (localhost [127.0.0.1]) by php-smtp4.php.net (Postfix) with ESMTP id 4C24C18002E for ; Wed, 15 Oct 2025 04:22:04 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 4.0.1 (2024-03-25) on php-smtp4.php.net X-Spam-Level: X-Spam-Status: No, score=-2.1 required=5.0 tests=ARC_SIGNED,ARC_VALID,BAYES_00, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,DMARC_PASS, FREEMAIL_FROM,RCVD_IN_DNSWL_NONE,RCVD_IN_MSPIKE_H2,SPF_HELO_PASS, SPF_PASS autolearn=no autolearn_force=no version=4.0.1 X-Spam-Virus: No X-Envelope-From: Received: from SJ2PR03CU001.outbound.protection.outlook.com (mail-westusazolkn19012063.outbound.protection.outlook.com [52.103.2.63]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange ECDHE (secp384r1) server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by php-smtp4.php.net (Postfix) with ESMTPS for ; Wed, 15 Oct 2025 04:22:00 +0000 (UTC) ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=SlExBClBiBzsHU3U4lkA7bloPdJ+ZUi5QOVFZWdWNyGZfrBGPaNX+MKq1BYqyWuEBgIWo1JNe+EOk5vcnpLm+85ANGw6wzN8FfivAaUEW90UFfdcO/GzYkLNC48Vy/qpYg/lOt9j2YHhSsJLcOlMch7eJJGJ1faj3eF/bGRa0ppd/A6m3mJnBScPi9psNVUq9JXdVfkM5GDt8R5Nos1Pj3Zk0uRic+50MpKrfeHhUz9XmP30ZzYBxudxGOJMIaV1fCYDvT8Jt2+Knm9RpsU8yBSOdI57vUfYG+DRv2p4hdGYcaQet3VXm9aM0oW+tekqkirATzdveJmULr5IEgRD7w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector10001; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=KcCFsYYbHsvuTDnCE7lUWQ2mNFPzcznJHw9b6oP/4a8=; b=rEJ19ZC+MnFTv6wCxOABfKgSQ33dr0PKTOV4EIeL3a3sCtlSNiaCPg6/WgB9FlFkiptKPJ35J3oz9TJ093zSMuJiVwJsLzBT+pTt9AQAn4rTfy/DPiXRjsYFqmPpVQtibqZOYWCpv7kyeSkI6qNZMBFhEOuNRwh1y7f9gMqQhwy0HKP4MCiKA4hJ9m9JlqTtrjT7dNJNw76ow70GAQGNpEd6tspAslUni49p+JJtrlaPQddzvQ3ZEmD6kxrf/G9+6OuxnLVl2DtVVnVjJg24q8QvhvHHjpClYma0IkB6ggPsAwQ4V9+XsaUjvPFa0Xj47OwA92b0zIF6LaeV+FIirw== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=none; dmarc=none; dkim=none; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=outlook.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=KcCFsYYbHsvuTDnCE7lUWQ2mNFPzcznJHw9b6oP/4a8=; b=tbFyrztd+66OkigTrnJB00wwX8CLS7/RbZybkXPJ8nR1lVfulp13KGLX5rLD3w9pxKfWuEm5xYJJPInxX4CkyiyjcIoNOZe9/f+fQNYQUJUt/2/Xmy8soEX3uQMntdZahZk79r1mkbADZPHtgYl7DFarD3NXhujsciawwmCJcUIOS/EYf9OD2Kutm+pfZFXuISCM3k/Lsrn4VjPesa5Q8wyY14whXLybBQivBluricoEmgBBb89DuJVYqOljs/cSva9Dd+OP+ouBCKZswMhU9tTCF0PJgXitYpZSZIQya5V9wKkgZkfSLaX6nZUT+hoD6SmhB7xOfPobp4obgG48/w== Received: from BL4P223MB1364.NAMP223.PROD.OUTLOOK.COM (2603:10b6:208:5a9::14) by MN0P223MB1256.NAMP223.PROD.OUTLOOK.COM (2603:10b6:208:4bc::22) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.9228.10; Wed, 15 Oct 2025 04:21:53 +0000 Received: from BL4P223MB1364.NAMP223.PROD.OUTLOOK.COM ([fe80::f02a:f79:cb00:d998]) by BL4P223MB1364.NAMP223.PROD.OUTLOOK.COM ([fe80::f02a:f79:cb00:d998%4]) with mapi id 15.20.9228.009; Wed, 15 Oct 2025 04:21:52 +0000 To: Juliette Reinders Folmer , PHP internals Subject: [PHP-DEV] Re: Inconsistency in PHP 8.5 deprecation of terminating case with semicolon Thread-Topic: Inconsistency in PHP 8.5 deprecation of terminating case with semicolon Thread-Index: AQHcPWfWLSBHm0Rd+0m8YWyzCF9iN7TClTMu Date: Wed, 15 Oct 2025 04:21:52 +0000 Message-ID: References: <68EEE5F4.5070105@adviesenzo.nl> In-Reply-To: <68EEE5F4.5070105@adviesenzo.nl> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: msip_labels: x-ms-exchange-messagesentrepresentingtype: 1 x-ms-publictraffictype: Email x-ms-traffictypediagnostic: BL4P223MB1364:EE_|MN0P223MB1256:EE_ x-ms-office365-filtering-correlation-id: 6c71056b-6702-461d-a607-08de0ba25e4e x-microsoft-antispam: BCL:0;ARA:14566002|12121999013|15030799006|8060799015|8062599012|461199028|31061999003|19110799012|15080799012|3412199025|440099028|4302099013|52005399003|40105399003|10035399007|102099032|1602099012; x-microsoft-antispam-message-info: =?iso-8859-1?Q?d6WZSVRrxRIAS74Jj8zDHaVspXAUq7uMTYz3FTgKbdxRukihP9lP7edMiI?= =?iso-8859-1?Q?jDEfuZb0+IP6YDL6KTbJzoA7tx3dw4S2VJ/wqJ2EGNtB+GVy0uMPX4VTJy?= =?iso-8859-1?Q?b8A3Zg+Gyc7+CRPH6wOurMTlv4ie8cRvUm9xEkZP8tx82wwAtc04siA21n?= =?iso-8859-1?Q?olVzX8nIAM7gpFMNJ9OFaxI3MAkPwefujmKseoMjDvF9GRVHwZ0zvvMuI1?= =?iso-8859-1?Q?AEDERArRNhvrtmgAg6SxqwytaE9gnAgoD1Qszgh0SrM35UvsFFRlHX0/+z?= =?iso-8859-1?Q?l6vTGoda5QO0VQ6PFKiXI/Yr/NGA7O2lU9Mx4lFSCzEgv0yydZ1rUElz6X?= =?iso-8859-1?Q?JSuVfosTjbBF2zSbLJH9oGqAQEan5lg14E5vvwVeeLQP7MliTzXYzokSrE?= =?iso-8859-1?Q?nlUb1GlCyKgLd1p1geBVc9l1DzNJ7iTbI1yC1AmRgOBtl2sOmbJ4pmLtdg?= =?iso-8859-1?Q?cEkihfnxpzxqkGTobSW3G2ROfK150G8hA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x-ms-exchange-antispam-messagedata-chunkcount: 1 x-ms-exchange-antispam-messagedata-0: =?iso-8859-1?Q?x7Md8/htqLqC8emBLSPIvmNseKlyDc96Imr/sa81uQ8SaupfPKzWntiH9i?= =?iso-8859-1?Q?vnQAe1zrtHVxxRPNGzYZ6J1ahFAqRRaSEjZSNhCLZnDDSVx7zE3JriEJ67?= =?iso-8859-1?Q?fYK9yM9lth3U4qdJ8hBWVr07HdFAnU13K5g7F8HhRnpkvVX9nb1h2zsFSh?= =?iso-8859-1?Q?Vlwoa0Uh2gDHBpKMvsXWEg6aMzQugRqQjAKxTyIeuZcKNkM/V6TJhYBOxs?= =?iso-8859-1?Q?QQvnG0W3lJhleYGhPTL3nObPZL4aQsV7T6XCM7QraV9nNs1w9xkwKPFEU7?= =?iso-8859-1?Q?hL7SFK25j0RyGkcAM+7OHsN2H6XZz4CRwVCErH2VTBtMbEdznzOnrJg3ip?= =?iso-8859-1?Q?JEvAUg5dXItlWoRhzMl/OCqcrVtROnX3R9M2wogIQpelM7CsWKxjaxU/LE?= =?iso-8859-1?Q?72Gwu/nOcdJ4KC205/kU8GTTv/mcAigLHV8t18dT9rW+ucavnKwtZB8aVf?= =?iso-8859-1?Q?jldgzcK0N96Z3f0G29FCvLsni5E1emdxlI6j8UMnC41kES40761iD56FA/?= =?iso-8859-1?Q?vkENcbSFmYk/2RY3uiWWLFxhd1V8PPjj85Rts7y/XHPdHTsqB9aIj7cpG1?= =?iso-8859-1?Q?jHr7g0pI7qrFgT8ihXD8bXKHH91I0I42tQB7kX6HHO9VCwBPIGiEU1EfFO?= =?iso-8859-1?Q?GL5mD5tV9z4zfEv1lefgIGUM9PFhVj6a4Ks9a6TlnRDzgdaXEEu/txIkLG?= =?iso-8859-1?Q?gBcbxNMmP7opv8MfDUpOu5gpptIVmQHAtXjL2PA+rH6kSsb4k2+ccrrZaC?= =?iso-8859-1?Q?Qvvavkij1MuLdHMgVtdlxVRpd/nmY7RdJiz8O7QUurBl4atUj/RjOGk8rF?= =?iso-8859-1?Q?3qrNuGHRS6E+VziqI36Um9bd/FbGhaf5BBOA/PNCIkG6dyee/+0G/E8Gde?= =?iso-8859-1?Q?H3k7AEKo5+G38UGRds6WtdkdivKBEU6CxTZFo+XzG3QvVAQ35p1AhmP2PL?= =?iso-8859-1?Q?1AdqnAyD7FfcDfCjwUoVS4uYY8vXDbOG3AO8FtvU0OyrmDzJgtOdl5sgMt?= =?iso-8859-1?Q?c7geJHmUb4JFRhNzOBBqmFllb/02rIyecSYRD7dfkKRfn9ShP1E2tsTY6I?= =?iso-8859-1?Q?/5yLGK3I0oZuv5r/qfjZefwOS35qqJtT85cvcq6g1dXG1HJ4VAOLYKNof0?= =?iso-8859-1?Q?cnxdIs93M3dHsdt41fxwMn3i+Jwh0Kecfwj1j1Mhmouv0GkvnwAc2+Lpl8?= =?iso-8859-1?Q?zHrqZq7Swl/cS66ttTaJSlEHIMpiDqSCdL49KAJvxcbxvREv5Xiwo3Z+K6?= =?iso-8859-1?Q?hgccAK1cMeKlV7L0HoPghrYvXc81HfzqIbj7VdsyA=3D?= Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable Precedence: list list-help: list-unsubscribe: list-post: List-Id: x-ms-reactions: disallow MIME-Version: 1.0 X-OriginatorOrg: outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-AuthSource: BL4P223MB1364.NAMP223.PROD.OUTLOOK.COM X-MS-Exchange-CrossTenant-RMS-PersistedConsumerOrg: 00000000-0000-0000-0000-000000000000 X-MS-Exchange-CrossTenant-Network-Message-Id: 6c71056b-6702-461d-a607-08de0ba25e4e X-MS-Exchange-CrossTenant-originalarrivaltime: 15 Oct 2025 04:21:52.7736 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: 84df9e7f-e9f6-40af-b435-aaaaaaaaaaaa X-MS-Exchange-CrossTenant-rms-persistedconsumerorg: 00000000-0000-0000-0000-000000000000 X-MS-Exchange-Transport-CrossTenantHeadersStamped: MN0P223MB1256 From: theodorejb@outlook.com (Theodore Brown) On Tue, October 14 2025 at 18:08 Juliette Reinders Folmer wrote:=0A= =0A= > Dear Theodore and list,=0A= >=0A= > I've been looking into the "Deprecate semicolon after case in switch stat= ement" PHP 8.5 deprecation [1]=0A= > with the aim of adding a sniff for this to the PHPCompatibility standard = and I'm noticing an oddity for=0A= > which I would like to clarify whether this is intentional or an oversight= .=0A= >=0A= > As demonstrated in the example code provided in the deprecation RFC, both= switch `case` condition=0A= > statements, as well as `default` statements, can be ended with a semicolo= n.=0A= >=0A= > So when I first read the RFC, I interpreted the proposal to include both = `case` as well as `default`,=0A= > as, in my mind, `default` is just a special `case` in a switch.=0A= >=0A= > However, the RFC explicitly only talked about deprecating the use of a se= micolon after a=0A= > `case` statement and the implementation has followed this to the letter. = [2]=0A= >=0A= > The net result of this, is that you can now have a `switch` statement wit= h semicolons=0A= > terminating `case` statements and `default` statements, where the former = (`case`) will=0A= > result in a deprecation notice, while the latter (`default`) will not. Fo= r an example, see [3]=0A= >=0A= > This feels inconsistent to me and counter to the intention of the RFC, wh= ich is stated to be:=0A= >=0A= >> Case statements followed by a semicolon can cause confusion, as a develo= per may think they=0A= >> behave differently in some way from regular case statements (e.g. preven= ting fallthrough),=0A= >> when they do not.=0A= >=0A= > Which leaves me wondering what the reason was not to _also_ deprecate the= use of a semicolon=0A= > to terminate a `default` statement in a switch ? I can't find any discuss= ion about this in the=0A= > original mailing list thread [4].=0A= >=0A= > Anyone would care to clarify ?=0A= =0A= Hi Juliette,=0A= =0A= Thank you for pointing out the discrepancy. You are correct that `default` = is just a special=0A= case statement, and the intention in the RFC was to output the deprecation = message for default cases=0A= as well (the example in the RFC included a default case followed by a semic= olon to highlight this).=0A= =0A= The fact that a deprecation message isn't shown for default cases is an ove= rsight on my part=0A= when I implemented the RFC. The merged implementation correctly updated the= AST for default=0A= case statements followed by a semicolon to support the deprecation message,= but I failed to=0A= notice that when the compiler code loops over switch cases, there is a `con= tinue` statement=0A= when handling the default case which prevents reaching the code for the dep= recation.=0A= =0A= I opened a follow-up pull request to fix this, which can hopefully be merge= d before=0A= PHP 8.5 is released: https://github.com/php/php-src/pull/20172=0A= =0A= Kind regards, =0A= Theodore=0A= =0A= >=0A= > Smile, =0A= > Juliette=0A= > =0A= > [1]: https://wiki.php.net/rfc/deprecations_php_8_5#deprecate_semicolon_af= ter_case_in_switch_statement=0A= > [2]: https://github.com/php/php-src/commit/5f8d648af6ef4e29a3c7f2b2029d08= 466c12bc6f=0A= > [3]: https://3v4l.org/liFIK/rfc#vgit.master=0A= > [4]: https://externals.io/message/126000=