diff -u b/core/lib/Drupal/Component/Utility/UrlHelper.php b/core/lib/Drupal/Component/Utility/UrlHelper.php --- b/core/lib/Drupal/Component/Utility/UrlHelper.php +++ b/core/lib/Drupal/Component/Utility/UrlHelper.php @@ -435,6 +435,10 @@ public static function parseString($string) { $result = parse_query($string); + $result = array_map(function ($value) { + return $value === null ? '' : $value; + }, $result); + $phpArrayParts = []; foreach ($result as $key => $value) { if (preg_match('/\[.*\]$/', $key)) { diff -u b/core/tests/Drupal/Tests/Component/Utility/UrlHelperTest.php b/core/tests/Drupal/Tests/Component/Utility/UrlHelperTest.php --- b/core/tests/Drupal/Tests/Component/Utility/UrlHelperTest.php +++ b/core/tests/Drupal/Tests/Component/Utility/UrlHelperTest.php @@ -623,7 +623,7 @@ */ public function testParseString($queryString, $queryArray) { $result = UrlHelper::parseString($queryString); - $this->assertEquals($queryArray, $result); + $this->assertSame($queryArray, $result); } /** @@ -635,6 +635,7 @@ */ public function providerTestParseString() { $data = [ + ['one', ['one' => '']], ['one=1', ['one' => '1']], ['one=1&two=2', ['one' => '1', 'two' => '2']], ['o%20e=1&two=2', ['o e' => '1', 'two' => '2']],