Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:126071 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 312151A00BD for ; Wed, 27 Nov 2024 17:41:52 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=php.net; s=mail; t=1732729121; bh=5yGbxRolHNgAHaFoZaY1iaZqGzmb8b0F8LUPx8HaaDM=; h=References:In-Reply-To:From:Date:Subject:To:Cc:From; b=oRy9Fox6yVs8XKdXU4L70TF4l4rsqyEyN3UPovClqnxInsnxXGIIaBy9resiSbxAV PHhvTsPYxQ1rNy7N76s2YZvA7Ryf8QWOlZWJNJeAJ1KuhbS5etfe50h3Gmf1PyXlv/ vNdvSxMFaYDMUTN8yaNxYVJEoJKYCMWOFAryfwObJGmMF7QLknsMtUJC2D1bRlVglg yzBFc78p2c6t/kkELmttE0d0uh71V9/9dfHsF6ay9RNr5OIyXk1xJ8JZPLgVHd0GRa usv5amcdUIoiRHr1e16vBhaZPZ1u161CRQrYpihyEHn5rTcNTK8dBpDsbK917sVIv4 nI9pvHaaRrrMA== Received: from php-smtp4.php.net (localhost [127.0.0.1]) by php-smtp4.php.net (Postfix) with ESMTP id DB3DD18002F for ; Wed, 27 Nov 2024 17:38:40 +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.8 required=5.0 tests=BAYES_50,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,DMARC_PASS, FREEMAIL_ENVFROM_END_DIGIT,FREEMAIL_FROM,HTML_MESSAGE, RCVD_IN_DNSWL_NONE,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 mail-ed1-f43.google.com (mail-ed1-f43.google.com [209.85.208.43]) (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, 27 Nov 2024 17:38:40 +0000 (UTC) Received: by mail-ed1-f43.google.com with SMTP id 4fb4d7f45d1cf-5cefa22e9d5so8285846a12.3 for ; Wed, 27 Nov 2024 09:41:50 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1732729309; x=1733334109; darn=lists.php.net; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:from:to:cc:subject:date:message-id:reply-to; bh=cMGGOzSUtlyomChcYSZqpX1Q6HG4fHZtPabVtisTUSA=; b=QIhAkz6z5wwkrSmRVMKWCrOBlAwKGizAr2iCgItlAjpJJZgAx8WwfFkiACIWhTjXFd xdqVby8pfE2U1LRSPNlCQxPp/4PTN7YmBT/St3hYoGUvSs+Dz/pMdthdrB6/vNh2YSGp /xzuSuJko5OGeJ/q19rJlmqACgG1w/9S9ynpBPdsD0hJfv+1zgqL1tT8BmwpltsbKpsj PJGvDeSXBwS7CBnlCRAI7TniwuO/sJVwm/+hlAf91zIi9qQ0vo+2KtDLJNCJyficK1F7 Xpt+NKiC6FOJNmSlD9f4Ffp58cIyymFjQ+9OsymELJ9MT/6pBLwWPlyvfiWk9Pb0mJGi kSRw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1732729309; x=1733334109; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=cMGGOzSUtlyomChcYSZqpX1Q6HG4fHZtPabVtisTUSA=; b=hgxKhA6BL6xcQH1t/+uvXltbGudOYNJzvVvG2Id6dtWF0cjXjxUM6LuEuL2j6ivp/Z Sg3PQqsYLYe4XpQFqPJdr5XHV1FKs5MkySC+kzGEWe7MB+MOKqVZyLHbJi4QzbD/eNXI xmfgWLTyB/7n2YG/TG5T6802YgvQfgqjws4k3D5uyTQvUhkJc2pGYTIp7ncN0NLcCdnP Fr8jXWSjvsE111R+vrvGvUevwO+VIG+8E4zqk5KrJC1SPfdzJDXForKifVuhQmwhyGgv YD6b/tXZt5cVlmspjdfcpxE6EI3djsKenuxYH/gj11/7B0ZHmCbNxjscuksm8nySMDyf 1oKA== X-Forwarded-Encrypted: i=1; AJvYcCW2A1a9kxAeWsUzkTB2KiFU53OoliWMDLwhEIgqQf+akoTShnGokA1159tzUbSHeyhcwmZGHXSIaYc=@lists.php.net X-Gm-Message-State: AOJu0YxWynL8fVJJqUsQLfiivn0s9f1m1LaEuR3gg9xFw8ka/jXALJMR Kie0JgEQXMhInZC1MJYQBF0U29oQcsCFKzJUns5Zij01LYClZ/SaUt3dG7JF8Jys07SHF+g+hVM aSzXyt5HeHpuzto3xBQkgahMv+XkAbyGf X-Gm-Gg: ASbGnctqVrMCF1I2Su0/clhA6LurRKQ4ph+2ya2vj5nTORlwViy4RX6h3bFeKpQWW5/ q74bcX8SH6F0EDl/7N4qjWvFApb8ZeB2sDKg3fHQPJCBl4S7H3kFxhIfqeKMiLthgCg== X-Google-Smtp-Source: AGHT+IEd0t5O/JwASpKV5l+5ERWlOPqXBkDfOc/KAyXoLTMhpojGXW+D1cA5QoCXjc7Un+y6yWTUrVpcanvW+Eaopkc= X-Received: by 2002:a17:906:292a:b0:aa5:1757:bdd9 with SMTP id a640c23a62f3a-aa581041510mr234007866b.44.1732729308930; Wed, 27 Nov 2024 09:41:48 -0800 (PST) Precedence: bulk list-help: list-post: List-Id: internals.lists.php.net x-ms-reactions: disallow MIME-Version: 1.0 References: <172D8C55-DCB2-4C5A-A224-C8B29B503DDF@gmail.com> <06e23630-16d0-4bbf-b49e-a04b43ff1f7b@gmx.de> In-Reply-To: <06e23630-16d0-4bbf-b49e-a04b43ff1f7b@gmx.de> Date: Wed, 27 Nov 2024 19:41:37 +0200 Message-ID: Subject: Re: [PHP-DEV] Needs Feedback - Yield without value in reference generator function does not create notice To: "Christoph M. Becker" Cc: Claude Pache , internals Content-Type: multipart/alternative; boundary="000000000000f36b1f0627e87a92" From: aggelosbellos7@gmail.com (aggelos bellos) --000000000000f36b1f0627e87a92 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable > > > A notice would be consistent with what happens with: `function &f() { > return; }; f();`. But don=E2=80=99t add new notices in patch releases, ot= herwise > 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. > But isn't a bug that the notice is missing in the first place? 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. > Hmm I am not exactly sure if I agree with you. Whatever we decide, it will happen in a new version. It feels right to fix the current supported versions. Regarding the deprecation decision, I checked the RFC https://wiki.php.net/rfc/generators and I found this line: *Only generators specifying the & modifier can be iterated by ref. If you > try to iterate a non-ref generator by-ref an E_ERROR is thrown.* Correct me if I am wrong, but this phrase refers to our case. If I understand this correctly it should normally throw an E_ERROR so we should continue perhaps with the deprecation? Other than this, I don't have a strong opinion on if we should deprecate or not this case. --000000000000f36b1f0627e87a92 Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable
> A n= otice would be consistent with what happens with: `function &f() { retu= rn; }; f();`. But don=E2=80=99t add new notices in patch releases, otherwis= e 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.

But isn't a bug that the notice is miss= ing in the first place?=C2=A0


In my opinion, whether it should be= deprecated is not a separate
question, but the one we should answer fir= st.=C2=A0 If we're not going to
deprecate/remove the auto-conversion= to a reference, we may as well drop
the notice altogether, instead of a= dding a further notice.

Hmm I am not ex= actly sure if I agree with you. Whatever we decide, it will happen in a new= version. It feels right to fix the current supported versions.
R= egarding the deprecation decision, I checked the RFC=C2=A0https://wiki.php.net/rfc/g= enerators=C2=A0and I found this line:

Only generators specifying the=C2=A0&=C2=A0modifier can be= iterated by ref. If you try to iterate a non-ref generator by-ref an=C2=A0= E_ERROR=C2=A0i= s thrown.

Correct me if I am wro= ng, but this phrase refers to our case. If I understand this correctly it s= hould normally throw an E_ERROR so we should continue perhaps with the depr= ecation? Other than this, I don't have a strong opinion on if we should= deprecate or not this case.=C2=A0
--000000000000f36b1f0627e87a92--