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
1 changed files with 9 additions and 0 deletions

View File

@ -26,6 +26,15 @@ function urljoin($base, $rel) {
$pbase = parse_url($base);
$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'] === '/') {
unset($pbase['path']);
}