-
-
Notifications
You must be signed in to change notification settings - Fork 452
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 exception, open_basedir restriction in effect #824
Conversation
this is a *VERY* crude fix for this exception `is_file(): open_basedir restriction in effect. File([internal]) is not within the allowed path(s)`
Can you please tell us how this bug happens? Can you reproduce it locally? |
Thank you for the contribution. We already had a few cases of this issue in |
After some searching I think this is not as much an issue with sentry as it is php's file IO API. I think there are a couple of approaches we could take, but I have no clue which is most desirable.
if (!file_exixts($path) || !is_file($path) || !is_readable($path)) {
return [];
} imho the last option would be the most elegant |
I agree, with options 2 and 1 in the order of preference. I would like to stay away from parsing an INI setting complex as the |
I have had the 'patch' with |
Looking a bit on the web it seems that this error is raised even with |
The fix is probably working but it's raising some kind of warning, that is probably not configured to be reported. If |
Probably it is, even though I believe that such core functions should not generate a warning in this case but just return |
If that's the case, then we've already covered the issue elsewhere, and this PR is good as it is 👍 Apart from adding some tests, obviously 😄 |
I disagree, I think a warning is fair game, as it is erroneous behaviour. That said, PHP should then offer a mechanism to check instead. I'll try to create an isolated case from the rest of my code base and provide some server config soon. |
We didn't. If the name of the file is not available in the stacktrace frame then we set it to -if (!is_file($path) || !is_readable($path)) {
+if (!@is_readable($path) || !is_file($path)) { |
alright, |
Are you sure that the original error that was being captured by Sentry is still thrown and that the stacktrace is the expected one to reproduce the issue? Of course if there is no frame referencing the |
Well no, I resolved that issue. However I used to reproduce it with any exception, and that has become impossible. I think it is wise to keep this PR open until I have a solid reproducible case, so that, I can write a couple of test cases |
changed code according to conclusion from discussion
I can't for the life of me reproduce it, even when I roll back all of my changes, it still works normaly without errors. I tried both to directly trigger the error by manually calling So I'm at my wits end. Do we just merge this, suspend until reproducable, or totally drop it? |
Since it's such a simple change LGTM, it cannot hurt anyway to suppress an error in this specific case. Just one thing: can you please fix the build? |
The build error seems to be a dependency issue, no clue where to start, maybe you could take a gander? |
Fix should be pretty easy and should only involve changing the |
build is fixed |
Thank you for the contribution, it's highly appreciated! |
this is a VERY crude fix for this exception
is_file(): open_basedir restriction in effect. File([internal]) is not within the allowed path(s)