Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:124462 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 qa.php.net (Postfix) with ESMTPS id A81BB1A00BD for ; Wed, 17 Jul 2024 23:12:40 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=php.net; s=mail; t=1721258050; bh=WLBfxj5PrSgUxwAwBj8IAwwHuRYgOVTgQFAVdePKW4s=; h=To:From:Subject:Date:From; b=eAmqnYWcqRnYo22B0+9hKdeaehUM9jrCvNsc3HW27B+a2aoKTyWDN0fbxh6TBC9Tg +wr+BTylf8vfBDNNVZ41tUOlFuIkYGkfvP4zFZyKg4HfVI4Eec81V4QtHC0ke6R8Af jaCAoytMY6h2epnB4rulemuRarsxQbWv4acwBt2uJ+/TkeGNdPpubgoLfkoesHaqNi 3+/DghdgriywkVVxaDTTyk44i4xcDP8C/LlRu/whJbvAztr01Ek7sf41TfI0iWAtxR sQ5xidmb6TvSHH4DkaXOm9Ox+wqsV8RH58Q6+uVjpjdf2kg/LsVQNP4BJCTnhyGnQL UXPFCeCwFUhLA== Received: from php-smtp4.php.net (localhost [127.0.0.1]) by php-smtp4.php.net (Postfix) with ESMTP id B03361804D2 for ; Wed, 17 Jul 2024 23:14:06 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 4.0.0 (2022-12-13) on php-smtp4.php.net X-Spam-Level: *** X-Spam-Status: No, score=3.6 required=5.0 tests=ARC_SIGNED,ARC_VALID,BAYES_50, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,DMARC_MISSING, HTML_MESSAGE,RCVD_IN_DNSWL_NONE,RCVD_IN_MSPIKE_H3,RCVD_IN_MSPIKE_WL, SPF_HELO_NONE,SPF_SOFTFAIL autolearn=no autolearn_force=no version=4.0.0 X-Spam-Virus: No X-Envelope-From: Received: from weasel.tulip.relay.mailchannels.net (weasel.tulip.relay.mailchannels.net [23.83.218.247]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by php-smtp4.php.net (Postfix) with ESMTPS for ; Wed, 17 Jul 2024 23:14:02 +0000 (UTC) X-Sender-Id: a2hosting|x-authuser|juliette@adviesenzo.nl Received: from relay.mailchannels.net (localhost [127.0.0.1]) by relay.mailchannels.net (Postfix) with ESMTP id 2E31A844A10 for ; Wed, 17 Jul 2024 23:12:31 +0000 (UTC) Received: from nl1-ss105.a2hosting.com (unknown [127.0.0.6]) (Authenticated sender: a2hosting) by relay.mailchannels.net (Postfix) with ESMTPA id 2DF78844851 for ; Wed, 17 Jul 2024 23:12:30 +0000 (UTC) ARC-Seal: i=1; s=arc-2022; d=mailchannels.net; t=1721257950; a=rsa-sha256; cv=none; b=OhF9EGNDdbC/ed6n68TQo3wE0mNDF+ed0jbs98hrDE6TcTC7EzLdF7hnIKpz3BUqviCgaL wfofy0DVV3c+Ud4lO5akaUqccDpnCGwdZYXEwE9dVuZ+kkaj5yFLOaWdPk7/6mOL34yF3m Fy3DQ1acYttrszJLiUppR/fbevaaMBooNr0iRl+BqWRj/iilswG9aSiOXgnxeXYQx7VMBS kyZhidBwGPYM2VEbzFu8rSrlpME8SdT5Qr4ahFIp/2P+4z8cGW0+IlnlJ95FE43ezpWMMO tsjIBAt8CaWVNMjd50cLn/s3VtbxvJS7ixHfTkhXBK8dBvvfefUinj71SpodpA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=mailchannels.net; s=arc-2022; t=1721257950; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: dkim-signature; bh=WS4wmtidES+FiJoVHSucBNZ6EoLTx0Eugv4YH1koetc=; b=FfLM/53g70+xLBIDiOBEFMzDuozYvJ/wIl4+OYBH2HKrwxGh8Xu68743YHvx6QCMNw9Rut 4nJuamxOzkR8z6IZfZUqQA2RaJCqa6LhPsaIIrhrSDMnZk3Nx/k6tQowL829rzSDcIvbnm exS2+qNRn/ZS1HdjU91o/t6l3jHWFhWmL8KMW33HvKdktib4yM+H1JZqpZLWuXxFwP3a00 vVG2oI4MSsxkfZc2zk6q/6rxAicXgGbEeBhSxt2vSbNofPRhA3IQlizpi7mDkuSroh9Cqo 3JtHRQxzCUewl3ykv3tH0gNn6JLn04XqJiZO9ongBFVKz9HrunTnE/IoqjwSAg== ARC-Authentication-Results: i=1; rspamd-585d4c99d7-sk2vr; auth=pass smtp.auth=a2hosting smtp.mailfrom=php-internals_nospam@adviesenzo.nl X-Sender-Id: a2hosting|x-authuser|juliette@adviesenzo.nl X-MC-Relay: Neutral X-MailChannels-SenderId: a2hosting|x-authuser|juliette@adviesenzo.nl X-MailChannels-Auth-Id: a2hosting X-Stop-Ruddy: 53711011096d32ca_1721257950725_4181703715 X-MC-Loop-Signature: 1721257950725:3752054060 X-MC-Ingress-Time: 1721257950724 Received: from nl1-ss105.a2hosting.com (nl1-ss105.a2hosting.com [85.187.142.69]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384) by 100.115.121.42 (trex/7.0.2); Wed, 17 Jul 2024 23:12:30 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=adviesenzo.nl; s=default; h=Content-Type:MIME-Version:Date:Message-ID: Subject:From:To:Sender:Reply-To:Cc:Content-Transfer-Encoding:Content-ID: Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc :Resent-Message-ID:In-Reply-To:References:List-Id:List-Help:List-Unsubscribe: List-Subscribe:List-Post:List-Owner:List-Archive; bh=WS4wmtidES+FiJoVHSucBNZ6EoLTx0Eugv4YH1koetc=; b=Pav7TMemGpjClwOECgVNkF9wv2 ODpQxk6xBpyjBdy1Bmim/MbZR0o24WOZMquQWnP2sbjJyu7NFkMoc4/58xV575rIwiPbkeEdlIDDY lVopH9efs+GNK8MpSoHl5ulEdz07ZqL9tHjIa2as0Gb/z1xXXfUCNkIyTZdc1J3SZSVM=; Received: from mailnull by nl1-ss105.a2hosting.com with spam-scanner (Exim 4.97.1) (envelope-from ) id 1sUDoy-00000003iUp-1Vrf for internals@lists.php.net; Thu, 18 Jul 2024 01:12:28 +0200 X-ImunifyEmail-Filter-Info: VE9fRE5fQUxMIFJDVkRfVklBX1NNVFBfQVVUSCBSQ1ZEX1RM U19BTEw gVkVSSUxPQ0tfQ0IgUkNWRF9DT1VOVF9PTkUgQkFZRVNfSEFNIEFSQ1 9OQSBNSU1FX1VOS05PV04gTUlEX1JIU19NQVRDSF9GUk9NIElFX1ZMX 1BCTF9BQ0NPVU5UXzA1IE1JTUVfVFJBQ0UgRlJPTV9IQVNfRE4gRlJP TV9FUV9FTlZGUk9NIFJDUFRfQ09VTlRfT05FIElFX1ZMX1BCTF9BQ0N PVU5UXzAxIFRPX01BVENIX0VOVlJDUFRfQUxMIF9EUlVHU19NTV9ESV NDT1VOVCBBU04= X-ImunifyEmail-Filter-Action: no action X-ImunifyEmail-Filter-Score: -0.39 X-ImunifyEmail-Filter-Version: 3.5.16/202407170031 Received: from [31.201.40.213] (port=56338 helo=[192.168.1.16]) by nl1-ss105.a2hosting.com with esmtpsa (TLS1.2) tls TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 (Exim 4.97.1) (envelope-from ) id 1sUDp0-00000003iUg-2Jqd for internals@lists.php.net; Thu, 18 Jul 2024 01:12:28 +0200 To: PHP internals Subject: [PHP-DEV] Request for opinions: bug vs feature - change in tokenization of yield from Message-ID: <66984FD0.5090805@adviesenzo.nl> Date: Thu, 18 Jul 2024 01:12:16 +0200 User-Agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:38.0) Gecko/20100101 Thunderbird/38.7.0 Precedence: bulk list-help: list-post: List-Id: internals.lists.php.net x-ms-reactions: disallow MIME-Version: 1.0 Content-Type: multipart/alternative; boundary="------------070705070108060206080208" X-AuthUser: juliette@adviesenzo.nl From: php-internals_nospam@adviesenzo.nl (Juliette Reinders Folmer) This is a multi-part message in MIME format. --------------070705070108060206080208 Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 7bit Hi all, I recently discovered a change was made to the Tokenizer in PHP 8.3.0 which now allows for a comment to exist between the `yield` and `from` keyword from the `yield from` keyword. Before PHP 8.3, this was a parse error. This change was not documented (anywhere) nor publicized, which is why I only recently came across it and opened a bug report on GitHub about it [1]. This change is a breaking change for projects consuming the token stream, but more than that, it introduces an inconsistency in the Tokenizer as there is no other single token in PHP which can contain a comment (aside from comments tokens of course). Comments were even explicitly forbidden in the PHP 8.0 RFC which changed the tokenization of namespaced names [2]. Some more detailed explanation and examples can be found in the GH thread [3] and adetailed analysis of the tokenization change can be found in a ticket in the PHP_CodeSniffer repo [4] (details in a fold out in the comment). In my opinion the change is a bug and should be reverted, but opinions on this are divided. After a discussion in the ticket on GitHub, it was suggested to ask for a third/fourth/fifth opinion here on the list. Pros for reverting it: - Consistency with other tokens in the token stream, none of which allow comments within the token. - Consistency with the 7 years before in which this was a parse error. - The change was never documented, not in the changelog, news, nor in the upgrading guide. Cons against reverting it: - The change has been in PHP 8.3 releases for a little over seven months. - The odd few people may have accidentally discovered the bug and taken advantage by introducing code containing `yield /*comment*/ from` into their project, which with a revert would become a parse error again. Opinions ? Of course, the ticket yielded discussion on whether the tokenization of `yield from` should be changed anyhow, but please consider that discussion out of scope. The current question is only about reverting the bug versus regarding it as a new feature and properly documenting it. Smile, Juliette 1: https://github.com/php/php-src/issues/14926 2: https://wiki.php.net/rfc/namespaced_names_as_token#backward_incompatible_changes 3: https://github.com/PHPCSStandards/PHP_CodeSniffer/issues/529#issuecomment-2209337419 4: https://github.com/php/php-src/issues/14926#issuecomment-2227152061 --------------070705070108060206080208 Content-Type: text/html; charset=utf-8 Content-Transfer-Encoding: 7bit Hi all,

