Improve regex to match `__FILE__` and `__DIR__` magic constants by janw-me · Pull Request #5465 · wp-cli/wp-cli

Conversation

@janw-me

Copy link

Member

@janw-me janw-me commented

Nov 4, 2020

edited by schlessera

Loading

The previous didn't consider if there was only one quote character on a single line. It broke on the "// That's all, stop editing! Happy blogging." comment.
See https://regex101.com/r/9hXp5d/5 for the example.
See https://regex101.com/r/9hXp5d/7 for the fix in action.

Fixes wp-cli/extension-command#247

The previous didn't consider if there was only one quote character on a single line. It broke on the "// That's all, stop editing! Happy blogging." comment.
See https://regex101.com/r/9hXp5d/5 for the example.
See https://regex101.com/r/9hXp5d/7 for the fix in action.

@schlessera schlessera added the bug label

Nov 4, 2020

@schlessera schlessera changed the title Pattern now only checks the quotes characters on the same line. Improve regex to match __FILE__ and __DIR__ magic constants

Nov 4, 2020

@schlessera schlessera added this to the 2.5.0 milestone

Nov 5, 2020

@schlessera schlessera merged commit fea0a96 into wp-cli:master

Nov 5, 2020

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Reviewers

@schlessera schlessera schlessera approved these changes

Assignees

No one assigned

Labels

Projects

None yet

Milestone

2.5.0

Development

Successfully merging this pull request may close these issues.

Plugin and theme commands break on custom folder structures

2 participants

@janw-me @schlessera