From 2c1da15ae83e292d3aa9c94f740d6bff6bfd238e Mon Sep 17 00:00:00 2001 From: Nathan Guse Date: Mon, 30 Jul 2012 16:23:18 -0500 Subject: [PATCH 1/3] [ticket/11029] Cache obtain_cfg_items should return empty array on failure continue was used where it should not have been, causing a fatal error This file is loaded on every page to check if style.cfg has changed. If it has not, the user is not affected, so if it does not exist, the user should not be affected either. PHPBB3-11029 --- phpBB/includes/cache/service.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/phpBB/includes/cache/service.php b/phpBB/includes/cache/service.php index 37f32aa753..5946241825 100644 --- a/phpBB/includes/cache/service.php +++ b/phpBB/includes/cache/service.php @@ -337,7 +337,7 @@ class phpbb_cache_service if (!file_exists($filename)) { - continue; + return array(); } if (!isset($parsed_array['filetime']) || (($config['load_tplcompile'] && @filemtime($filename) > $parsed_array['filetime']))) From 907f1771f9594ee1906c5b0ad7fac765f2a1995d Mon Sep 17 00:00:00 2001 From: Nathan Guse Date: Mon, 6 Aug 2012 15:05:06 -0500 Subject: [PATCH 2/3] [ticket/11029] Return $parsed_array (may have loaded from the cache) Even if the file does not exist, it may be in the cache, so return $parsed_array just in case PHPBB3-11029 --- phpBB/includes/cache/service.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/phpBB/includes/cache/service.php b/phpBB/includes/cache/service.php index 5946241825..b29af3c531 100644 --- a/phpBB/includes/cache/service.php +++ b/phpBB/includes/cache/service.php @@ -337,7 +337,7 @@ class phpbb_cache_service if (!file_exists($filename)) { - return array(); + return $parsed_array; } if (!isset($parsed_array['filetime']) || (($config['load_tplcompile'] && @filemtime($filename) > $parsed_array['filetime']))) From 1b126908c633fa793cf7f3fba1e88139bb599938 Mon Sep 17 00:00:00 2001 From: Nathan Guse Date: Mon, 6 Aug 2012 15:10:20 -0500 Subject: [PATCH 3/3] [ticket/11029] Remove $reparse variable Its only set to false, then true in one case, and only checked once. So remove it because it is unnecessary. PHPBB3-11029 --- phpBB/includes/cache/service.php | 9 ++------- 1 file changed, 2 insertions(+), 7 deletions(-) diff --git a/phpBB/includes/cache/service.php b/phpBB/includes/cache/service.php index b29af3c531..e63ec6e33a 100644 --- a/phpBB/includes/cache/service.php +++ b/phpBB/includes/cache/service.php @@ -332,7 +332,6 @@ class phpbb_cache_service $parsed_array = array(); } - $reparse = false; $filename = $phpbb_root_path . 'styles/' . $style['style_path'] . '/style.cfg'; if (!file_exists($filename)) @@ -342,17 +341,13 @@ class phpbb_cache_service if (!isset($parsed_array['filetime']) || (($config['load_tplcompile'] && @filemtime($filename) > $parsed_array['filetime']))) { - $reparse = true; - } - - // Re-parse cfg file - if ($reparse) - { + // Re-parse cfg file $parsed_array = parse_cfg_file($filename); $parsed_array['filetime'] = @filemtime($filename); $this->driver->put('_cfg_' . $style['style_path'], $parsed_array); } + return $parsed_array; }