Make WordPress Core

Opened 13 years ago

Closed 12 years ago

Last modified 12 years ago

#20416 closed defect (bug) (invalid)

Install plugins version checking not correct

Reported by: workshopshed's profile 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)

#1 @dd32
13 years ago

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

#2 @nacin
12 years ago

  • Milestone Awaiting Review deleted
  • Resolution set to invalid
  • Status changed from new to closed
Note: See TracTickets for help on using tickets.