[DDC-1934] version_compare behavior Created: 18/Jul/12  Updated: 09/Feb/13  Resolved: 09/Feb/13

Status: Resolved
Project: Doctrine 2 - ORM
Component/s: ORM
Affects Version/s: None
Fix Version/s: None
Security Level: All

Type: Bug Priority: Minor
Reporter: Yaroslav Kiliba Assignee: Benjamin Eberlei
Resolution: Won't Fix Votes: 0
Labels: None


Note that version number with upper-case letters is not a correct PHP-standardized version number. Because of that the version_compare function might not work as you expected.
var_dump(version_compare('2.1.0-dev', '2.1.0-beta', '<')); // expected: true
var_dump(version_compare('2.1.0-DEV', '2.1.0-BETA', '<')); // expected: true
var_dump(version_compare('2.1.0-DEV', '2.1.0-dev', '<')); // expected: false


I've seen in the code version_compare checks such as
version_compare(\Doctrine\Common\Version::VERSION, '2.2.0-DEV', '>=')
It's not big deal 'cause for example 2.2.0 is still > 2.2.0-DEV as well as 2.2.1, etc.
See also https://bugs.php.net/bug.php?id=62586

Comment by Alexander [ 09/Feb/13 ]

As far as I can see it works for our use case. If you are experiencing real world problems feel free to re-open the issue.

Generated at Wed Nov 25 13:35:56 EST 2015 using JIRA 6.4.10#64025-sha1:5b8b74079161cd76a20ab66dda52747ee6701bd6.