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

Option to ignore errors from stderr instead of erroring out #17

Closed
maxcohn opened this issue Sep 7, 2022 · 5 comments
Closed

Option to ignore errors from stderr instead of erroring out #17

maxcohn opened this issue Sep 7, 2022 · 5 comments

Comments

@maxcohn
Copy link

maxcohn commented Sep 7, 2022

I saw #16 and figured that maybe a configuration setting where you can specify an array of "ignore strings" that a user can supply themselves so that way it's not hard coding something like 'XDebug' or 'Warning:'. I'm running into a similar situation because my execution environment is different than my development environment.

If you're open to the idea but don't want to work on it, I can give it a go.

@SanderRonde
Copy link
Owner

I actually like the idea of making it entirely userconfigurable instead of hardcoded so I've implemented it. Should be in the next release :)

@maxcohn
Copy link
Author

maxcohn commented Sep 7, 2022

I can't get over how fast you are! I'm very grateful for your work :)

@maxcohn
Copy link
Author

maxcohn commented Sep 8, 2022

Just an idea: maybe it could support substrings so one could just specify Warning: and have all errors caught. PHP likes to throw line numbers and absolute paths in some of these errors, so small changes to the file's location or just line number the errors was on will prevent the error from being caught. Since a string is also a substring of itself, the current functionality would just be altered slightly.

For example, this

PHP Warning:  Optional parameter $numFields declared before required parameter $condensedField is implicitly treated as a required parameter

becomes this:

PHP   Optional parameter $numFields declared before required parameter $condensedField is implicitly treated as a required parameter

since there's only a find and replace happening. I believe this can be updated right here (9a53527#diff-cb9065f770e90db317f3d505d67589dc098bab45986df0aaaa32d2f192cc558eR185) to ignore the entire error instead of just removing a bit of it. Not sure if the current implementation bases the output on lines, but that would probably be necessary given this case, or you could jerryrig regex to work per line instead.

All of this is assuming this is the path you want to take here - I don't want to impose, this just something I thought would be beneficial for myself and other users of this extension.

@SanderRonde
Copy link
Owner

Thanks for the suggestion. After thinking about it I've gone for something that is pretty close to this namely regexes. That way you can just do PHP Warning: .* and be done (or in the Xdebug case Xdebug: .*). This way it also doesn't happen that errors are ignored while they shouldn't be (which will get me a lot of "the extension doesn't work" issues). It also allows for more flexibility by just making stuff like the line number a \d.

@maxcohn
Copy link
Author

maxcohn commented Sep 8, 2022

Great call, just allowing regular expressions really gives as much (or as little) power as anyone could want.

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