|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
[2012-07-17 10:54 UTC] dattaya108 at gmail dot com
Description:
------------
Is this behavior intentional? If so, should the bug type be changed to 'documentation problem'?
Test script:
---------------
var_dump(version_compare('2.1.0-DEV', '2.1.0-dev'));
Expected result:
----------------
bool(false)
Actual result:
--------------
bool(true)
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
|
|||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Thu Dec 18 22:00:01 2025 UTC |
Wrong test script was provided. Right one: var_dump(version_compare('2.1.0-DEV', '2.1.0-dev', '<'));Yes, definitely, because without third parameter result is the same: var_dump(version_compare('2.1.0-DEV', '2.1.0-dev')); var_dump(version_compare('2.1.0-dev', '2.1.0-dev')); int(-1) int(0)And this: "This parameter is case-sensitive, so values should be lowercase". is probably about the parameter itself: var_dump(version_compare('2.1.0-dev', '2.1.0-dev', 'lt')); var_dump(version_compare('2.1.0-dev', '2.1.0-dev', 'LT')); bool(false) NULLThank you aharvey! I was going to propose to change it to something like this ``` Special version strings such as <literal>alpha</literal> and <literal>beta</literal> should be lowercase. Otherwise they will be treated as <literal>any string not found in this list</literal>. ``` but after a test it turned out that it's not working that way: var_dump(version_compare('2.1.0-DEV', '2.1.0-dev', '<')); var_dump(version_compare('2.1.0-ALPHA', '2.1.0-dev', '<')); var_dump(version_compare('2.1.0-BETA', '2.1.0-dev', '<')); var_dump(version_compare('2.1.0-RC', '2.1.0-dev', '<')); bool(true) bool(true) bool(true) bool(false)