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

Search for ray.php triggers warning if open_basedir restrictions are in place and ray.php is not found beneath allowed directories #73

Closed
markjaquith opened this issue Jan 8, 2021 · 5 comments

Comments

@markjaquith
Copy link

Describe the bug

If open_basedir restrictions are in effect and Ray does not find a ray.php in allowed directories, it'll keep "digging up" until its is_dir() call is made on a forbidden directory. In my case, it goes above /srv/www to call is_dir('/srv') which triggers this warning:

Warning: is_dir(): open_basedir restriction in effect. File(/srv) is not within the allowed path(s): (/srv/www/:/tmp) in /srv/www/example.com/current/web/app/themes/sage10/vendor/spatie/ray/src/Settings/SettingsFactory.php on line 35

Versions
Ray version (you can see this in "About Ray"):

1.3.2 (spatie/ray)

PHP version:

7.4.6

Laravel version (if applicable):

Not using Laravel.

To Reproduce

  1. Set open_basedir restriction
  2. Do not place a ray.php under that directory
  3. Call ray()
  4. PHP Warning triggered

Expected behavior

No warnings. ray.php is optional according to the documentation.

@freekmurze
Copy link
Member

This will be fixed in v1.3.4 of the package.

Polfo referenced this issue Jan 9, 2021
@jozydapozy
Copy link

For me this is still an issue with v1.5.6. I get this error:
[E_WARNING]: is_dir(): open_basedir restriction in effect. File(/var/www/vhosts) is not within the allowed path(s): (/var/www/vhosts/<domain>/:/tmp/)

@freekmurze
Copy link
Member

This is hard to fix without a stack trace. Also, I don't have an environment where this option is set to true.

I'd appreciate you opening a new issue for this with as much detail as you can.
If possible, also create a PR that fixes this for you.

@jozydapozy
Copy link

I've fixed this now by creating a ray.php in my doc-root containing this:

<?php
return [];

This prevents the SettingsFactory.php form looking any further.

@freekmurze
Copy link
Member

That's nice way to go about it 👍

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

3 participants