From 0f522ddf5fb6e7d268f9d9cf428b8e3985f374ea Mon Sep 17 00:00:00 2001 From: David King Date: Mon, 19 Nov 2012 19:36:07 -0500 Subject: [PATCH] [ticket/11215] A few minor optimizations for phpbb_get_web_root_path() PHPBB3-11215 --- phpBB/includes/functions.php | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-) diff --git a/phpBB/includes/functions.php b/phpBB/includes/functions.php index 60181c488e..213f178694 100644 --- a/phpBB/includes/functions.php +++ b/phpBB/includes/functions.php @@ -5745,16 +5745,12 @@ function phpbb_get_web_root_path(Request $symfony_request) $path_info = $symfony_request->getPathInfo(); if ($path_info == '/') { - return ''; + $path = ''; + return $path; } - $corrections = substr_count($symfony_request->getPathInfo(), '/'); - - $path = ''; - for ($i = 0; $i < $corrections; $i++) - { - $path .= '../'; - } + $corrections = substr_count($path_info, '/'); + $path = str_repeat('../', $corrections); return $path; }