Doctrine Project

  • Log In Access more options
    • Online Help
    • Keyboard Shortcuts
    • About JIRA
    • JIRA Credits
    • What’s New
  • Dashboards Access more options (Alt+d)
  • Projects Access more options (Alt+p)
  • Issues Access more options (Alt+i)
Doctrine 2 - ORM
  • Doctrine 2 - ORM
  • DDC-1934

version_compare behavior

  • Log In
  • Views
    • XML
    • Word
    • Printable

Details

  • Type: Bug Bug
  • Status: Resolved Resolved
  • Priority: Minor Minor
  • Resolution: Won't Fix
  • Affects Version/s: None
  • Fix Version/s: None
  • Component/s: ORM
  • Security Level: All
  • Labels:
    None

Description

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.
Examples:
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

Output:
bool(true)
bool(false)
bool(true)

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

Activity

  • All
  • Comments
  • History
  • Activity
  • Source

People

  • Assignee:
    Benjamin Eberlei
    Reporter:
    Yaroslav Kiliba
Vote (0)
Watch (2)

Dates

  • Created:
    18/Jul/12 4:50 PM
    Updated:
    09/Feb/13 9:34 PM
    Resolved:
    09/Feb/13 9:34 PM
  • Atlassian JIRA (v5.2.7#850-sha1:b2af0c8)
  • Report a problem
  • Powered by a free Atlassian JIRA open source license for Doctrine Project. Try JIRA - bug tracking software for your team.