I recently discovered a change was made to the Tokenizer in PHP 8.3.0 which now allows for a comment to exist between the `yield` and `from` keyword from the `yield from` keyword.
Before PHP 8.3, this was a parse error.

This change was not documented (anywhere) nor publicized, which is why I only recently came across it and opened a bug report on GitHub about it [1].

This change is a breaking change for projects consuming the token stream, but more than that, it introduces an inconsistency in the Tokenizer as there is no other single token in PHP which can contain a comment
(aside from comments tokens of course).
Comments were even explicitly forbidden in the PHP 8.0 RFC which changed the tokenization of namespaced names [2].
Some more detailed explanation and examples can be found in the GH thread [3]
and a detailed analysis of the tokenization change can be found in a ticket in the PHP_CodeSniffer repo [4] (details in a fold out in the comment).

In my opinion the change is a bug and should be reverted, but opinions on this are divided.
After a discussion in the ticket on GitHub, it was suggested to ask for a third/fourth/fifth opinion here on the list.

Pros for reverting it:
- Consistency with other tokens in the token stream, none of which allow comments within the token.
- Consistency with the 7 years before in which this was a parse error.
- The change was never documented, not in the changelog, news, nor in the upgrading guide.

Cons against reverting it:
- The change has been in PHP 8.3 releases for a little over seven months.
- The odd few people may have accidentally discovered the bug and taken advantage by introducing code containing `yield /*comment*/ from` into their project, which with a revert would become a parse error again.

Opinions ?

Of course, the ticket yielded discussion on whether the tokenization of `yield from` should be changed anyhow, but please consider that discussion out of scope.
The current question is only about reverting the bug versus regarding it as a new feature and properly documenting it.

Smile,
Juliette



1: https://github.com/php/php-src/issues/14926
2:
https://wiki.php.net/rfc/namespaced_names_as_token#backward_incompatible_changes
3
: https://github.com/PHPCSStandards/PHP_CodeSniffer/issues/529#issuecomment-2209337419
4: https://github.com/php/php-src/issues/14926#issuecomment-2227152061

--------------070705070108060206080208--