8000 Bugfix: add UTF-8 support to Input regex validation by r-vanstraaten · Pull Request #11033 · pimcore/pimcore · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

Bugfix: add UTF-8 support to Input regex validation #11033

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged

Conversation

r-vanstraaten
Copy link
Contributor

Regex validation in dataobjects currently does not support UTF-8, making unicode regex validation impossible.
Added 'u' modifier to checkValidity method to resolve.

Steps to reproduce:

  • Add regex validation to Dataobject field with Unicode (Example "a-zA-Z\x{00C0}-\x{024F}0-9" to support diacritics)
  • Attempting to save object should result in the following exception: Exception: ErrorException: Warning: preg_match(): Compilation failed: character code point value in \x{} or \o{} is too large

Changes in this pull request

Resolves #

Additional info

@CLAassistant
Copy link
CLAassistant commented Dec 15, 2021

CLA assistant check
All committers have signed the CLA.

@dvesh3 dvesh3 added the Bug label Dec 15, 2021
@dvesh3 dvesh3 added this to the 10.2.7 milestone Dec 15, 2021
@dvesh3
Copy link
Contributor
dvesh3 commented Dec 15, 2021

@r-vanstraaten thanks for your PR! since this is a bugfix, please rebase it on branch 10.2.

Regex validation in dataobjects currently does not support UTF-8, making unicode regex validation impossible.
Added u modifier to checkValidity method to resolve.
@r-vanstraaten r-vanstraaten force-pushed the fix/inputRegexValidationUTF8Support branch from 69e62df to 4656fe7 Compare December 15, 2021 16:19
@dvesh3 dvesh3 changed the base branch from 10.x to 10.2 December 15, 2021 16:21
@r-vanstraaten
Copy link
Contributor Author

@dvesh3 I believe that should have fixed it, apologies for the incorrect branch initially!

dvesh3
dvesh3 previously requested changes Dec 16, 2021
Copy link
Contributor
@dvesh3 dvesh3 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please add unicode flag to input.js:
https://github.com/DivanteLtd/pimcore/blob/93d49b761457c8016047d6506dfa45e91974610a/bundles/AdminBundle/Resources/public/js/pimcore/object/tags/input.js#L99

otherwise it will highlight the field with validation message even when the value is correct.

@r-vanstraaten
Copy link
Contributor Author
r-vanstraaten commented Dec 17, 2021

@dvesh3
Are you sure? I've tested it locally myself and asked a colleague to check, neither of us are getting validation errors/highlights/flashes. Tested with save without publish and direct save & publish, I've been unable to reproduce any validation messages.
Tested in Firefox, Chrome and Brave browser.
Screenshots of a test field below:
image
image
image

@dvesh3 dvesh3 dismissed their stale review December 17, 2021 10:04

Not valid

@dvesh3 dvesh3 merged commit 2481209 into pimcore:10.2 Dec 17, 2021
@dvesh3
Copy link
Contributor
dvesh3 commented Dec 17, 2021

@r-vanstraaten thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants
0