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

Fix exclude-from-classpath containing wildcards #60

Merged
merged 1 commit into from
Mar 20, 2018

Conversation

OndraM
Copy link
Contributor

@OndraM OndraM commented Mar 7, 2018

Hi and thanks for this great tool!

With the latest version (which adds exclude-from-classpath support), I observed an common errors like this:

Warning: preg_match(): Compilation failed: nothing to repeat at offset 1 in phar:///.../composer-require-checker.phar/src/ComposerRequireChecker/FileLocator/LocateAllFilesByExtension.php on line 29

This is because exclude-from-classpath can contain * and ** wildcards. For example in Symfony: https://github.com/symfony/symfony/blob/master/composer.json#L125 .

These * and ** sequences obviously breaks the regexp pattern used in LocateAllFilesByExtension.php and causes the mentioned error.

This PR adds regexp escaping and also supports of the actual wildcards behavior, as per Composer source code: https://github.com/composer/composer/blob/be040f8e3111b38c1e49ae5cd6b929dbf5c39045/src/Composer/Autoload/AutoloadGenerator.php#L848-L854

@OndraM OndraM force-pushed the fix-exclude-from-classmap branch from da222e3 to 8b6e849 Compare March 7, 2018 23:45
@maglnet maglnet merged commit 14ae9a8 into maglnet:master Mar 20, 2018
MidnightDesign pushed a commit to MidnightDesign/ComposerRequireChecker that referenced this pull request Sep 17, 2020
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