Support » Plugin: Better Plugin Compatibility Control » Showing support for minor WP versions

  • Resolved GermanKiwi

    (@germankiwi)


    Hi, I’ve been using this plugin for ages and find it really helpful. I have a request though:

    It would be great if BPCC could take account of sub-versions of WordPress, and not show them in red if a plugin doesn’t specifically mention the current sub-version of WordPress.

    Example: let’s say I have a plugin installed called “Acme Plugin”, and its readme file says it supports WP versions 3.5 – 3.8. However, I’m running WordPress 3.8.1 on my site.

    As of right now, BPCC will show the “3.8” text in red because it doesn’t exactly match the version of WordPress (3.8.1) that I’m using. However, in reality, it’s quite safe to assume that if a plugin supports 3.8, it will also support 3.8.1 (and 3.8.2 etc) as well.

    For that reason it would be nice for BPCC not to show the “3.8” in red, but to show it in green because it really is still supported. (In fact this might even be official policy from the WordPress developers, that if a plugin supports a major version, it’s assumed to support all minor versions too? Is that correct?)

    What do you think?

    https://wordpress.org/plugins/better-plugin-compatibility-control/

Viewing 7 replies - 16 through 22 (of 22 total)
  • Plugin Author wpseek

    (@alphawolf)

    Oh, I thought I had posted here after releasing the plugin update.

    The issue you (read: everyone) are experiencing seems to be a PHP bug. In short, it indicates 3.8.0 to be a higher version than 3.8.

    I asked for it here http://stackoverflow.com/questions/22510810/version-compare-indicating-x-y-0-is-higher-than-x-y but didn’t get any replies yet.

    The issue still persists in the latest PHP version 5.5.x. It might be intended behaviour, but I wouldn’t understand why. 🙂

    That is strange indeed. But thanks for explaining. Maybe someone will still come back with an answer to your question there.

    I guess the middle number given in this function is the installed WP version, right?

    version_compare('3.8.0', '3.8', '>')

    Is it possible then, to give the middle number a zero too? Like ‘3.8.0’ – so that it matches the first number? In other words, you could force the WP version to always use three digits like that, even when the last digit is zero. Would that work?

    In any case, I guess this is only an issue (for me personally) for just a little while longer, because once WP 3.9.0 is released, in a few weeks, then the Simple History plugin will no longer produce this strange behaviour, right? Because its “Requires at least” field will still say 3.8.0 which will then be the previous version of WP, not the current version anymore, and therefore it will show in green not red. Right? And this is the only plugin I’m using that has this problem. I think 99% of plugins would use a “Requires at least” field that has an older version like 3.5 or 3.0 or something.

    Okay I just did some further digging, and I believe I found the answer to your question about version_compare. The answer is given here.

    So the problem is that “3.8” is not a PHP-standardized version number string. Apparently the numbers must use the same versioning format that PHP itself uses for its own versions, and I guess that means three digits, not just two digits, are required.

    So it might still be that the solution is to convert the middle number (the current WP version) into three digits, by adding a zero when it’s only 3.8. If that’s possible to do. 🙂

    Plugin Author wpseek

    (@alphawolf)

    Hi GermanKiwi, thought about adding a zero too, but that would still result in the same issue… vice versa, though. 🙂

    So, let’s say I’m adding a third digit to the installed WP version number, and plugin authors indicate their plugins to be compatible up to version 3.8. Result: The comparison would tell that the current WP version (3.8.0) is higher than the max plugin compatibility version (3.8), and it would be in red.

    If you’re on WP 3.9.x, it will be in green, yes… unless the plugin author doesn’t set the “Requires at least” field to 3.9.0 🙂

    Then again, if the plugin author of “Simple History” would change the “Requires at least” field to 3.8 (without a trailing zero; like 99% of plugin authors do), the issue would be gone right away.

    True, I see your point there, about it giving the same problem in reverse!

    What about this idea: can you make BPCC check to see how many digits are given in the readme.txt file, and then use the same number of digits in the WP version number?

    Eg. if the plugin readme says “Requires at least: 3.8.0”, then BPCC will make sure the WP version also uses three digits (so it will add a zero if the WP version is 3.8).

    But if the readme says “Requires at least: 3.8”, then BPCC will not use a zero at the end of the WP version – it will leave the WP version as “3.8”.

    And if the WP version is actually 3.8.1 or 3.8.2 (ie. already three digits), then BPCC should leave it as three digits, and if necessary, it can add a zero to the plugin version number so that it matches the number of digits. So in other words, it adds or removes the zero whenever necessary, to make sure the number of digits matches.

    But I don’t know how easy it would be to achieve this of course. 🙂

    One other question: right now I have WP 3.8.1 installed, not 3.8.0. So why is your plugin using version_compare('3.8.0', '3.8', '>') for the query? Shouldn’t it be using version_compare('3.8.0', '3.8.1', '>') instead?

    Plugin Author wpseek

    (@alphawolf)

    As for your last question: That’s the result of this topic. 🙂

    In order to display “Tested up to” for 3.8 in green, even though you’re running on 3.8.1, I’m stripping the current WP version to only two digits for comparison reasons.

    Right, gotcha! 🙂

Viewing 7 replies - 16 through 22 (of 22 total)
  • The topic ‘Showing support for minor WP versions’ is closed to new replies.