diff options
author | Matt Friedman <maf675@gmail.com> | 2017-03-24 11:45:11 -0700 |
---|---|---|
committer | Matt Friedman <maf675@gmail.com> | 2017-03-24 11:47:03 -0700 |
commit | afddb81acfa291ba8043d6af974f97abe8ec5243 (patch) | |
tree | 5f1e56ab345cbbd48fb622d46e84a773578072ad /phpBB/phpbb | |
parent | 91ab27ecc9973d8f929d3e1ec06886fa9e57b979 (diff) | |
download | forums-afddb81acfa291ba8043d6af974f97abe8ec5243.tar forums-afddb81acfa291ba8043d6af974f97abe8ec5243.tar.gz forums-afddb81acfa291ba8043d6af974f97abe8ec5243.tar.bz2 forums-afddb81acfa291ba8043d6af974f97abe8ec5243.tar.xz forums-afddb81acfa291ba8043d6af974f97abe8ec5243.zip |
[ticket/15142] Handle versions for unmatched branches
PHPBB3-15142
Diffstat (limited to 'phpBB/phpbb')
-rw-r--r-- | phpBB/phpbb/version_helper.php | 18 |
1 files changed, 13 insertions, 5 deletions
diff --git a/phpBB/phpbb/version_helper.php b/phpBB/phpbb/version_helper.php index c613885909..614c93d781 100644 --- a/phpBB/phpbb/version_helper.php +++ b/phpBB/phpbb/version_helper.php @@ -274,12 +274,20 @@ class version_helper $branches = array_filter(array_keys($versions), function($branch) use ($self, $current_branch) { return $self->compare($branch, $current_branch, '>='); }); - $versions = array_intersect_key($versions, array_flip($branches)); - - // CDB reverse sorts extension versions, so we need to resort them - ksort($versions); + $versions = !empty($branches) ? array_intersect_key($versions, array_flip($branches)) : $versions; + if (!empty($branches)) + { + $versions = array_intersect_key($versions, array_flip($branches)); + } + else + { + // If branches are empty, it means the current phpBB branch is newer than any branch the + // extension was validated against. Reverse sort the versions array so we get the newest + // validated release available. + krsort($versions); + } - // Get the lowest version from the previous list. + // Get the first available version from the previous list. $update_info = array_reduce($versions, function($value, $data) use ($self, $current_version) { if ($value === null && $self->compare($data['current'], $current_version, '>=')) { |