1
0
mirror of https://github.com/phpbb/phpbb.git synced 2025-07-30 21:40:43 +02:00

[ticket/11997] Add clean_url() method to path_helper

This method will get rid of unnecessary . and .. in URLs.

PHPBB3-11997
This commit is contained in:
Marc Alexander
2013-12-21 20:08:00 +01:00
parent 235d2069e0
commit d9358c26da
3 changed files with 47 additions and 1 deletions

View File

@@ -146,4 +146,27 @@ class phpbb_path_helper_web_root_path_test extends phpbb_test_case
$this->assertEquals($expected, $path_helper->update_web_root_path($input, $symfony_request));
}
public function clean_url_data()
{
return array(
array('', ''),
array('://', '://'),
array('http://', 'http://'),
array('http://one/two/three', 'http://one/two/three'),
array('http://../one/two', 'http://../one/two'),
array('http://one/../two/three', 'http://two/three'),
array('http://one/two/../three', 'http://one/three'),
array('http://one/two/../../three', 'http://three'),
array('http://one/two/../../../three', 'http://../three'),
);
}
/**
* @dataProvider clean_url_data
*/
public function test_clean_url($input, $expected)
{
$this->assertEquals($expected, $this->path_helper->clean_url($input));
}
}