diff options
-rw-r--r-- | phpBB/adm/style/install_update.html | 18 | ||||
-rw-r--r-- | phpBB/config/services.yml | 1 | ||||
-rw-r--r-- | phpBB/includes/acp/acp_board.php | 2 | ||||
-rw-r--r-- | phpBB/install/install_update.php | 44 | ||||
-rw-r--r-- | phpBB/language/en/acp/board.php | 4 | ||||
-rw-r--r-- | phpBB/language/en/acp/common.php | 2 | ||||
-rw-r--r-- | phpBB/language/en/install.php | 4 | ||||
-rw-r--r-- | phpBB/phpbb/console/command/extension/enable.php | 2 | ||||
-rw-r--r-- | phpBB/phpbb/filesystem.php | 2 | ||||
-rw-r--r-- | phpBB/phpbb/path_helper.php | 31 | ||||
-rw-r--r-- | phpBB/phpbb/profilefields/lang_helper.php | 61 | ||||
-rw-r--r-- | phpBB/phpbb/profilefields/type/type_bool.php | 11 | ||||
-rw-r--r-- | phpBB/phpbb/profilefields/type/type_dropdown.php | 13 | ||||
-rw-r--r-- | tests/filesystem/clean_path_test.php | 2 | ||||
-rw-r--r-- | tests/path_helper/path_helper_test.php | 39 |
15 files changed, 158 insertions, 78 deletions
diff --git a/phpBB/adm/style/install_update.html b/phpBB/adm/style/install_update.html index f0df138641..2faa2bb6fa 100644 --- a/phpBB/adm/style/install_update.html +++ b/phpBB/adm/style/install_update.html @@ -348,6 +348,24 @@ <!-- ENDIF --> + <!-- IF .deleted --> + <h2>{L_FILES_DELETED}</h2> + <p>{L_FILES_DELETED_EXPLAIN}</p> + + <fieldset> + <legend><img src="{T_IMAGE_PATH}icon_delete.gif" alt="{L_STATUS_DELETED}" /></legend> + <!-- BEGIN deleted --> + <dl> + <dt style="width: 60%;"><strong><!-- IF deleted.DIR_PART -->{deleted.DIR_PART}<br /><!-- ENDIF -->{deleted.FILE_PART}</strong></dt> + <dd style="margin-{S_CONTENT_FLOW_BEGIN}: 60%;"> + <!-- IF not deleted.S_BINARY -->[<a href="{deleted.U_SHOW_DIFF}" onclick="diff_popup(this.href); return false;">{deleted.L_SHOW_DIFF}</a>]<!-- ELSE -->{L_BINARY_FILE}<!-- ENDIF --> + </dd> + </dl> + <!-- END deleted --> + </fieldset> + + <!-- ENDIF --> + <br /> <fieldset class="quick"> diff --git a/phpBB/config/services.yml b/phpBB/config/services.yml index 3743daa075..72eeae9b15 100644 --- a/phpBB/config/services.yml +++ b/phpBB/config/services.yml @@ -255,7 +255,6 @@ services: arguments: - @auth - @config - - @config_text - @dbal.conn - @user - %core.root_path% diff --git a/phpBB/includes/acp/acp_board.php b/phpBB/includes/acp/acp_board.php index 74df9240a1..1811748c2f 100644 --- a/phpBB/includes/acp/acp_board.php +++ b/phpBB/includes/acp/acp_board.php @@ -410,7 +410,7 @@ class acp_board 'ip_check' => array('lang' => 'IP_VALID', 'validate' => 'int', 'type' => 'custom', 'method' => 'select_ip_check', 'explain' => true), 'browser_check' => array('lang' => 'BROWSER_VALID', 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => true), 'forwarded_for_check' => array('lang' => 'FORWARDED_FOR_VALID', 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => true), - 'referer_validation' => array('lang' => 'REFERER_VALID', 'validate' => 'int:0:3','type' => 'custom', 'method' => 'select_ref_check', 'explain' => true), + 'referer_validation' => array('lang' => 'REFERRER_VALID', 'validate' => 'int:0:3','type' => 'custom', 'method' => 'select_ref_check', 'explain' => true), 'check_dnsbl' => array('lang' => 'CHECK_DNSBL', 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => true), 'email_check_mx' => array('lang' => 'EMAIL_CHECK_MX', 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => true), 'max_pass_chars' => array('lang' => 'PASSWORD_LENGTH', 'validate' => 'int:8:255', 'type' => false, 'method' => false, 'explain' => false,), diff --git a/phpBB/install/install_update.php b/phpBB/install/install_update.php index ab5fcc3f2b..c6f771a7d5 100644 --- a/phpBB/install/install_update.php +++ b/phpBB/install/install_update.php @@ -396,7 +396,7 @@ class install_update extends module 'S_COLLECTED' => (int) $update_list['status'], 'S_TO_COLLECT' => sizeof($this->update_info['files']), 'L_IN_PROGRESS' => $user->lang['COLLECTING_FILE_DIFFS'], - 'L_IN_PROGRESS_EXPLAIN' => sprintf($user->lang['NUMBER_OF_FILES_COLLECTED'], (int) $update_list['status'], sizeof($this->update_info['files'])), + 'L_IN_PROGRESS_EXPLAIN' => sprintf($user->lang['NUMBER_OF_FILES_COLLECTED'], (int) $update_list['status'], sizeof($this->update_info['files']) + sizeof($this->update_info['deleted'])), )); return; @@ -422,7 +422,7 @@ class install_update extends module // Now assign the list to the template foreach ($update_list as $status => $filelist) { - if ($status == 'no_update' || !sizeof($filelist) || $status == 'status') + if ($status == 'no_update' || !sizeof($filelist) || $status == 'status' || $status == 'status_deleted') { continue; } @@ -489,7 +489,7 @@ class install_update extends module $all_up_to_date = true; foreach ($update_list as $status => $filelist) { - if ($status != 'up_to_date' && $status != 'custom' && $status != 'status' && sizeof($filelist)) + if ($status != 'up_to_date' && $status != 'custom' && $status != 'status' && $status != 'status_deleted' && sizeof($filelist)) { $all_up_to_date = false; break; @@ -831,7 +831,7 @@ class install_update extends module foreach ($update_list as $status => $files) { - if ($status == 'up_to_date' || $status == 'no_update' || $status == 'status') + if ($status == 'up_to_date' || $status == 'no_update' || $status == 'status' || $status == 'status_deleted') { continue; } @@ -1221,6 +1221,16 @@ class install_update extends module $this->page_title = 'VIEWING_FILE_CONTENTS'; break; + + case 'deleted': + + $diff = $this->return_diff(array(), $phpbb_root_path . $original_file); + + $template->assign_var('S_DIFF_NEW_FILE', true); + $diff_mode = 'inline'; + $this->page_title = 'VIEWING_FILE_CONTENTS'; + + break; } $diff_mode_options = ''; @@ -1266,7 +1276,9 @@ class install_update extends module 'new_conflict' => array(), 'conflict' => array(), 'no_update' => array(), + 'deleted' => array(), 'status' => 0, + 'status_deleted'=> 0, ); } @@ -1345,7 +1357,31 @@ class install_update extends module $update_list['status']++; } + foreach ($this->update_info['deleted'] as $index => $file) + { + if (is_int($update_list['status_deleted']) && $index < $update_list['status_deleted']) + { + continue; + } + + if ($num_bytes_processed >= 500 * 1024) + { + return; + } + + if (file_exists($phpbb_root_path . $file)) + { + $update_list['deleted'][] = array('filename' => $file, 'custom' => false, 'as_expected' => false); + $num_bytes_processed += filesize($phpbb_root_path . $file); + } + + $update_list['status_deleted']++; + $update_list['status']++; + } + + $update_list['status_deleted'] = -1; $update_list['status'] = -1; + /* if (!sizeof($this->update_info['files'])) { return $update_list; diff --git a/phpBB/language/en/acp/board.php b/phpBB/language/en/acp/board.php index 638e9907ac..d451bdd515 100644 --- a/phpBB/language/en/acp/board.php +++ b/phpBB/language/en/acp/board.php @@ -524,8 +524,8 @@ $lang = array_merge($lang, array( 'PASS_TYPE_SYMBOL' => 'Must contain symbols', 'REF_HOST' => 'Only validate host', 'REF_PATH' => 'Also validate path', - 'REFERER_VALID' => 'Validate Referer', - 'REFERER_VALID_EXPLAIN' => 'If enabled, the referer of POST requests will be checked against the host/script path settings. This may cause issues with boards using several domains and or external logins.', + 'REFERRER_VALID' => 'Validate Referrer', + 'REFERRER_VALID_EXPLAIN' => 'If enabled, the referrer of POST requests will be checked against the host/script path settings. This may cause issues with boards using several domains and or external logins.', 'TPL_ALLOW_PHP' => 'Allow php in templates', 'TPL_ALLOW_PHP_EXPLAIN' => 'If this option is enabled, <code>PHP</code> and <code>INCLUDEPHP</code> statements will be recognised and parsed in templates.', )); diff --git a/phpBB/language/en/acp/common.php b/phpBB/language/en/acp/common.php index 8470014161..b374e39367 100644 --- a/phpBB/language/en/acp/common.php +++ b/phpBB/language/en/acp/common.php @@ -702,7 +702,7 @@ $lang = array_merge($lang, array( 'LOG_REASON_REMOVED' => '<strong>Removed report/denial reason</strong><br />» %s', 'LOG_REASON_UPDATED' => '<strong>Updated report/denial reason</strong><br />» %s', - 'LOG_REFERER_INVALID' => '<strong>Referer validation failed</strong><br />»Referer was “<em>%1$s</em>”. The request was rejected and the session killed.', + 'LOG_REFERER_INVALID' => '<strong>Referrer validation failed</strong><br />»Referrer was “<em>%1$s</em>”. The request was rejected and the session killed.', 'LOG_RESET_DATE' => '<strong>Board start date reset</strong>', 'LOG_RESET_ONLINE' => '<strong>Most users online reset</strong>', 'LOG_RESYNC_FILES_STATS' => '<strong>File statistics resynchronised</strong>', diff --git a/phpBB/language/en/install.php b/phpBB/language/en/install.php index 2b7f377f5b..39e4a42611 100644 --- a/phpBB/language/en/install.php +++ b/phpBB/language/en/install.php @@ -427,6 +427,8 @@ $lang = array_merge($lang, array( 'FILE_USED' => 'Information used from', // Single file 'FILES_CONFLICT' => 'Conflict files', 'FILES_CONFLICT_EXPLAIN' => 'The following files are modified and do not represent the original files from the old version. phpBB determined that these files create conflicts if they are tried to be merged. Please investigate the conflicts and try to manually resolve them or continue the update choosing the preferred merging method. If you resolve the conflicts manually check the files again after you modified them. You are also able to choose between the preferred merge method for every file. The first one will result in a file where the conflicting lines from your old file will be lost, the other one will result in losing the changes from the newer file.', + 'FILES_DELETED' => 'Deleted files', + 'FILES_DELETED_EXPLAIN' => 'The following files do not exist in the new version. These files have to be deleted from your installation.', 'FILES_MODIFIED' => 'Modified files', 'FILES_MODIFIED_EXPLAIN' => 'The following files are modified and do not represent the original files from the old version. The updated file will be a merge between your modifications and the new file.', 'FILES_NEW' => 'New files', @@ -497,6 +499,7 @@ $lang = array_merge($lang, array( 'SELECT_DOWNLOAD_FORMAT' => 'Select download archive format', 'SELECT_FTP_SETTINGS' => 'Select FTP settings', 'SHOW_DIFF_CONFLICT' => 'Show differences/conflicts', + 'SHOW_DIFF_DELETED' => 'Show file contents', 'SHOW_DIFF_FINAL' => 'Show resulting file', 'SHOW_DIFF_MODIFIED' => 'Show merged differences', 'SHOW_DIFF_NEW' => 'Show file contents', @@ -510,6 +513,7 @@ $lang = array_merge($lang, array( 'STAGE_UPDATE_FILES' => 'Update files', 'STAGE_VERSION_CHECK' => 'Version check', 'STATUS_CONFLICT' => 'Modified file producing conflicts', + 'STATUS_DELETED' => 'Deleted file', 'STATUS_MODIFIED' => 'Modified file', 'STATUS_NEW' => 'New file', 'STATUS_NEW_CONFLICT' => 'Conflicting new file', diff --git a/phpBB/phpbb/console/command/extension/enable.php b/phpBB/phpbb/console/command/extension/enable.php index 0cdf26d4db..05e1d927c6 100644 --- a/phpBB/phpbb/console/command/extension/enable.php +++ b/phpBB/phpbb/console/command/extension/enable.php @@ -39,7 +39,7 @@ class enable extends command if ($this->manager->enabled($name)) { - $this->log->add('admin', ANONYMOUS, '', 'LOG_EXTENSION_ENABLE', time(), array($name)); + $this->log->add('admin', ANONYMOUS, '', 'LOG_EXT_ENABLE', time(), array($name)); $output->writeln("<info>Successfully enabled extension $name</info>"); return 0; } diff --git a/phpBB/phpbb/filesystem.php b/phpBB/phpbb/filesystem.php index 683a12ab76..77517082e5 100644 --- a/phpBB/phpbb/filesystem.php +++ b/phpBB/phpbb/filesystem.php @@ -35,7 +35,7 @@ class filesystem continue; } - if ($part === '..' && !empty($filtered) && $filtered[sizeof($filtered) - 1] !== '..') + if ($part === '..' && !empty($filtered) && $filtered[sizeof($filtered) - 1] !== '.' && $filtered[sizeof($filtered) - 1] !== '..') { array_pop($filtered); } diff --git a/phpBB/phpbb/path_helper.php b/phpBB/phpbb/path_helper.php index a5314d2ce1..b592cc4460 100644 --- a/phpBB/phpbb/path_helper.php +++ b/phpBB/phpbb/path_helper.php @@ -98,7 +98,7 @@ class path_helper { $path = substr($path, strlen($this->phpbb_root_path)); - return $this->get_web_root_path() . $path; + return $this->filesystem->clean_path($this->get_web_root_path() . $path); } return $path; @@ -158,7 +158,7 @@ class path_helper */ if ($path_info === '/' && preg_match('/app\.' . $this->php_ext . '\/$/', $request_uri)) { - return $this->web_root_path = $this->phpbb_root_path . '../'; + return $this->web_root_path = $this->filesystem->clean_path('./../' . $this->phpbb_root_path); } /* @@ -174,27 +174,20 @@ class path_helper $corrections = substr_count($path_info, '/'); /* - * If the script name (e.g. phpBB/app.php) exists in the - * requestUri (e.g. phpBB/app.php/foo/template), then we - * are have a non-rewritten URL. + * If the script name (e.g. phpBB/app.php) does not exists in the + * requestUri (e.g. phpBB/app.php/foo/template), then we are rewriting + * the URL. So we must reduce the slash count by 1. */ - if (strpos($request_uri, $script_name) === 0) + if (strpos($request_uri, $script_name) !== 0) { - /* - * Append ../ to the end of the phpbb_root_path as many times - * as / exists in path_info - */ - return $this->web_root_path = $this->phpbb_root_path . str_repeat('../', $corrections); + $corrections--; } - /* - * If we're here it means we're at a re-written path, so we must - * correct the relative path for web URLs. We must append ../ - * to the end of the root path as many times as / exists in path_info - * less one time (because the script, e.g. /app.php, doesn't exist in - * the URL) - */ - return $this->web_root_path = $this->phpbb_root_path . str_repeat('../', $corrections - 1); + // Prepend ../ to the phpbb_root_path as many times as / exists in path_info + $this->web_root_path = $this->filesystem->clean_path( + './' . str_repeat('../', $corrections) . $this->phpbb_root_path + ); + return $this->web_root_path; } /** diff --git a/phpBB/phpbb/profilefields/lang_helper.php b/phpBB/phpbb/profilefields/lang_helper.php index c055931181..2e353722b2 100644 --- a/phpBB/phpbb/profilefields/lang_helper.php +++ b/phpBB/phpbb/profilefields/lang_helper.php @@ -49,43 +49,50 @@ class lang_helper } /** - * Get language entries for options and store them here for later use + * Loads preview options into language entries for options + * + * @param int $field_id + * @param int $lang_id + * @param mixed $preview_options */ - public function get_option_lang($field_id, $lang_id, $field_type, $preview_options) + public function load_preview_options($field_id, $lang_id, $preview_options) { - if ($preview_options !== false) - { - $lang_options = (!is_array($preview_options)) ? explode("\n", $preview_options) : $preview_options; + $lang_options = (!is_array($preview_options)) ? explode("\n", $preview_options) : $preview_options; - foreach ($lang_options as $num => $var) + foreach ($lang_options as $num => $var) + { + if (!isset($this->options_lang[$field_id])) + { + $this->options_lang[$field_id] = array(); + } + if (!isset($this->options_lang[$field_id][$lang_id])) { - if (!isset($this->options_lang[$field_id])) - { - $this->options_lang[$field_id] = array(); - } - if (!isset($this->options_lang[$field_id][$lang_id])) - { - $this->options_lang[$field_id][$lang_id] = array(); - } - $this->options_lang[$field_id][$lang_id][($num + 1)] = $var; + $this->options_lang[$field_id][$lang_id] = array(); } + $this->options_lang[$field_id][$lang_id][($num + 1)] = $var; } - else - { - $sql = 'SELECT option_id, lang_value + } + + /** + * Fetches language entries for options from DB + * + * @param int $lang_id + */ + public function load_option_lang($lang_id) + { + $sql = 'SELECT field_id, option_id, lang_value FROM ' . $this->language_table . ' - WHERE field_id = ' . (int) $field_id . ' - AND lang_id = ' . (int) $lang_id . " - AND field_type = '" . $this->db->sql_escape($field_type) . "' + WHERE lang_id = ' . (int) $lang_id . " ORDER BY option_id"; - $result = $this->db->sql_query($sql); - while ($row = $this->db->sql_fetchrow($result)) - { - $this->options_lang[$field_id][$lang_id][($row['option_id'] + 1)] = $row['lang_value']; - } - $this->db->sql_freeresult($result); + $result = $this->db->sql_query($sql); + + while ($row = $this->db->sql_fetchrow($result)) + { + $this->options_lang[$row['field_id']][$lang_id][($row['option_id'] + 1)] = $row['lang_value']; } + + $this->db->sql_freeresult($result); } /** diff --git a/phpBB/phpbb/profilefields/type/type_bool.php b/phpBB/phpbb/profilefields/type/type_bool.php index eb8d3e47d6..f67e58ee3a 100644 --- a/phpBB/phpbb/profilefields/type/type_bool.php +++ b/phpBB/phpbb/profilefields/type/type_bool.php @@ -155,7 +155,7 @@ class type_bool extends type_base if (!$this->lang_helper->is_set($field_id, $lang_id)) { - $this->lang_helper->get_option_lang($field_id, $lang_id, FIELD_BOOL, false); + $this->lang_helper->load_option_lang($lang_id); } if (!$field_value && $field_data['field_show_novalue']) @@ -203,7 +203,14 @@ class type_bool extends type_base { if (!$this->lang_helper->is_set($profile_row['field_id'], $profile_row['lang_id'], 1)) { - $this->lang_helper->get_option_lang($profile_row['field_id'], $profile_row['lang_id'], $this->get_service_name(), $preview_options); + if ($preview_options) + { + $this->lang_helper->load_preview_options($profile_row['field_id'], $profile_row['lang_id'], $preview_options); + } + else + { + $this->lang_helper->load_option_lang($profile_row['lang_id']); + } } $options = $this->lang_helper->get($profile_row['field_id'], $profile_row['lang_id']); diff --git a/phpBB/phpbb/profilefields/type/type_dropdown.php b/phpBB/phpbb/profilefields/type/type_dropdown.php index 52c9fcf86a..118ddf1f37 100644 --- a/phpBB/phpbb/profilefields/type/type_dropdown.php +++ b/phpBB/phpbb/profilefields/type/type_dropdown.php @@ -135,7 +135,7 @@ class type_dropdown extends type_base // retrieve option lang data if necessary if (!$this->lang_helper->is_set($field_data['field_id'], $field_data['lang_id'], 1)) { - $this->lang_helper->get_option_lang($field_data['field_id'], $field_data['lang_id'], $this->get_service_name(), false); + $this->lang_helper->load_option_lang($field_data['lang_id']); } if (!$this->lang_helper->is_set($field_data['field_id'], $field_data['lang_id'], $field_value)) @@ -160,7 +160,7 @@ class type_dropdown extends type_base $lang_id = $field_data['lang_id']; if (!$this->lang_helper->is_set($field_id, $lang_id)) { - $this->lang_helper->get_option_lang($field_id, $lang_id, $this->get_service_name(), false); + $this->lang_helper->load_option_lang($lang_id); } if ($field_value == $field_data['field_novalue'] && !$field_data['field_show_novalue']) @@ -199,7 +199,14 @@ class type_dropdown extends type_base if (!$this->lang_helper->is_set($profile_row['field_id'], $profile_row['lang_id'], 1)) { - $this->lang_helper->get_option_lang($profile_row['field_id'], $profile_row['lang_id'], $this->get_service_name(), $preview_options); + if ($preview_options) + { + $this->lang_helper->load_preview_options($profile_row['field_id'], $profile_row['lang_id'], $preview_options); + } + else + { + $this->lang_helper->load_option_lang($profile_row['lang_id']); + } } $profile_row['field_value'] = (int) $value; diff --git a/tests/filesystem/clean_path_test.php b/tests/filesystem/clean_path_test.php index 1aef0d8a0c..c585b17155 100644 --- a/tests/filesystem/clean_path_test.php +++ b/tests/filesystem/clean_path_test.php @@ -32,6 +32,8 @@ class phpbb_filesystem_clean_path_test extends phpbb_test_case array('foo/bar/.', 'foo/bar'), array('./foo/bar', './foo/bar'), array('../foo/bar', '../foo/bar'), + array('./../foo/bar', './../foo/bar'), + array('././../foo/bar', './../foo/bar'), array('one/two/three', 'one/two/three'), array('one/two/../three', 'one/three'), array('one/../two/three', 'two/three'), diff --git a/tests/path_helper/path_helper_test.php b/tests/path_helper/path_helper_test.php index a3ad901379..9866cb6efe 100644 --- a/tests/path_helper/path_helper_test.php +++ b/tests/path_helper/path_helper_test.php @@ -13,6 +13,7 @@ class phpbb_path_helper_test extends phpbb_test_case { + /** @var \phpbb\path_helper */ protected $path_helper; protected $phpbb_root_path = ''; @@ -20,7 +21,8 @@ class phpbb_path_helper_test extends phpbb_test_case { parent::setUp(); - $this->set_phpbb_root_path(); + $filesystem = new \phpbb\filesystem(); + $this->set_phpbb_root_path($filesystem); $this->path_helper = new \phpbb\path_helper( new \phpbb\symfony_request( @@ -40,9 +42,9 @@ class phpbb_path_helper_test extends phpbb_test_case * any time we wish to use it in one of these functions (and * also in general for everything else) */ - public function set_phpbb_root_path() + public function set_phpbb_root_path($filesystem) { - $this->phpbb_root_path = dirname(__FILE__) . './../../phpBB/'; + $this->phpbb_root_path = $filesystem->clean_path(dirname(__FILE__) . '/../../phpBB/'); } public function test_get_web_root_path() @@ -53,7 +55,8 @@ class phpbb_path_helper_test extends phpbb_test_case public function basic_update_web_root_path_data() { - $this->set_phpbb_root_path(); + $filesystem = new \phpbb\filesystem(); + $this->set_phpbb_root_path($filesystem); return array( array( @@ -71,7 +74,7 @@ class phpbb_path_helper_test extends phpbb_test_case ), array( $this->phpbb_root_path . $this->phpbb_root_path . 'test.php', - $this->phpbb_root_path . $this->phpbb_root_path . 'test.php', + $filesystem->clean_path($this->phpbb_root_path . $this->phpbb_root_path . 'test.php'), ), ); } @@ -81,51 +84,55 @@ class phpbb_path_helper_test extends phpbb_test_case */ public function test_basic_update_web_root_path($input, $expected) { - $this->assertEquals($expected, $this->path_helper->update_web_root_path($input, $symfony_request)); + $this->assertEquals($expected, $this->path_helper->update_web_root_path($input)); } public function update_web_root_path_data() { - $this->set_phpbb_root_path(); + $this->set_phpbb_root_path(new \phpbb\filesystem()); return array( array( $this->phpbb_root_path . 'test.php', - $this->phpbb_root_path . 'test.php', '/', + null, + null, + '', ), array( $this->phpbb_root_path . 'test.php', - $this->phpbb_root_path . '../test.php', '//', + null, + null, + './../', ), array( $this->phpbb_root_path . 'test.php', - $this->phpbb_root_path . '../test.php', '//', 'foo/bar.php', 'bar.php', + './../', ), array( $this->phpbb_root_path . 'test.php', - $this->phpbb_root_path . '../../test.php', '/foo/template', '/phpbb3-fork/phpBB/app.php/foo/template', '/phpbb3-fork/phpBB/app.php', + './../../', ), array( $this->phpbb_root_path . 'test.php', - $this->phpbb_root_path . '../test.php', '/foo/template', '/phpbb3-fork/phpBB/foo/template', '/phpbb3-fork/phpBB/app.php', + './../', ), array( $this->phpbb_root_path . 'test.php', - $this->phpbb_root_path . '../test.php', '/', '/phpbb3-fork/phpBB/app.php/', '/phpbb3-fork/phpBB/app.php', + './../', ), ); } @@ -133,9 +140,9 @@ class phpbb_path_helper_test extends phpbb_test_case /** * @dataProvider update_web_root_path_data */ - public function test_update_web_root_path($input, $expected, $getPathInfo, $getRequestUri = null, $getScriptName = null) + public function test_update_web_root_path($input, $getPathInfo, $getRequestUri, $getScriptName, $correction) { - $symfony_request = $this->getMock("\phpbb\symfony_request", array(), array( + $symfony_request = $this->getMock('\phpbb\symfony_request', array(), array( new phpbb_mock_request(), )); $symfony_request->expects($this->any()) @@ -155,7 +162,7 @@ class phpbb_path_helper_test extends phpbb_test_case 'php' ); - $this->assertEquals($expected, $path_helper->update_web_root_path($input, $symfony_request)); + $this->assertEquals($correction . $input, $path_helper->update_web_root_path($input, $symfony_request)); } public function clean_url_data() |