Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

API version compare returns always "update_available" false #390

Closed
av-commits opened this issue Aug 9, 2023 · 1 comment · Fixed by #398
Closed

API version compare returns always "update_available" false #390

av-commits opened this issue Aug 9, 2023 · 1 comment · Fixed by #398
Assignees
Labels
bug Something isn't working

Comments

@av-commits
Copy link

av-commits commented Aug 9, 2023

Describe the bug
intval in function below with version string starting with v e.g. v1.6.1 always return 0 --> 0 < 0 --> false

public static function is_update_available() {

I would recommend to use php version_compare()
return version_compare(self::get_api_version(), self::get_latest_api_version()) == -1;

that work in my tests and also handles thing like 1.12.1 lower version then 2.0.1

To Reproduce
Steps to reproduce the behavior:

  1. Call /api/v1/system/api/version on old api version system

Expected behavior
Return true if new API version is available

Screenshots or Response
n/a

pfSense Version & Package Version:

  • pfSense Version: pfSense 2.7.0
  • Package Version v1.6.1 / v1.6.2

Affected Endpoints:

  • URL: /api/v1/system/api/version

Additional context

@jaredhendrickson13 jaredhendrickson13 added the bug Something isn't working label Sep 6, 2023
@jaredhendrickson13
Copy link
Owner

Sounds like a great option. I'll include this in the next patch.

Thanks!

@jaredhendrickson13 jaredhendrickson13 self-assigned this Sep 6, 2023
@jaredhendrickson13 jaredhendrickson13 linked a pull request Sep 11, 2023 that will close this issue
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants