Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:126057 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 8ED731A00BD for ; Tue, 26 Nov 2024 11:32:06 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=php.net; s=mail; t=1732620535; bh=5WPDuITL9FF0oDLA4HZJvUrgccQgmzoigPMR8LDad2A=; h=From:Subject:Date:In-Reply-To:Cc:To:References:From; b=YHcxRkAuJ7B2My4r9fp4PU/yBkJP6A0HTauC6O+MCIoS9E/BxCAbN23R64Y9U7OGC xCkjrggNfPjOZKP6qoxyY/cNeIoEePOz49PqnZlOMyWr7pT+QKjrpdGYnaYBUYwHBp ATeHiDh72bvVH7z1X+opUICZ4FDiEnpq5pEiJM1/wQJWPEjNMUZfN0AYR5z4A4lT1T jLMKm6BUFO1AO0dLVcTT247otJR3LpztQewJSs+FpEPeylLbOdlxybwnmkE6Zsy9UJ uyiZ2tNFq7jb/Ozy4CBIukvSHArsvcP6sFu69IkZYt3yGWvjCydxMWeOJ1rPDIQ07J 4yFKHnsPg84Dw== Received: from php-smtp4.php.net (localhost [127.0.0.1]) by php-smtp4.php.net (Postfix) with ESMTP id AB9C418002F for ; Tue, 26 Nov 2024 11:28:53 +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.6 required=5.0 tests=BAYES_50,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,DMARC_PASS,FREEMAIL_FROM, HTML_MESSAGE,RCVD_IN_DNSWL_NONE,RCVD_IN_MSPIKE_H3,RCVD_IN_MSPIKE_WL, SPF_HELO_NONE,SPF_PASS autolearn=no autolearn_force=no version=4.0.0 X-Spam-Virus: No X-Envelope-From: Received: from mail-ej1-f50.google.com (mail-ej1-f50.google.com [209.85.218.50]) (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 ; Tue, 26 Nov 2024 11:28:50 +0000 (UTC) Received: by mail-ej1-f50.google.com with SMTP id a640c23a62f3a-a9a0ec0a94fso786148966b.1 for ; Tue, 26 Nov 2024 03:32:01 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1732620719; x=1733225519; darn=lists.php.net; h=references:to:cc:in-reply-to:date:subject:mime-version:message-id :from:from:to:cc:subject:date:message-id:reply-to; bh=uYlad08KPccL3a4GSPcTxUUlrZZl9SW75g1fS5VXFVc=; b=imdDMgqP07AaHRR1CyJUqp1iC0wyTFebvw7q2Wr9tKYGdJ9ZXpIVwYs/YjRd6v/DF3 ixQKkiIt220f5rdtMWXHk/2HeLTHc/ye4r8FxC9doY5HqLFsyLB6gQmoUmgBMD33593r VFs2GDzyzQYswBKaJCjD0Lwr0RtDUWuBrg+4cPAUftW2ccdNZdFqOzhq+fnJIMFLWob1 CbdHH2/ESmO4NHBBsxwbj93wfTPqYZ3F0jhPdQA2rrJQE73nX52FG/tls0w6AWYCh3yn daz/9hKL0atg8xvXppw63GRFxYd6oPPZ6yGQiSKefTY/fvzy4bvmkSe9SSGrrhF8Uk8V VUQQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1732620719; x=1733225519; h=references:to:cc:in-reply-to:date:subject:mime-version:message-id :from:x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=uYlad08KPccL3a4GSPcTxUUlrZZl9SW75g1fS5VXFVc=; b=lHuas7tlI5uJIGQJGrncLhYF5pwnrJjq1OAiQqVOxNn/0gJq1npbwvHscDsacRs4Xr 3NMpAxqOlPNeA0P4FeYFdmulJn2ZR5uSkQDMsJYSUDaE0vzQ3+kqoRaOH17gmES443ui hiXLp+6hI6gjBjILuXMijUFmSeL/TnNRSnsu7EUaf113x2NLzmBHVqbuWUp4nEjE1qFD lVWliJm4f7oUMNa5suZMkYnP9US+T6baP1sA9PwdzcLQBLTimPZylPH1dk1bw1KIBXWD ICxq/nZvpZCp3MeEAZ3OUnsmkmAn/+Fhia193qKuctD8b6OyInRfQqPUgl51ONWRZg0C 5vMw== X-Gm-Message-State: AOJu0YykkVgMdqggBADDv//wLayPweRO6a4VciNpeIyT2aulWMxAFAM1 ohEwSmX0HVX1tXhYbufORA0W6Zg4nE1VXvnP1YJS71V5bEfwaNLe X-Gm-Gg: ASbGncsFeH68zuJsJ6taqWoDqdc8DS3KxyG7qYvOkPw7am3JLHJQLdT6Wln3UeobaxE CenHy6ViPUi97rDHfR/2DnespWHlq9Ni8yl10dGvsMTzFJGZ1L4Odaw3mwqp75FI7orULMRZgFD saL/TE9arCUXSgj8wK/M9RQLrfHrP33Ys5nxQHjUU/uzl2k59JxfXTkj1ZXntVFSq6bfxfqo+/Z lTjt+5yK7KyjOb6fzthsMFwkmszRkrHdRbe0a9cMUYEwRuucHrnIoW6mTBov+45/vS+ X-Google-Smtp-Source: AGHT+IHL1t5mAZXTqbx1CKWBFYM/3ra/CYFmgtDuUt3vOJmR4fXmOvz3kJ1/QWvf8GYmFPCyJC3pjw== X-Received: by 2002:a17:906:23ea:b0:aa5:4672:663d with SMTP id a640c23a62f3a-aa546726779mr763193266b.57.1732620719200; Tue, 26 Nov 2024 03:31:59 -0800 (PST) Received: from smtpclient.apple ([89.249.45.14]) by smtp.gmail.com with ESMTPSA id a640c23a62f3a-aa50b28dd59sm583265366b.7.2024.11.26.03.31.58 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Tue, 26 Nov 2024 03:31:58 -0800 (PST) Message-ID: <172D8C55-DCB2-4C5A-A224-C8B29B503DDF@gmail.com> Content-Type: multipart/alternative; boundary="Apple-Mail=_3BB53444-5CE3-42F5-AEA6-069B38285504" Precedence: bulk list-help: list-post: List-Id: internals.lists.php.net x-ms-reactions: disallow Mime-Version: 1.0 (Mac OS X Mail 16.0 \(3776.700.51.11.1\)) Subject: Re: [PHP-DEV] Needs Feedback - Yield without value in reference generator function does not create notice Date: Tue, 26 Nov 2024 12:31:47 +0100 In-Reply-To: Cc: internals To: aggelos bellos References: X-Mailer: Apple Mail (2.3776.700.51.11.1) From: claude.pache@gmail.com (Claude Pache) --Apple-Mail=_3BB53444-5CE3-42F5-AEA6-069B38285504 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset=utf-8 > Le 26 nov. 2024 =C3=A0 01:49, aggelos bellos = a =C3=A9crit : >=20 > Hello everyone, >=20 > In this issue #16761 it = was verified that in the above code it should throw a notice for both = yields: > ``` > 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 = which 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 = reference generator functions? >=20 > - Aggelos Bellos Hi, A notice would be consistent with what happens with: `function &f() { = return; }; f();`. But don=E2=80=99t add new notices in patch releases, = otherwise you may break without warning a non-trivial amount of code = that conflates notices with fatal errors. The bug is not serious enough = to warrant such 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. =E2=80=94Claude --Apple-Mail=_3BB53444-5CE3-42F5-AEA6-069B38285504 Content-Transfer-Encoding: quoted-printable Content-Type: text/html; charset=utf-8

Le 26 nov. 2024 =C3=A0 01:49, aggelos bellos = <aggelosbellos7@gmail.com> a =C3=A9crit :

Hello = everyone,

In this issue #16761 it = was verified that in the above code it should throw a notice for both = yields:
```
<?php
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 which adds the "missing" notice but we aren't =
sure on
how to continue on this.
=
There are 2 main questions:
  1. Should we continue with adding = the missing notice and merge it also in master?
  2. Should we deprecate / remove the usage of = yield without value in reference generator = functions?

- = Aggelos Bellos
=


Hi,

<= div>A notice would be consistent with what happens with: `function = &f() { return; }; f();`. But don=E2=80=99t add new notices in patch = releases, otherwise you may break without warning a non-trivial amount = of code that conflates notices with fatal errors. The bug is not serious = enough to warrant such 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.

=E2=80=94Claude

= --Apple-Mail=_3BB53444-5CE3-42F5-AEA6-069B38285504--