Re: [IDEA for RFC] let the "new" operator fail when the __construct() function returns a value.

From: Date: Fri, 20 Feb 2026 11:35:12 +0000
Subject: Re: [IDEA for RFC] let the "new" operator fail when the __construct() function returns a value.
References: 1 2 3  Groups: php.internals 
Request: Send a blank email to internals+get-130104@lists.php.net to get a copy of this message
Hi Am 2026-02-14 15:00, schrieb Mirco Babin:
This argument has convinced me. And writing it down helps clear my mind.
Great, thank you!
All that said: If you are willing prepare an initial RFC Draft based on the official RFC template (https://wiki.php.net/rfc/template) and to go through the process of officially discussion the RFC, I'm happy to do the “polishing” work as an official coauthor / mentor to make sure there are no missing bits or other mistakes. I'm also willing to get someone to do the implementation (potentially I'm doing it myself). Do we have a deal? :-)
I have prepared a RFC at https://gist.github.com/MircoBabin/aaa574297c8d1baa879f19c99ce28e93 Are you still willing to carry out the implementation? If so:
Yes, I'm still willing to help out with the implementation (or to find someone to to the implementation if the RFC passes).
- Should I mention you as coauthor?
For the “only warn on new at runtime” variant, I personally don't agree with the proposal and thus don't want to officially co-author it. But I'm nevertheless willing to help with the implementation and with feedback to ensure that the RFC is in the best possible shape policy-wise. As previously mentioned, I believe it should consistently warn at compile-time and not make a difference between “using new” and “calling __construct() manually”.
- In the first chapter, what wording should "Implementation" be? - What wording should "Patches and Tests" be?
It's okay to leave that out for now in both cases. An implementation is not necessary to vote on the RFC and it can be filled in later. The next step would be registering a Wiki account at https://wiki.php.net/rfc?do=register and then request RFC karma, so you can create a proper RFC page and “officially” start the discussion. Having the page will also make the RFC text much more convenient to read compared to the Gist. I've taken a quick look at the text and “format-wise” it seems to contain all the necessary information. Great work! Best regards Tim Düsterhus

« previous php.internals (#130104) next »