#111145Non-UTF-8 characters in URI path leading to NullSite Object
Description
Description
If the URI path contains percent-encoded bytes that aren’t valid UTF-8 (e.g. ISO 8859-1), TYPO3 doesn’t resolve any site, even if the host matches a site’s base. The request ends up with a NullSite Object.
Reproduce
“https://example.org/%F6” would end up on TYPO3’s generic “Page Not Found” page(Reason: No site configuration found.), instead of your configured Error-Handling, since the Site Object could’nt be resolved.
Expected behaviour
Non-UTF-8 characters in the URI path don’t influence if a site is resolved or not.
Failing Line
vendor/typo3/cms-core/Classes/Routing/SiteMatcher.php line 244
$match = $matcher->match($uri->getPath());
Possible Fix
Before matching, replace invalid UTF-8 byte sequences in the path.
$match = $matcher->match($this->sanitizePath($uri->getPath()));
protected function sanitizePath(string $path): string
{
if (mb_check_encoding(rawurldecode($path), 'UTF-8')) {
return $path;
}
return implode('/', array_map(
static fn(string $segment): string => rawurlencode(mb_scrub(rawurldecode($segment), 'UTF-8')),
explode('/', $path)
));
}Reviews 1
History 12
-
Anton Danilov changed Duplicates #106146 <span data-processor="relativetime" data-value="2026-10-19T15:05:02+00:00" > 10/19/26, 15:05 </span>
-
Gerrit Code Review pushed patch set 5 for main to change 88148 status
NewUnder Review <span data-processor="relativetime" data-value="2026-11-09T20:39:02+00:00" > 11/09/26, 20:39 </span>