Unverified Commit d3a1192c authored by alexpott's avatar alexpott

Issue #2731333 by jhedstrom, Jo Fitzgerald, StryKaizer, Manuel Garcia,...

Issue #2731333 by jhedstrom, Jo Fitzgerald, StryKaizer, Manuel Garcia, Lendude, alexpott, larowlan: Filter identifier in exposed filters allow more characters than description states
parent 516025b3
......@@ -708,7 +708,7 @@ protected function validateIdentifier($identifier, FormStateInterface $form_stat
elseif ($identifier == 'value') {
$error = $this->t('This identifier is not allowed.');
}
elseif (preg_match('/[^a-zA-z0-9_~\.\-]/', $identifier)) {
elseif (preg_match('/[^a-zA-Z0-9_~\.\-]+/', $identifier)) {
$error = $this->t('This identifier has illegal characters.');
}
......
......@@ -109,12 +109,14 @@ public function testFilterIdentifier() {
$this->drupalPostForm($path, $edit, t('Apply'));
$this->assertText('This identifier is not allowed.');
// Set the identifier to a value with a restricted character.
$edit = [
'options[expose][identifier]' => 'value value',
];
$this->drupalPostForm($path, $edit, t('Apply'));
$this->assertText('This identifier has illegal characters.');
// Try a few restricted values for the identifier.
foreach (['value value', 'value^value'] as $identifier) {
$edit = [
'options[expose][identifier]' => $identifier,
];
$this->drupalPostForm($path, $edit, t('Apply'));
$this->assertText('This identifier has illegal characters.');
}
}
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment