update php-urljoin (#867)

This commit is contained in:
fluffy 2018-10-18 07:43:39 -07:00 committed by Teromene
parent 717b0bdd9c
commit e0323f06cd

View file

@ -26,6 +26,15 @@ function urljoin($base, $rel) {
$pbase = parse_url($base); $pbase = parse_url($base);
$prel = parse_url($rel); $prel = parse_url($rel);
if ($prel === false || preg_match('/^[a-z0-9\-.]*[^a-z0-9\-.:][a-z0-9\-.]*:/i', $rel)) {
/*
Either parse_url couldn't parse this, or the original URL
fragment had an invalid scheme character before the first :,
which can confuse parse_url
*/
$prel = array('path' => $rel);
}
if (array_key_exists('path', $pbase) && $pbase['path'] === '/') { if (array_key_exists('path', $pbase) && $pbase['path'] === '/') {
unset($pbase['path']); unset($pbase['path']);
} }