Return false from wp_get_referer() and wp_get_original_referer() if called before wp_validate_redirect() is defined.

Merges [25399] and [25400] to the 3.6 branch.
see #25294.

Built from https://develop.svn.wordpress.org/branches/3.6@25401


git-svn-id: http://core.svn.wordpress.org/branches/3.6@25332 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
Andrew Nacin 2013-09-12 13:39:02 +00:00
parent 4dfa2da172
commit ee3487220b
1 changed files with 3 additions and 1 deletions

View File

@ -1295,6 +1295,8 @@ function wp_original_referer_field( $echo = true, $jump_back_to = 'current' ) {
* @return string|bool False on failure. Referer URL on success.
*/
function wp_get_referer() {
if ( ! function_exists( 'wp_validate_redirect' ) )
return false;
$ref = false;
if ( ! empty( $_REQUEST['_wp_http_referer'] ) )
$ref = wp_unslash( $_REQUEST['_wp_http_referer'] );
@ -1316,7 +1318,7 @@ function wp_get_referer() {
* @return string|bool False if no original referer or original referer if set.
*/
function wp_get_original_referer() {
if ( !empty( $_REQUEST['_wp_original_http_referer'] ) )
if ( ! empty( $_REQUEST['_wp_original_http_referer'] ) && function_exists( 'wp_validate_redirect' ) )
return wp_validate_redirect( wp_unslash( $_REQUEST['_wp_original_http_referer'] ), false );
return false;
}