YahnisElsts / plugin-update-checker

A custom update checker for WordPress plugins. Useful if you don't want to host your project in the official WP repository, but would still like it to support automatic updates. Despite the name, it also works with themes.
MIT License
2.22k stars 403 forks source link

Problem with verionning number #415

Closed manu225 closed 3 years ago

manu225 commented 3 years ago

Hi,

I experiencing a little bug i think: one of my plugin have the version number 1.42 When i try to release an update that have the version number 1.5, the plugin updater say there is no updates found for the plugin. But if i set to1.55 instead of 1.5, the new version is correctly detected.

A bug with 2 numbers after comma maybe?

Thanks for your help and this great tool :)

manu225 commented 3 years ago

I try the reverse and the same bug appear: 1.45 version is detected has an update for 1.5 version of the plugin.

manu225 commented 3 years ago

I just found i can set 1.50 instead of 1.5 and it's works well. So not very disturb issue finally :)

YahnisElsts commented 3 years ago

This is not a bug. The update checker uses the version_compare() function to compare versions, and it treats each part of the version as a separate integer, not as a decimal fraction.

For example, given a version number like 1.50, the 50 is treated as "fifty", not as "one half". This also means that 1.5 is not the same as 1.50 or 1.500. In your case the second part of the version number is 42, and 42 is greater than 5, so version 1.42 is greater than version 1.5.

If you want three-part version numbers, I would recommend writing them as a.b.c instead of a.bc.

manu225 commented 3 years ago

Yes i just notice it just after posting. Sorry :)