Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:70069 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 68792 invoked from network); 9 Nov 2013 22:34:42 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 9 Nov 2013 22:34:42 -0000 Authentication-Results: pb1.pair.com smtp.mail=yohgaki@gmail.com; spf=pass; sender-id=pass Authentication-Results: pb1.pair.com header.from=yohgaki@gmail.com; sender-id=pass Received-SPF: pass (pb1.pair.com: domain gmail.com designates 209.85.217.171 as permitted sender) X-PHP-List-Original-Sender: yohgaki@gmail.com X-Host-Fingerprint: 209.85.217.171 mail-lb0-f171.google.com Received: from [209.85.217.171] ([209.85.217.171:38505] helo=mail-lb0-f171.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 20/F3-37676-188BE725 for ; Sat, 09 Nov 2013 17:34:41 -0500 Received: by mail-lb0-f171.google.com with SMTP id x18so2433717lbi.30 for ; Sat, 09 Nov 2013 14:34:38 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:sender:in-reply-to:references:from:date:message-id :subject:to:cc:content-type; bh=KlNIkx5dyu9Obxq1X0RREqwjGMoa+NaUoFsbiMCJzzM=; b=ML/0N2vcB5SjjjiP9ZYzJwsrkNT/8VauuCyDpOPvmbyc5aHAfzt4nJNMJYUMYpPgoY M2tfTLk9KRVSSEWbG3d28fHGroF9RdLspInqILIWR1UzXNJFChCYA8tkktfHB95ITlyw HXN3bJZJT8Qp/HZ82KpFtS+aUOW5KSTSkKtDZqPCfBMGcyO41SFfsVIjtK+LkEwPIq13 +AuuvEP4PqIsy4MmrvdCashxzV8xk4XpJdAyKuDX/mSZdZmqd4Abf0C+xO0QbTKrpVZ/ yNpvR5rw3491uYLrsWXOg1kvLehK+vcg9xnS9vUWCIxPZiFVXYn1eVm7hHn6CEAWup24 ZpbQ== X-Received: by 10.152.28.9 with SMTP id x9mr47805lag.27.1384036478077; Sat, 09 Nov 2013 14:34:38 -0800 (PST) MIME-Version: 1.0 Sender: yohgaki@gmail.com Received: by 10.112.154.201 with HTTP; Sat, 9 Nov 2013 14:33:57 -0800 (PST) In-Reply-To: <527DF228.1080108@sugarcrm.com> References: <527DF228.1080108@sugarcrm.com> Date: Sun, 10 Nov 2013 07:33:57 +0900 X-Google-Sender-Auth: ixt0w389Gcjcqymql0TOjLhOTi4 Message-ID: To: Stas Malyshev Cc: "internals@lists.php.net" Content-Type: multipart/alternative; boundary=089e0160b8fea1cf1104eac61aef Subject: Re: [PHP-DEV] [RFC] Comparison and conversion inconsistency - need more info From: yohgaki@ohgaki.net (Yasuo Ohgaki) --089e0160b8fea1cf1104eac61aef Content-Type: text/plain; charset=UTF-8 Hi Stas, On Sat, Nov 9, 2013 at 5:28 PM, Stas Malyshev wrote: > Hi! > > > I was surprised that wired min() behavior. > > The cause of this behavior is in Zend API. > > > > https://bugs.php.net/bug.php?id=53104 > > > > So I've made FRC to discuss/document/fix such behavior. > > > > If anyone know such behavior, please let me know so that I can write them > > in the RFC. > > In the engine, null is less than -1. Changing it would be a very > profound compatibility break, so I do not think it can be done in any > 5.x version. > > Current behavior is described here in detail: > http://php.net/manual/en/language.operators.comparison.php > > Null is the same as false in this case, which is less than any non-false > value. -1 is a non-false value. > My intention is not fix them all, but document them if we are not going to fix inconsistent behaviors. For example, string may be converted to int when it seems int/float or hex, but it's not converted when it seems octal or binary. I think it's not documented yet. (At least not clearly, is it? Adding octal/binary conversion is not a good idea. Likewise, -1 should be true.) I'm wandering whether there are functions like min(). It does not follow basic comparison/conversion rules. min() behavior is nonsense and it would be good fixing min() at some point. Not many users will be affected, IMO. https://bugs.php.net/bug.php?id=53104 There may be function like min(), but it may not be feasible to change behavior. If change is not feasible, we may document behavior instead. If we fix little inconsistencies like this, it would be better fix them all at once. Do you know any functions like min()? Regards, BTW, typo in s/wired/weird/ in first post :( -- Yasuo Ohgaki yohgaki@ohgaki.net --089e0160b8fea1cf1104eac61aef--