Skip to content

Conversation

btry
Copy link
Collaborator

@btry btry commented Aug 21, 2017

see #506 : need more power for admins with regex validation.

@btry btry added this to the 2.6.0 milestone Aug 21, 2017
@btry btry self-assigned this Aug 21, 2017
@btry btry requested a review from orthagh August 21, 2017 09:10
@btry btry force-pushed the feature/506_more_regex_power branch 3 times, most recently from 9dab34b to 9043027 Compare August 21, 2017 09:34
@btry btry force-pushed the feature/506_more_regex_power branch from 9043027 to d266059 Compare August 21, 2017 09:45

if (!$isValid) {
// The regex is invalid (likely not updated yet)
$updatedRegex = addslashes('/^' . $row['regex'] . '$/');
Copy link
Contributor

Choose a reason for hiding this comment

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

according to this part https://github.com/pluginsGLPI/formcreator/pull/701/files#diff-bc7cf4201f52932596eb92080c6e915aL406
it seems the previous behavior was a little bit more complex.
We can have these case:

  • no prefix
  • prefix /
  • prefix /^

same with suffix.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

When an admin adds a regex validation, the previous behavior is to detect if the regex has delimiters and anchors. If one of them was missing, then the plugin added them automatically before saving.

So, thee regexes in DB in versions up to 2.5.x always start with "/^" and ends "$/".

Actually, your comment makes me realize this upgrade code is useless. I need to remove it.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

By the way, as the upgrade becomes empty, I can revert the upgrade code I took from an other PR. This will avoid useless merge conflicts

Copy link
Contributor

Choose a reason for hiding this comment

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

ok let me know when i need to recheck

@btry btry requested a review from orthagh August 22, 2017 07:20
@btry btry merged commit 3813fc3 into pluginsGLPI:develop Aug 22, 2017
@btry btry deleted the feature/506_more_regex_power branch August 22, 2017 09:35
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants