While investigating T256831, I found that that this function fails for some relative urls just like the native parse_url().
Its documentation shows it exists to fix deficiencies of the native function (although some of these problems have been fixed in PHP since; see [[https://gerrit.wikimedia.org/r/c/mediawiki/core/+/608808|r608808]]), therefore it should work for all kind of relative urls; especially given the fact that WebRequest::getRequestURL() returns root-relative url (that will currently fail in wfParseUrl() )
```
lang=php
// Protocol-relative URLs are handled really badly by parse_url(). It's so
// bad that the easiest way to handle them is to just prepend 'http:' and
// strip the protocol out later.
$wasRelative = substr( $url, 0, 2 ) == '//';
if ( $wasRelative ) {
$url = "http:$url";
}
```
This work for protocol-relative urls, but doesn't for root-relative urls. So given Rest root-relative url, (fom T256831, for example)
```
/w/rest.php/v1/page/%E6%B1%9F%E9%A0%AD2:50/history/counts/edits.
```
wfParseUrl() will return false. This is because the function will pass it directly to parse_url() since the url will not match the $wasRelative check even though //it's relative//. The false itself is due to bug in parse_url() which this MediaWiki function implementation sought to ameliorate.