Problem/Motivation
Passing a url with a whitespace at the end used to work with PathValidator, however this commit broke it.
As a consequence, sites are blowing up left and right. Browsers have no problems with such URLs, only Symfony does. Maybe there's an RFC somewhere which prescribes this ? but who cares about that.
Steps to reproduce
\Drupal::pathValidator()->getUrlIfValidWithoutAccessCheck('http://example.com/ ')
note the extra space.
Proposed resolution
Patch PathValidator to catch the trash Symfony throws.