From 8750ed2ea11c2b16aec1dd90901f3cbae978e527 Mon Sep 17 00:00:00 2001 From: ryan Date: Sun, 13 Jul 2008 05:16:54 +0000 Subject: [PATCH] Workaround PHP parse_url() bug. Props azaozz. fixes #7288 git-svn-id: http://svn.automattic.com/wordpress/trunk@8324 1a063a9b-81f0-0310-95a4-ce76da25c4cd --- wp-includes/pluggable.php | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/wp-includes/pluggable.php b/wp-includes/pluggable.php index 514cc7246..b5a0c4f10 100644 --- a/wp-includes/pluggable.php +++ b/wp-includes/pluggable.php @@ -827,7 +827,10 @@ function wp_safe_redirect($location, $status = 302) { if ( substr($location, 0, 2) == '//' ) $location = 'http:' . $location; - $lp = parse_url($location); + // In php 5 parse_url may fail if the URL query part contains http://, bug #38143 + $test = ( $cut = strpos($location, '?') ) ? substr( $location, 0, $cut ) : $location; + + $lp = parse_url($test); $wpp = parse_url(get_option('home')); $allowed_hosts = (array) apply_filters('allowed_redirect_hosts', array($wpp['host']), isset($lp['host']) ? $lp['host'] : '');