Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:104528 Return-Path: Delivered-To: mailing list internals@lists.php.net Received: (qmail 88471 invoked from network); 27 Feb 2019 11:20:11 -0000 Received: from unknown (HELO 2-smtp.kingsquare.nl) (77.72.144.59) by pb1.pair.com with SMTP; 27 Feb 2019 11:20:11 -0000 Received: from mail-ot1-f50.google.com (mail-ot1-f50.google.com [209.85.210.50]) by 2-smtp.kingsquare.nl (Postfix) with ESMTPSA id 998911A00B5 for ; Wed, 27 Feb 2019 08:06:45 +0000 (UTC) Received: by mail-ot1-f50.google.com with SMTP id t7so13569364otk.8 for ; Wed, 27 Feb 2019 00:06:45 -0800 (PST) X-Gm-Message-State: AHQUAuZUM9gcf1ztIZPiqlc3TAos19cE/4UEFl4q+ng2iiZ3m5OAO1Zn F4Hqn0HUmORBFvaYjys95Q8uCw8hLe6R8rYx/I0= X-Google-Smtp-Source: AHgI3IbD4Y9N7JHeE5HRYoe06wi++POOwkgpY8vuD3bHjmpWk//2DS0R79aJTS2sguxMyBxaIBvBVmnKDoXJ466F+Mo= X-Received: by 2002:a9d:4e08:: with SMTP id p8mr1330765otf.124.1551254804618; Wed, 27 Feb 2019 00:06:44 -0800 (PST) MIME-Version: 1.0 References: In-Reply-To: Date: Wed, 27 Feb 2019 09:06:33 +0100 X-Gmail-Original-Message-ID: Message-ID: To: Nikita Popov Cc: PHP internals Content-Type: multipart/alternative; boundary="00000000000095e4cd0582dba7d8" Subject: Re: [PHP-DEV] [RFC] Saner string to number comparisons From: robin@kingsquare.nl ("Kingsquare.nl - Robin Speekenbrink") --00000000000095e4cd0582dba7d8 Content-Type: text/plain; charset="UTF-8" Op di 26 feb. 2019 om 13:27 schreef Nikita Popov : > Hi internals, > > I think it is well known that == in PHP is a pretty big footgun. It doesn't > have to be. I think that type juggling comparisons in a language like PHP > have some merit, it's just that the particular semantics of == in PHP make > it so dangerous. The biggest WTF factor is probably that 0 == "foobar" > returns true. > > I'd like to bring forward an RFC for PHP 8 to change the semantics of == > and other non-strict comparisons, when used between a number and a string: > > https://wiki.php.net/rfc/string_to_number_comparison > > ... > > Regards, > Nikita > Dear All, From a user-space POV this is a very good way forward and I (personally) really like the proposal of having a transitional period (7.4 anyone?) As of the 0 == "" bit: I do think that an empty string is widespread regarded as falsey-string... Thus 0 == "" sould IMHO return true... Just my 2 cents, keep up the excellent Nikita! (and everyone else ofcourse) Regards, Robin --00000000000095e4cd0582dba7d8--