- π«π·France just_like_good_vibes PARIS
Hello, i wonder if, like me, other people are needing this?
it would be great to continue the work.
Let's say you want to include some Unicode character points in your pattern.
$form['my_element'] = array(
'#title' => t('My cool field'),
'#type' => 'text',
'#pattern' => '[\u00C0-\u00D6]',
);
If you go use the form and type in "ΓΓ" and submit the form. The JS validation passes so the submission goes through but then on the server side, a PHP warning gets raised from FormElement::validatePattern() and the validation fails there.
preg_match(): Compilation failed: PCRE does not support \L, \l, \N{name}, \U, or \u at offset NN in Drupal\Core\Render\Element\FormElement::validatePattern() (line 143 of core/lib/Drupal/Core/Render/Element/FormElement.php).
See #4:
\Drupal\Core\Render\Element\FormElement::validatePattern()
seems to indicate that it should be okay:
// The pattern must match the entire string and should have the same
// behavior as the RegExp object in ECMA 262.
Both ECMA 262 and PCRE allow you craft a regex to target specific Unicode items, but they differ (\uhhhh and \x{hhhh} respectively), so if you use a #pattern that passes for one of them, it will fail for the other.
Needs work
11.0 π₯
forms system
The change is currently missing an automated test that fails when run with the original code, and succeeds when the bug has been fixed.
Not all content is available!
It's likely this issue predates Contrib.social: some issue and comment data are missing.
Hello, i wonder if, like me, other people are needing this?
it would be great to continue the work.