#20416 closed defect (bug) (invalid)
Install plugins version checking not correct
Reported by: | Workshopshed | Owned by: | |
---|---|---|---|
Milestone: | Priority: | normal | |
Severity: | minor | Version: | 3.4 |
Component: | Administration | Keywords: | |
Focuses: | Cc: |
Description
The version checking does not seem to be treating the numbers in the same way a person would, when I view the "details" the screen says:
Newer Version (1.63) Installed
FYI
Version: 1.7
Surely 1.7 is newer than 1.63.
Looking in the code I see that install_plugin_install_status is the function that manages this which is in wp-admin\includes\plugin-install.php
That in turn uses "version_compare" to check the versions. Experimenting with that function which is a php function it would seem that:
version_compare('1.7','1.63', '<') = true version_compare('1.7','1.6', '<') = false version_compare('1.70','1.60', '<') = false version_compare('1.70','1.63', '<') = false
So a work around for this is to ensure that people use a standarised numbering convention. This behaviour has been there since 3.0.0.
Change History (3)
Note: See
TracTickets for help on using
tickets.
The behavior of the install screen did change at one point to match the version comparisons used elsewhere, previously I believe this used a decimal comparison ( 1.7 > 1.63?) which broke on major.minor.patch (3.2.1) style version numbers.
Since we use version_compare() everywhere else in WordPress for the update notifications, it makes sense to keep that there. As a result, if you're using 1.63, you'll never get a update notification to 1.7, since that's 1.07 vs 1.63 when it comes to version comparisons.
So in the end, I think it's something that has to be left up to plugin authors to actually specify their versions right, although, some documentation to mention this gotcha might be advisable if it's not already around somewhere...