From edf79f67057687bd346705370779fa71a850edad Mon Sep 17 00:00:00 2001 From: Lauri Eskola Date: Sat, 29 Jul 2023 16:33:50 +0300 Subject: [PATCH] Issue #3376572 by Lendude, fnalb2, cilefen, longwave: SortPluginBase.php / validateExposeForm: spelling mistake in character class --- core/modules/views/src/Plugin/views/sort/SortPluginBase.php | 2 +- .../views_ui/tests/src/Functional/ExposedFormUITest.php | 5 ++++- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/core/modules/views/src/Plugin/views/sort/SortPluginBase.php b/core/modules/views/src/Plugin/views/sort/SortPluginBase.php index fcac77e013e..bd6cad5a163 100644 --- a/core/modules/views/src/Plugin/views/sort/SortPluginBase.php +++ b/core/modules/views/src/Plugin/views/sort/SortPluginBase.php @@ -230,7 +230,7 @@ abstract class SortPluginBase extends HandlerBase implements CacheableDependency 'expose', 'field_identifier', ]); - if (!preg_match('/^[a-zA-z][a-zA-Z0-9_~.\-]*$/', $field_identifier)) { + if (!preg_match('/^[a-zA-Z][a-zA-Z0-9_~.\-]*$/', $field_identifier)) { $form_state->setErrorByName('expose][field_identifier', $this->t('This identifier has illegal characters.')); return; } diff --git a/core/modules/views_ui/tests/src/Functional/ExposedFormUITest.php b/core/modules/views_ui/tests/src/Functional/ExposedFormUITest.php index 0e805d64265..c717f6ed5c5 100644 --- a/core/modules/views_ui/tests/src/Functional/ExposedFormUITest.php +++ b/core/modules/views_ui/tests/src/Functional/ExposedFormUITest.php @@ -150,10 +150,13 @@ class ExposedFormUITest extends UITestBase { $this->submitForm($edit, 'Apply'); $this->assertSession()->pageTextContains('Sort field identifier field is required.'); - // Try with an invalid identifier. + // Try with an invalid identifiers. $edit['options[expose][field_identifier]'] = 'abc&! ###08.'; $this->submitForm($edit, 'Apply'); $this->assertSession()->pageTextContains('This identifier has illegal characters.'); + $edit['options[expose][field_identifier]'] = '^abcde'; + $this->submitForm($edit, 'Apply'); + $this->assertSession()->pageTextContains('This identifier has illegal characters.'); // Use a valid identifier. $edit['options[expose][field_identifier]'] = $this->randomMachineName() . '_-~.';