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

PcreException should mention which regexp is actually invalid #1406

Closed
sstok opened this issue Nov 2, 2020 · 1 comment
Closed

PcreException should mention which regexp is actually invalid #1406

sstok opened this issue Nov 2, 2020 · 1 comment

Comments

@sstok
Copy link

sstok commented Nov 2, 2020

Is your feature request related to a problem? Please describe.
When a regex in the ignoreSourceCodeByRegex is invalid this crashes the application with:

[PHP Warning:  preg_match(): Compilation failed: missing closing parenthesis at offset 58 in [...]/infection/vendor/thecodingmachine/safe/generated/pcre.php on line 590]

In PcreException.php line 19:

  [Safe\Exceptions\PcreException (1)]
  PREG_INTERNAL_ERROR: Internal error

Describe the solution you'd like
This is not very helpful because it doesn't show which regex is invalid. Making debugging rather challenging.

I'm not sure this should be resolved here or in the thecodingmachine/safe package?
Instead when this exception is thrown it should show which regexp is invalid. Even better if it's able to mention which config-line is happens at but that's just dreaming 😁

@sidz
Copy link
Member

sidz commented Nov 3, 2020

Implemented in #1412

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

No branches or pull requests

4 participants