Re: [Discussion] Stricter implicit boolean coercions
| From: | Jordi Boggiano | Date: | Tue, 17 May 2022 09:18:03 +0000 |
| Subject: | Re: [Discussion] Stricter implicit boolean coercions | ||
| References: | 1 | Groups: | php.internals |
| Request: | Send a blank email to internals+get-117738@lists.php.net to get a copy of this message | ||
On 16/05/2022 17:06, Andreas Leathley wrote:
Hello Internals, After the first discussion about this topic (https://externals.io/message/117608) I have created a preliminary implementation and an RFC for making implicit boolean type coercions more strict: https://wiki.php.net/rfc/stricter_implicit_boolean_coercionsThanks for the RFC. I think it's overall a good idea, especially for cases like "false" => true, and arguably for ints >1/<0, but my gut feeling is the string=>bool deprecation will lead to a lot of pain. I definitely see this being done in many places where you expect any string value to be true and an empty string to be false (without consideration for the "false" case which is more common in config style use cases). I don't know what you could do to improve this without making the RFC useless though. I wish these things could be tried out in alpha or even up to early RC builds so we could hopefully get community feedback in before deciding whether it's worth the pain inflicted or not. Best, Jordi -- Jordi Boggiano @seldaek - https://seld.be