Skip to content

Commit f8ed24b

Browse files
committed
Security/SafeRedirect: add tests for namespaced names
1 parent 4197cea commit f8ed24b

File tree

2 files changed

+9
-0
lines changed

2 files changed

+9
-0
lines changed

WordPress/Tests/Security/SafeRedirectUnitTest.inc

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,3 +2,11 @@
22

33
wp_redirect( $location ); // Warning.
44
wp_safe_redirect( $location ); // OK.
5+
6+
/*
7+
* Safeguard correct handling of all types of namespaced function calls.
8+
*/
9+
\wp_redirect( $location );
10+
MyNamespace\wp_redirect( $location );
11+
\MyNamespace\wp_redirect( $location );
12+
namespace\wp_redirect( $location ); // The sniff should start flagging this once it can resolve relative namespaces.

WordPress/Tests/Security/SafeRedirectUnitTest.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,7 @@ public function getErrorList() {
3737
public function getWarningList() {
3838
return array(
3939
3 => 1,
40+
9 => 1,
4041
);
4142
}
4243
}

0 commit comments

Comments
 (0)