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

PHP Warning: preg_match(): Unknown modifier 't' #41

Open
zeshanziya opened this issue May 14, 2024 · 4 comments
Open

PHP Warning: preg_match(): Unknown modifier 't' #41

zeshanziya opened this issue May 14, 2024 · 4 comments

Comments

@zeshanziya
Copy link
Contributor

I have noticed that when paths in ignore_patterns have a / at the end, it generates the following warning while running GrumPHP:

PHP Warning: preg_match(): Unknown modifier 't' in phar:///var/www/html/vendor/phpro/grumphp-shim/grumphp.phar/vendor/symfony/finder/Iterator/MultiplePcreFilterIterator.php on line 53

Solutions:
Fix paths for ignore_patterns in grumphp.yml.dist

zeshanziya added a commit to zeshanziya/drupal-quality-checker that referenced this issue May 14, 2024
@hussainweb
Copy link
Member

Can you share more information here? Which version of GrumPHP? What was the pattern that you had to fix? Do you have to fix it for all tools or only some of them?

@zeshanziya
Copy link
Contributor Author

zeshanziya commented May 16, 2024

I checked, and it's present in all GrumPHP versions. Yes for all tools ignore_patterns paths. Following are my observations.

So if a path starts with / and ends with / and has multiple directories, it generates a warning.

Examples:

/config/ works fine
/web/sites/default/ generates a warning
web/sites/default/ works fine
/web/sites/default works fine

image

@hussainweb
Copy link
Member

So, these patterns are always regexes. As explained in this comment, we must escape the slashes.

This means it is not a bug but we should document this better.

@hussainweb
Copy link
Member

Also, the explanation for why paths with slashes inside the string work is in this function.

hussainweb added a commit that referenced this issue May 16, 2024
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

No branches or pull requests

2 participants