Workaround PHP parse_url() bug. Props azaozz. fixes #7288

git-svn-id: https://develop.svn.wordpress.org/trunk@8324 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
Ryan Boren 2008-07-13 05:16:54 +00:00
parent 3becff10c3
commit 20611718e2
1 changed files with 4 additions and 1 deletions

View File

@ -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'] : '');