Skip to content

Commit

Permalink
Fix issue #11582
Browse files Browse the repository at this point in the history
In `url()` method, looks for `isset($url['_ssl'])` first, so that `_ssl` changes are only made if `$url['_full']` is not met. Then, looks for the string `:///` and replaces it with `://`. Has been tested with all combinations of `$url['_ssl']`, `$url['_full']`, and whether or not `App.fullBaseUrl` has been set.
  • Loading branch information
ericadeefox committed Dec 29, 2017
1 parent 8fc1a55 commit 63aaf06
Showing 1 changed file with 11 additions and 4 deletions.
15 changes: 11 additions & 4 deletions src/Routing/Router.php
Expand Up @@ -617,6 +617,12 @@ public static function url($url = null, $full = false)
return $output;
}
if (is_array($url)) {
if (isset($url['_ssl'])) {
if (!isset($url['_full'])) {
$url['_scheme'] = ($url['_ssl'] === true) ? 'https' : 'http';
}
unset($url['_ssl']);
}
if (isset($url['_full']) && $url['_full'] === true) {
$full = true;
unset($url['_full']);
Expand All @@ -625,10 +631,6 @@ public static function url($url = null, $full = false)
$frag = '#' . $url['#'];
unset($url['#']);
}
if (isset($url['_ssl'])) {
$url['_scheme'] = ($url['_ssl'] === true) ? 'https' : 'http';
unset($url['_ssl']);
}

$url = static::_applyUrlFilters($url);

Expand Down Expand Up @@ -679,6 +681,11 @@ public static function url($url = null, $full = false)
}
}

$protocolError = preg_match('#^[a-z][a-z0-9+\-.]*\:///#i', $output);
if ($protocolError === 1) {
$output = str_replace(':///', '://', $output);
}

return $output . $frag;
}

Expand Down

0 comments on commit 63aaf06

Please sign in to comment.