Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:60040 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 96457 invoked from network); 17 Apr 2012 00:05:32 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 17 Apr 2012 00:05:32 -0000 Authentication-Results: pb1.pair.com smtp.mail=smalyshev@sugarcrm.com; spf=pass; sender-id=pass Authentication-Results: pb1.pair.com header.from=smalyshev@sugarcrm.com; sender-id=pass Received-SPF: pass (pb1.pair.com: domain sugarcrm.com designates 67.192.241.143 as permitted sender) X-PHP-List-Original-Sender: smalyshev@sugarcrm.com X-Host-Fingerprint: 67.192.241.143 smtp143.dfw.emailsrvr.com Linux 2.6 Received: from [67.192.241.143] ([67.192.241.143:51905] helo=smtp143.dfw.emailsrvr.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 67/B7-05733-BC3BC8F4 for ; Mon, 16 Apr 2012 20:05:32 -0400 Received: from localhost (localhost.localdomain [127.0.0.1]) by smtp14.relay.dfw1a.emailsrvr.com (SMTP Server) with ESMTP id 22A0C298201; Mon, 16 Apr 2012 20:05:29 -0400 (EDT) X-Virus-Scanned: OK Received: by smtp14.relay.dfw1a.emailsrvr.com (Authenticated sender: smalyshev-AT-sugarcrm.com) with ESMTPSA id C8E592981B5; Mon, 16 Apr 2012 20:05:28 -0400 (EDT) Message-ID: <4F8CB3C8.7030804@sugarcrm.com> Date: Mon, 16 Apr 2012 17:05:28 -0700 Organization: SugarCRM User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.6; rv:11.0) Gecko/20120327 Thunderbird/11.0.1 MIME-Version: 1.0 To: Gustavo Lopes CC: PHP Developers Mailing List References: <4F884FB4.70901@sugarcrm.com> In-Reply-To: Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit Subject: Re: [PHP-DEV] '9223372036854775807' == '9223372036854775808' From: smalyshev@sugarcrm.com (Stas Malyshev) Hi! > In any case, your selective quoting destroyed the main point of my > e-mail -- that is, this problem implicates these questions: is > "9223372036854775808" different from 9223372036854775808? Is > "9223372036854775808" still deemed to represent an integer, even > though we cannot represent it as an integer type? Well, it is different, as it looks like from usage patterns. You can't get int 9223372036854775808 from database or web form, but you very well can get string "9223372036854775808". > I think most people can agree that this behavior is correct: > > var_dump(9223372036854775807 == 9223372036854775808); //true I would say, yes, this is fine. > therefore, we need some -- principled -- distinction to treat case > "9223372036854775807" == "9223372036854775808" differently. The > distinction I propose is answering "yes" to the questions above -- > they represent different entities and when no conversion of the > integer string to the integer type can't be done we should fall back > to memcmp(). This is what is already done with the overflowing > "1e400". I don't find it particularly convincing, though. I think this is the way to go, unless somebody proposes a better way to handle it. -- Stanislav Malyshev, Software Architect SugarCRM: http://www.sugarcrm.com/ (408)454-6900 ext. 227