Skip to content

Commit

Permalink
[CMSP-881] use version_compare (#120)
Browse files Browse the repository at this point in the history
* use version_compare
because just > does not work when 2.10 is equivalent to 2.1 instead of the next value after 2.9

* -1 isn't false, regardless of what you might think
  • Loading branch information
jazzsequence authored Mar 14, 2024
1 parent 01b514e commit 7d4072a
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/Cli/FrameworkCommands.php
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ public function cliCosUpdate($cli = 'wp')
$versions_file_path = "$work_dir/wpcli/Dockerfile";
$version_file_contents = file_get_contents($versions_file_path);
$version = $this->getCosWpCliVersion($version_file_contents);

$updated_version = '';
$next_version = $this->nextWpVersionThatExists($version);
if (!$next_version) {
Expand Down Expand Up @@ -299,7 +299,7 @@ protected function nextWpVersionThatExists($current_version)

// If our versions do not match, check that the latest version exists before continuing.
// Greater than comparision to ensure that we don't get older versions. See https://github.com/pantheon-systems/cos-framework-clis/pull/76#issuecomment-1118650316
if ($latest_version > $current_version) {
if (version_compare($latest_version, $current_version, '>')) {
$try_version = $this->wpVersionExists($latest_version);

if (!empty($try_version)) {
Expand Down

0 comments on commit 7d4072a

Please # to comment.