Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:126058 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 AC21E1A00BD for ; Tue, 26 Nov 2024 11:59:32 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=php.net; s=mail; t=1732622181; bh=q1IBwP7tTYFr/jeG3nX2pacSjTMKYlCyY0DTELabsA8=; h=Date:Subject:To:Cc:References:From:In-Reply-To:From; b=gVisj+I0CtMyqD61OILthPZTwDfRc7tBKR4MOcOGh11M8+4Lakzdpqt0Tuui4VNgH 8SdRyWURqMb3LQ1vJkVQtug4Bvt2KAthBYk0NT/244iBe4nwyCqPn7hAY94IqybcBj rUZM94im2bbKEgJKmXAsn5eEZvTHSYzSKmM82zZLXU//peSzoAf25PdJPtKVHBwTV5 C4j96tjsbegnj2ICDJGd5ajRFwWLNrkGqsjMRfFRUmVhdl9uwBIqt4MmxzSiXpxHWR uwG5BbKpOOiLXfk1hK6l+Ae2JY4pdaBIV75YCrKkPEyfhPObfgqdTwPLj2d+BdTNST K/AmJNN04otAA== Received: from php-smtp4.php.net (localhost [127.0.0.1]) by php-smtp4.php.net (Postfix) with ESMTP id DA4C7180078 for ; Tue, 26 Nov 2024 11:56:20 +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=0.1 required=5.0 tests=BAYES_50,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,DMARC_PASS, FREEMAIL_ENVFROM_END_DIGIT,FREEMAIL_FROM,RCVD_IN_DNSWL_LOW, RCVD_IN_MSPIKE_H2,SPF_HELO_NONE,SPF_PASS autolearn=no autolearn_force=no version=4.0.0 X-Spam-Virus: No X-Envelope-From: Received: from mout.gmx.net (mout.gmx.net [212.227.15.19]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange ECDHE (prime256v1) server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by php-smtp4.php.net (Postfix) with ESMTPS for ; Tue, 26 Nov 2024 11:56:19 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmx.de; s=s31663417; t=1732622368; x=1733227168; i=cmbecker69@gmx.de; bh=zlQAp96UcpCWf0eL5jBC8L9mfBCy8SSiML/LHXMqvfc=; h=X-UI-Sender-Class:Message-ID:Date:MIME-Version:Subject:To:Cc: References:From:In-Reply-To:Content-Type: Content-Transfer-Encoding:cc:content-transfer-encoding: content-type:date:from:message-id:mime-version:reply-to:subject: to; b=SmA4MRAsHelpp73LJKG7vYWPm/n1Mt6qPXUiJ7IDUOE7jeEDqc/q4PbjhGth6RLl rjzBs5Up4c3t+RSRTKquU7aqlD/Q0DCwO3/UdlVG+BpG+xvDLqe4zQpQbxZ57ZA6G 5FgwGk6c2h/dZLKAnWFRLNifyyPDKnJPmuVdMAxxsRUCtE/LzSOND9Yd+834b2+jh rbQqqyTjaAdRKQys07gCtoicqd/4AQuJh8zHgdLwXGakqGyrHWxwAtencqlAflgya DoTwvU13aKbU7CxcyHXEOlM7ZMZDqlymUhnPTZ3jZ6gPfDiYN5nM/o6cvckWb72Kk 6VjWUyBd+kH/EUu4uQ== X-UI-Sender-Class: 724b4f7f-cbec-4199-ad4e-598c01a50d3a Received: from [192.168.2.130] ([79.251.205.37]) by mail.gmx.net (mrgmx005 [212.227.17.190]) with ESMTPSA (Nemesis) id 1N0XCw-1taiw816uq-011Ktx; Tue, 26 Nov 2024 12:59:28 +0100 Message-ID: <06e23630-16d0-4bbf-b49e-a04b43ff1f7b@gmx.de> Date: Tue, 26 Nov 2024 12:59:27 +0100 Precedence: bulk list-help: list-post: List-Id: internals.lists.php.net x-ms-reactions: disallow MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [PHP-DEV] Needs Feedback - Yield without value in reference generator function does not create notice To: Claude Pache , aggelos bellos Cc: internals References: <172D8C55-DCB2-4C5A-A224-C8B29B503DDF@gmail.com> Content-Language: de-DE In-Reply-To: <172D8C55-DCB2-4C5A-A224-C8B29B503DDF@gmail.com> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable X-Provags-ID: V03:K1:xV1pn/ISxRqxWp4JNzfB2NQ4XXa+Nx2I9LHlgt3X5/MNEYyEQLw o8Hr3NjBkSc+dM4MjXtjkVHFyTPy2IHHvmGZj9VUxDnLPO2HFoCyJRI7rLsasTE2iA990Wu Y3TLWP416Sv4UPjoqyRGCY7XIAiK7zsMyLfCZS0RRR/ams8JQ6YwxKfGphdU6nSa6LE148A FQxn/S3uhpA4c/Mb3H5HA== UI-OutboundReport: notjunk:1;M01:P0:TQNmoEvbR9g=;tTwNAbqKOHkDhmN//YnpOsQ6Tyh qJ9N7GDvaiyuyW8wLOe+IvPqRf83Vlh94SqSLAoLd74iJJ7oNYmEP7AF+OcnFJKvQSQw8uyms sof11DVX4TV4sIAInHiz/BUvFbVlr3wGu8kWQfLa9d4TQMz2R5tEbavdkicIBizDwl9pyB0S/ CkIS1i4/B1DIhUd7k6RY6nMrNOlI6Q4K0bcrI+dH5xbDIQpTQpWuzR+3H95mNy8ZhXuj2RYNM AR+dXp6lbiohcg4Y55X9WVfKQ6zPhTwjLyClC6YVim+h2Y+HSf3Y3zvIWkxSAAXdmGo4kbBZC dlArxce96qN4J+igpREEolATT81C0U7hjXy0iS/Fz6b0PqzuAb+KOlYXPeazB2zrLCGYrl7MX oAoqZVmRJbuwh3GZeQvk9UI4s8NjOb5PLlW4xNPb4UjguYYhtFuh7ew6jIqs9wUiTcMIjB5/Z 5Wo2ibT5jDiYzZy1Nnl7eLuax5O+kmaXIp5sN9YDCG4l3wcbV/AdqywQfiY0Sy3Lk71KkbX17 kGvF9/zVdZs5kfGfHgN5NFO8uGDEJHiE1db1C+c7cA2sDraJhjMWdDXHqnx+m3c1IyYfcqfYO NdxKIpWz9fGyqkx2VgPm7uvn8Rsc32pxCObbhUjKA4WqyCcFNMGCV9Ro/VQSmQBe2p+Isjs5t +p3tttlzH+Nt+xyn6PpYiZ0xoNd50dH8DA5YAH8HnMJW6lZUewrp+Rn5j52Rt96eiWc0Emb6T muUF/jsOf0QwqEK8WDFcjm6Blb9uoNV21lkSBmoSsVqmo+Q3LM3KS7QbwQvn2Q2Y+tdLlM/hf WGh1oJjjKQHBMA5dXJY11paJUoCh3h9BkfE85UYsQu/qGdNBU0YpMpbOrKkEqOlsjFQUfezpP cUutrdUyCweydw25YGxZwFUvzWF36Lfds0VUEBm0wz/3Xf6DJ4/zYuSiT From: cmbecker69@gmx.de ("Christoph M. Becker") On 26.11.2024 at 12:31, Claude Pache wrote: >> Le 26 nov. 2024 =C3=A0 01:49, aggelos bellos = a =C3=A9crit : >> >> In this issue #16761 it w= as verified that in the above code it should throw a notice for both yield= s: >> ``` >> > error_reporting(E_ALL); >> function &y() >> { >> yield null; // warning >> yield; // no warning, agreed to be a bug >> } >> foreach (y() as &$y); >> ``` >> I have created this PR whic= h adds the "missing" notice but we aren't sure on >> how to continue on this. >> There are 2 main questions: >> Should we continue with adding the missing notice and merge it also in = master? >> Should we deprecate / remove the usage of yield without value in refere= nce generator functions? > > A notice would be consistent with what happens with: `function &f() { re= turn; }; f();`. But don=E2=80=99t add new notices in patch releases, other= wise you may break without warning a non-trivial amount of code that confl= ates notices with fatal errors. The bug is not serious enough to warrant s= uch a risk. > > Whether it should be deprecated, is a separate question. You should also= consider what to do with: `function &g() { yield null; }`, `function &g(= ) { if (false) yield; }`, `function &f() { return; }`, etc. In my opinion, whether it should be deprecated is not a separate question, but the one we should answer first. If we're not going to deprecate/remove the auto-conversion to a reference, we may as well drop the notice altogether, instead of adding a further notice. Christoph