Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:61588 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 36103 invoked from network); 20 Jul 2012 22:38:15 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 20 Jul 2012 22:38:15 -0000 Authentication-Results: pb1.pair.com header.from=simon@welsh.co.nz; sender-id=unknown Authentication-Results: pb1.pair.com smtp.mail=simon@welsh.co.nz; spf=permerror; sender-id=unknown Received-SPF: error (pb1.pair.com: domain welsh.co.nz from 103.6.213.4 cause and error) X-PHP-List-Original-Sender: simon@welsh.co.nz X-Host-Fingerprint: 103.6.213.4 unknown Received: from [103.6.213.4] ([103.6.213.4:51697] helo=simon.geek.nz) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id AA/E0-18983-5DDD9005 for ; Fri, 20 Jul 2012 18:38:14 -0400 Received: from [10.0.1.2] (121-73-68-50.cable.telstraclear.net [121.73.68.50]) by simon.geek.nz (Postfix) with ESMTPSA id ECA376068D for ; Sat, 21 Jul 2012 10:38:09 +1200 (NZST) Content-Type: text/plain; charset=us-ascii Mime-Version: 1.0 (Apple Message framework v1278) In-Reply-To: <5009DA26.9020603@gmail.com> Date: Sat, 21 Jul 2012 10:38:08 +1200 Content-Transfer-Encoding: quoted-printable Message-ID: <191D0D11-C8A7-4E1C-B7BB-DC83138FAC85@welsh.co.nz> References: <5009C8AA.10603@sugarcrm.com> <5009DA26.9020603@gmail.com> To: PHP Internals X-Mailer: Apple Mail (2.1278) Subject: Re: [PHP-DEV] common issue with version_compare() From: simon@welsh.co.nz (Simon J Welsh) On 21/07/2012, at 10:22 AM, Hartmut Holzgraefe wrote: > On 07/20/2012 11:07 PM, Stas Malyshev wrote: >> 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. >=20 > it is hart to imagine a 1.0 followed by 1.0.0 in real world, but > the only reason for something like this that i can come up with > is that, for whatever reason, a project wants to change from > two component version numbers to three component ones right after > having done a 1.0. And in that case a 1.0.0 following the 1.0 > would be a new release, even if it only differs by the extra .0 >=20 > And so 1.0 < 1.0.0 would be perfectly correct. >=20 > --=20 > hartmut I've had to use two digit version numbers when upgrading frameworks = during the 5.4 development phrase. This meant that version_compare('5.4', = PHP_VERSION); would return -1 for things like 5.4.0-beta1. Padding the 5.4 to 5.4.0 = would've broken the comparison, as well as changing the return value of version_compare('5.4', PHP_VERSION); when running 5.4.0. --- Simon Welsh Admin of http://simon.geek.nz/