diff --git a/core/lib/Drupal/Core/Database/Connection.php b/core/lib/Drupal/Core/Database/Connection.php index 3ca7de7b3aabe743f1bc684ac1337734c22db601..1ff55b14ece2d8e853ca1885a9b80a70bc9b17c3 100644 --- a/core/lib/Drupal/Core/Database/Connection.php +++ b/core/lib/Drupal/Core/Database/Connection.php @@ -726,7 +726,7 @@ public function query($query, array $args = [], $options = []) { // semicolons should only be needed for special cases like defining a // function or stored procedure in SQL. Trim any trailing delimiter to // minimize false positives unless delimiter is allowed. - $trim_chars = " \t\n\r\0\x0B"; + $trim_chars = " \xA0\t\n\r\0\x0B"; if (empty($options['allow_delimiter_in_query'])) { $trim_chars .= ';'; } diff --git a/core/tests/Drupal/Tests/Core/Database/ConnectionTest.php b/core/tests/Drupal/Tests/Core/Database/ConnectionTest.php index e91ca645f76bc2b450612d19148039da46cc83f8..d5a2dec3163c55c022d52b7bf0ec6d4d2980881f 100644 --- a/core/tests/Drupal/Tests/Core/Database/ConnectionTest.php +++ b/core/tests/Drupal/Tests/Core/Database/ConnectionTest.php @@ -607,6 +607,16 @@ public function testQueryTrim($expected, $query, $options) { */ public function provideQueriesToTrim() { return [ + 'remove_non_breaking_space' => [ + 'SELECT * FROM test', + "SELECT * FROM test\xA0", + [], + ], + 'remove_ordinary_space' => [ + 'SELECT * FROM test', + 'SELECT * FROM test ', + [], + ], 'remove_semicolon' => [ 'SELECT * FROM test', 'SELECT * FROM test;',