Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:113609 Return-Path: Delivered-To: mailing list internals@lists.php.net Received: (qmail 67917 invoked from network); 19 Mar 2021 13:34:12 -0000 Received: from unknown (HELO php-smtp4.php.net) (45.112.84.5) by pb1.pair.com with SMTP; 19 Mar 2021 13:34:12 -0000 Received: from php-smtp4.php.net (localhost [127.0.0.1]) by php-smtp4.php.net (Postfix) with ESMTP id 93DC91804DF for ; Fri, 19 Mar 2021 06:28:41 -0700 (PDT) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on php-smtp4.php.net X-Spam-Level: X-Spam-Status: No, score=-0.2 required=5.0 tests=BAYES_40,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_FROM,HTML_MESSAGE, RCVD_IN_DNSWL_NONE,RCVD_IN_MSPIKE_H2,SPF_HELO_NONE,SPF_PASS autolearn=no autolearn_force=no version=3.4.2 X-Spam-Virus: No X-Envelope-From: Received: from mail-lj1-f170.google.com (mail-lj1-f170.google.com [209.85.208.170]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange ECDHE (P-256) server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by php-smtp4.php.net (Postfix) with ESMTPS for ; Fri, 19 Mar 2021 06:28:41 -0700 (PDT) Received: by mail-lj1-f170.google.com with SMTP id u4so11975407ljo.6 for ; Fri, 19 Mar 2021 06:28:41 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to; bh=XgOivhe1xongVHhB3kM+v8IoE0iXc8stz7NUQoZHPeM=; b=XlSz4pioGGMEMsE6+tP5Aa7WN7TaGn1iUi1U63XeKGoTIISijM58odPHOIAXkA9h1s x2auXhxT2hN6BsMGcXGL9LeqT4xSMW7Nknb0onhMBQapo8e1iBUeGtJcccBLojft10OC qAJQzjSBt1ZLF92wXNU6HXcHAu8zMagAduziNiyKivOgk7fxJmhhxLEaq01P6Wa5AG0k u8R9/dXqvo6O9SBfomdBZb0urN3HAukfKFpdAlLXHpW6xk6ayhxRDUWrBQGeniQZDi9a LmnosZHeGEb+Z5+qx/2nUR74KXVqDGB8dNeTzzS4YKdrLtEI+5qMlVP29EvzEr62EZb8 B34w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to; bh=XgOivhe1xongVHhB3kM+v8IoE0iXc8stz7NUQoZHPeM=; b=eZAz2uQ8Ax/7SnPdCTGkh5QdjSd5uBni8kh4SyfJzkQcRuC9Lr8I/5PbsaxDRScxjF fmp4FjX+YQllrI3mrMrMolxJY3LguTCH30FWRvlwyJavwR7ERUQokXBAUic5ayOKLcRg PmPIHsuJ8bwqe6ZVKhZU1Rj3prkIuwDWFsXo8b/29nUEvr74po0XZfat3hZYB4GAbWFB RtXaC3w6P35kurSjnMaUsqeKcvCTqAFV62whLPl7oTNv/PG0Xkwk+sC9naGY8Z+uBYnf Jv840ZAdSx3aREcafChHAfLFCkMhRcsBO9I24QMeZRNMk+CWZmmUei9DRJ70OT26yWi0 +wHg== X-Gm-Message-State: AOAM531MYo2NW3Ono0sVoDRgYqn29T7LAwooBTrM2fmZMK0a7HHrnGhx io3HbLVGZQs7CAOhttldvzlXJxmOkLi/p7ePBZwjQc7DRfo= X-Google-Smtp-Source: ABdhPJyL5D3zTV6CNJm9FLbnl3OC3BehVcni/OykclUhADclB1D7A9ECFcgu0WzkvC109s6zq+48FZyDiqbHjAukdp8= X-Received: by 2002:a2e:95d2:: with SMTP id y18mr970410ljh.353.1616160519470; Fri, 19 Mar 2021 06:28:39 -0700 (PDT) MIME-Version: 1.0 References: In-Reply-To: Date: Fri, 19 Mar 2021 14:28:23 +0100 Message-ID: To: PHP internals Content-Type: multipart/alternative; boundary="000000000000a9c18f05bde3b12f" Subject: Re: Don't compare zero exponentials in strings as equal From: nikita.ppv@gmail.com (Nikita Popov) --000000000000a9c18f05bde3b12f Content-Type: text/plain; charset="UTF-8" On Wed, Mar 3, 2021 at 3:04 PM Nikita Popov wrote: > Hi internals, > > PHP's == comparison semantics for strings have a peculiar edge-case, where > comparisons of the form "0e123" == "0e456" return true, because they are > interpreted as floating point zero numbers. This is problematic, because > strings of that form are usually not numbers, but hex-encoded hashes or > similar. > > I'm wondering if it may make sense to special-case the comparison > semantics to not consider strings of the form "0e[DIGITS]" equal, unless > they are exactly equal (i.e., fall back to lexicographical if both sides of > the comparison are zero exponentials). > > Here's a possible implementation: https://github.com/php/php-src/pull/6749 > > Of course, the usual rule that you should always use === still holds, but > this at least eliminates the most dangerous edge case. > So, I gather the consensus here is that we should leave this alone as a lost cause? Regards, Nikita --000000000000a9c18f05bde3b12f--