Skip to content
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

Fixed regex to allow matching namespaces in ClassName #61

Open
wants to merge 1 commit into
base: 2.0
Choose a base branch
from

Conversation

t3hn0
Copy link

@t3hn0 t3hn0 commented Feb 24, 2021

Missing backslashes in regex prevented CONSTRAINTS to be updated after they were initially created.

Looks like #56 is affected by the same issue so I won't open new issue.

@@ -390,7 +390,7 @@ protected function alterTableAlterColumn($tableName, $colName, $colSpec)
// First, we split the column specifications into parts
// TODO: this returns an empty array for the following string: int(11) not null auto_increment
// on second thoughts, why is an auto_increment field being passed through?
$pattern = '/^(?<definition>[\w()]+)\s?(?<null>(?:not\s)?null)?\s?(?<default>default\s[\w\']+)?\s?(?<check>check\s?[\w()\'",\s]+)?$/i';
$pattern = '/^(?<definition>[\w()]+)\s?(?<null>(?:not\s)?null)?\s?(?<default>default\s[\w\'\\\\]+)?\s?(?<check>check\s?[\w()\'"\\\\,\s]+)?/i';
Copy link
Contributor

@tractorcow tractorcow Mar 15, 2021

Choose a reason for hiding this comment

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

What other characters could the default have? Spaces, underscore, etc? Feels like regexp is totally the wrong way to go about this hah. (isn't it normally?) :P

Maybe match word characters without quotes, but also match a quoted entity that contains everything except a quote?

Copy link
Contributor

Choose a reason for hiding this comment

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

Copy link
Contributor

Choose a reason for hiding this comment

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

May as well unit test it right? :P

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

Successfully merging this pull request may close these issues.

None yet

2 participants