Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:61623 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 49608 invoked from network); 22 Jul 2012 01:52:46 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 22 Jul 2012 01:52:46 -0000 Authentication-Results: pb1.pair.com smtp.mail=rasmus@mindplay.dk; spf=permerror; sender-id=unknown Authentication-Results: pb1.pair.com header.from=rasmus@mindplay.dk; sender-id=unknown Received-SPF: error (pb1.pair.com: domain mindplay.dk from 209.85.212.42 cause and error) X-PHP-List-Original-Sender: rasmus@mindplay.dk X-Host-Fingerprint: 209.85.212.42 mail-vb0-f42.google.com Received: from [209.85.212.42] ([209.85.212.42:44805] helo=mail-vb0-f42.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id DD/24-14918-DEC5B005 for ; Sat, 21 Jul 2012 21:52:45 -0400 Received: by vbbfs19 with SMTP id fs19so4541384vbb.29 for ; Sat, 21 Jul 2012 18:52:41 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20120113; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :content-type:x-gm-message-state; bh=azeIEZbp1FT4zVklguaj37xvoiqvSYizDburk8PfovU=; b=iwft1LDJ2k2k11iNke5AGbalfmJSw8f1BK2JrgfkhMnkBeIjFSJGmB3M+BlK98PwEb aF22JOd6JexcVm5amfD9VBXAfpIcXzqeqfVulhVWcInklxjRE2B7u60qU1nInLImqkJB q5T7Dbc90uxI80e/WqZAo99fQgQxhrywP5MLQUw/ez8/K/ITi1noTO9QEx83WAuRUZbj jeHewnJ2mUvwxTWICfp+znXZahQ5XzJ/549N98LeKuN0q8RnvEd3Emewxah7+RCmBuq3 yj7zqExuBB/8V0l4f+UVyrKP5o9W4rk1SNrxOlXqMu6smZL9BDAj+X+M/vHs5GHkdzSC 8m4w== MIME-Version: 1.0 Received: by 10.220.218.141 with SMTP id hq13mr8590118vcb.8.1342921961620; Sat, 21 Jul 2012 18:52:41 -0700 (PDT) Received: by 10.52.92.82 with HTTP; Sat, 21 Jul 2012 18:52:41 -0700 (PDT) In-Reply-To: References: <5009C8AA.10603@sugarcrm.com> Date: Sat, 21 Jul 2012 21:52:41 -0400 Message-ID: To: internals@lists.php.net Content-Type: multipart/alternative; boundary=14dae9cfc8307bc5f704c5616239 X-Gm-Message-State: ALoCoQnjau2x27UhuisfqXC4e742uCxqzR/C7J0hsz4bw4vUnjU0DCxvy2t/BtdOYXGTDR253jCz Subject: Re: [PHP-DEV] common issue with version_compare() From: rasmus@mindplay.dk (Rasmus Schultz) --14dae9cfc8307bc5f704c5616239 Content-Type: text/plain; charset=ISO-8859-1 using this particular version-numbering scheme, 1.01 is equal to 1.1 - I don't think that's a bug, because the version-numbers in this version-numbering scheme are integers, not decimals. so I believe this is in fact as correct as it can be, since numbers like "01" should not really be used in this version-numbering scheme, as it's not an integer. changing it is probably not a good idea, since comparisons like "1.10" and "1.100" could potentially become really tricky - in the current version-numbering scheme, 100 is greater than 10, but if these were interpreted as decimals, they would be equal. looks like I opened up pandora's box with this one ;-) bottom line, I think, is that version_compare() should work for the version-numbering scheme used by PHP, so that it works for checking the PHP version-number. if you happen to use the same version-numbering scheme for your PHP projects, good for you - if you don't, too bad... there are just too many version-numbering schemes to support them all... On Sat, Jul 21, 2012 at 2:22 AM, Kris Craig wrote: > > > 1.01 eq 1.1 > > Could you explain this one to me? In every versioning system I've ever > used, 1.1 would be greater than 1.01, not equal. > > > On Fri, Jul 20, 2012 at 5:07 PM, Stas Malyshev >wrote: > > > > > Hi! > > > > > > >> For example, I was not the only one who found it odd that "1.0" is > > > >> considered less than "1.0.0" - wouldn't it make sense to "pad" the > > > shortest > > > >> version-number with zeroes? e.g. "1.0" if compared against "1.0.0" > > > would be > > > >> padded with zeroes at the end, e.g. as "1.0.0". > > > > > > 1.0.0 and 1.0 are different things. If you want to make a comparison > > > that takes into account only two components, you can just cut them both > > > to two components, then compare. > > > -- > > > Stanislav Malyshev, Software Architect > > > SugarCRM: http://www.sugarcrm.com/ > > > (408)454-6900 ext. 227 > > > > --14dae9cfc8307bc5f704c5616239--