Skip to content

Commit

Permalink
Workaround PHP parse_url() bug. Props azaozz. fixes #7288
Browse files Browse the repository at this point in the history
git-svn-id: http://svn.automattic.com/wordpress/trunk@8324 1a063a9b-81f0-0310-95a4-ce76da25c4cd
  • Loading branch information
ryan committed Jul 13, 2008
1 parent 4846338 commit 8750ed2
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion wp-includes/pluggable.php
Original file line number Diff line number Diff line change
Expand Up @@ -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'] : '');
Expand Down

0 comments on commit 8750ed2

Please sign in to comment.