mirror of
https://github.com/gosticks/wordpress-develop.git
synced 2026-06-28 14:20:15 +00:00
Strip backslashes, not just forward slashes, from untrailingslashit().
trailingslashit() will now remove any forward or backslashes from the end of a string before appending a forward slash. props knutsp, willmot. fixes #22267. git-svn-id: https://develop.svn.wordpress.org/trunk@27344 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
@@ -21,6 +21,22 @@ class Tests_Formatting_Slashit extends WP_UnitTestCase {
|
||||
$this->assertEquals("a", untrailingslashit("a////"));
|
||||
}
|
||||
|
||||
/**
|
||||
* @ticket 22267
|
||||
*/
|
||||
function test_removes_trailing_backslashes() {
|
||||
$this->assertEquals("a", untrailingslashit("a\\"));
|
||||
$this->assertEquals("a", untrailingslashit("a\\\\\\\\"));
|
||||
}
|
||||
|
||||
/**
|
||||
* @ticket 22267
|
||||
*/
|
||||
function test_removes_trailing_mixed_slashes() {
|
||||
$this->assertEquals("a", untrailingslashit("a/\\"));
|
||||
$this->assertEquals("a", untrailingslashit("a\\/\\///\\\\//"));
|
||||
}
|
||||
|
||||
function test_adds_trailing_slash() {
|
||||
$this->assertEquals("a/", trailingslashit("a"));
|
||||
}
|
||||
@@ -28,4 +44,11 @@ class Tests_Formatting_Slashit extends WP_UnitTestCase {
|
||||
function test_does_not_add_trailing_slash_if_one_exists() {
|
||||
$this->assertEquals("a/", trailingslashit("a/"));
|
||||
}
|
||||
|
||||
/**
|
||||
* @ticket 22267
|
||||
*/
|
||||
function test_converts_trailing_backslash_to_slash_if_one_exists() {
|
||||
$this->assertEquals("a/", trailingslashit("a\\"));
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user