naneau / semver

PHP Semantic Versioning library
MIT License
73 stars 9 forks source link

Bug on Sort with regard to item 9 of SemVer Specification #22

Open glandre opened 8 years ago

glandre commented 8 years ago

Hello,

First of all, I want to congratulate your project. It'll be very useful. I'm using semver to manage versions of a library I'm implementing, and, I noticed a small error. The following string causes the error: 1.0.5-beta.0.5. This string comprises the 9th item from SemVer Specification. The following code illustrates the problem:

<?php
use Naneau\SemVer\Sort;

$strs = array(
"1.0.5-beta.0.5",
);

$sorted = Sort::sort($strs);

echo "[original]: $strs[0]\n";
echo "[after sort]: $sorted[0]\n";

Output:

[original]: 1.0.5-beta.0.5
[after sort]: 1.0.5-0.0.5

Bests.