PHP's parse_url() implementation, and the MediaWiki helper UrlUtils::parse() that builds on it, have various inaccuracies compared to how browsers parse weird or malformed URLs. PHP 8.5 has Uri\WhatWg\Url which follows the same specification as modern browsers, and for older versions there's a polyfill. We should replace all calls.
Codesearch: