Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:61580 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 2354 invoked from network); 20 Jul 2012 20:57:38 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 20 Jul 2012 20:57:38 -0000 Authentication-Results: pb1.pair.com header.from=ajfweb@googlemail.com; sender-id=pass Authentication-Results: pb1.pair.com smtp.mail=ajfweb@googlemail.com; spf=pass; sender-id=pass Received-SPF: pass (pb1.pair.com: domain googlemail.com designates 209.85.212.182 as permitted sender) X-PHP-List-Original-Sender: ajfweb@googlemail.com X-Host-Fingerprint: 209.85.212.182 mail-wi0-f182.google.com Received: from [209.85.212.182] ([209.85.212.182:49680] helo=mail-wi0-f182.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id C0/5E-18983-046C9005 for ; Fri, 20 Jul 2012 16:57:37 -0400 Received: by wibhq12 with SMTP id hq12so768670wib.11 for ; Fri, 20 Jul 2012 13:57:32 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=googlemail.com; s=20120113; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :cc:content-type; bh=E9ITl50aDZ/RNH/Fic2ivf5FGwIhW5fY5dr8seHqaco=; b=hEtAGDvjKu6TvvMkcJzvfUk2rhjX2j86lvgpnb5p0NBwJSfBnRQBw0nUFAsAEVxFUn I6iLCEfTOIMwrtHcd4VaUs9eKuZ7ZvBKvcI9Z0oVaFgt7UI7/pzWC2nuszLbSa5ZehhW 3g50y/wXUG1QhO/u1LZ61VAPNMOH0v9Frte1AEFICqQKXn2RdIoTsGXmyWsQHf5Rcagu YNirUSZQW8AeMdnuQixJvaCvY5og0yW3f0ExYKXy3w0spV1YhD4j6hGhNyjWoljfgjbT 3dYal+WeyFgBYrg7XW9UolDWKU9fZgCkCtHECj7RuUIMNYcIIleWXawrxYsQj4R1fNUC +fNQ== MIME-Version: 1.0 Received: by 10.180.96.3 with SMTP id do3mr17561781wib.5.1342817852414; Fri, 20 Jul 2012 13:57:32 -0700 (PDT) Received: by 10.216.160.16 with HTTP; Fri, 20 Jul 2012 13:57:32 -0700 (PDT) Received: by 10.216.160.16 with HTTP; Fri, 20 Jul 2012 13:57:32 -0700 (PDT) In-Reply-To: References: Date: Fri, 20 Jul 2012 21:57:32 +0100 Message-ID: To: Rasmus Schultz Cc: internals@lists.php.net Content-Type: multipart/alternative; boundary=f46d044481351758d204c54925ac Subject: Re: [PHP-DEV] common issue with version_compare() From: ajfweb@googlemail.com (Andrew Faulds) --f46d044481351758d204c54925ac Content-Type: text/plain; charset=UTF-8 Well, in the spirit of PHP, let's make version_compare_fixed()! On Jul 20, 2012 1:41 PM, "Rasmus Schultz" wrote: > From the comments in the documentation, it seems others are having the same > problem with version_compare() that I was running into: > > http://us2.php.net/version_compare > > Look at all those code-samples and "extensions" to the function - I found > it very odd that the documentation does not explain how an "empty" > version-number is interpreted compared to the strings and numbers, which > are clearly defined and explained. > > 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". > > Of course that would break backwards compatibility, which kind of defeats > the purpose of having a standardized version-number comparison standard. > But as you can see, people aren't using the function as-is anyway - they're > writing their own... > > - Rasmus Schultz > --f46d044481351758d204c54925ac--