From 36d5fff1c6cbacbda4b4c623d8b9d909f214167a Mon Sep 17 00:00:00 2001 From: Tristan Darricau Date: Mon, 12 May 2014 23:47:05 +0200 Subject: [PATCH] [ticket/12536] Get Versions Should Not Require Both Stable and Unstable https://tracker.phpbb.com/browse/PHPBB3-12536 PHPBB3-12536 --- phpBB/phpbb/version_helper.php | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/phpBB/phpbb/version_helper.php b/phpBB/phpbb/version_helper.php index e2fdf6ce63..7d59b5cd3a 100644 --- a/phpBB/phpbb/version_helper.php +++ b/phpBB/phpbb/version_helper.php @@ -216,10 +216,19 @@ class version_helper if ($this->force_stability !== null) { - return ($this->force_stability === 'unstable') ? $info['unstable'] : $info['stable']; + $stability = ($this->force_stability === 'unstable') ? 'unstable' : 'stable'; + } + else + { + $stability = $this->is_stable($this->current_version) ? 'stable' : 'unstable'; } - return ($this->is_stable($this->current_version)) ? $info['stable'] : $info['unstable']; + if (!isset($info[$stability])) + { + throw new \RuntimeException($this->user->lang('VERSIONCHECK_FAIL')); + } + + return $info[$stability]; } /** @@ -247,7 +256,7 @@ class version_helper $info = json_decode($info, true); - if (empty($info['stable']) || empty($info['unstable'])) + if (empty($info['stable']) && empty($info['unstable'])) { $this->user->add_lang('acp/common');