-
Notifications
You must be signed in to change notification settings - Fork 184
Validate skip_capture Classes #126
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
Conversation
Jean85
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hello there, and thanks for the contribution!
I appreciate the fix, but I think that the current solution is a bit "harsh". Using class_exists can make the whole app fail if the string is no longer a loadable class, like if the containing package got removed/updated; I would prefer a softer approach... Any suggestion? Maybe a regex, like /^\\?\w+(\\\w+)*$/?
|
Hey, thanks for the review. I don't have any "softer" ideas for how this could be handled sorry... What brought me to add this patch was that I erroneously put in a class to match, and was looking to make this more fool-proof. For me, I'd prefer it to be as strict as possible so I was alerted of invalid configuration - but I understand if that's not the behaviour you want for this library. |
|
Well, I think that the regex should be enough, because the set of possible strings that are valid FQCN are pretty simple... Basically all the cases are:
And other 3 without the starting |
|
I guess the sense would be that if you put in a class that cannot be loaded, you probably made a mistake, crashes at container build time should be noticeable before you deploy |
|
Just a little thing to think about: I am not sure when that configuration is loaded but I assume on every request to Symfony so that could possibly add a lot of autoloading overhead. |
|
The configuration is only run at compile time, this code wouldnt be run for every request |
|
Than you can ignore my comment completely 😄 |
Yes, but that would be considered a BC; so I'm not inclined into implementing it like this in a minor/patch. |
|
Closing as stale. Feel free to reopen on top of master. |
Related to #125, adds configuration validation that the classes passed to
skip_captureexist.