php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #76701 open_basedir restriction when file doesn't exist
Submitted: 2018-08-03 16:09 UTC Modified: 2018-08-03 21:12 UTC
From: qtogf8 at sambull dot org Assigned:
Status: Duplicate Package: Safe Mode/open_basedir
PHP Version: 7.0.31 OS: Debian
Private report: No CVE-ID: None
 [2018-08-03 16:09 UTC] qtogf8 at sambull dot org
Description:
------------
This seems to be much the same issue as #41518. But, maybe it only occurs when exactly matching a file.

i.e. When using file_exists(), I get an error along the lines of:
PHP Warning:  file_exists(): open_basedir restriction in effect. File(/foo/somefile.php) is not within the allowed path(s): (/foo/somefile.php) in ...

Clearly, the error is wrong, when the allowed path is exactly the same as the file name. If I create the file, then the warning disappears, which proves that it is in the allowed path.


Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2018-08-03 21:12 UTC] requinix@php.net
-Status: Open +Status: Duplicate
 [2018-08-03 21:12 UTC] requinix@php.net
See bug #52065 and all the other "related to" bugs listed in its comments.

Short explanation: in some circumstances, when PHP searches for the file and can't find it, other code incorrectly assumes the failure is because of an open_basedir restriction. The easiest example of this is with the path foo/bar when foo is a file and not a directory.
 
PHP Copyright © 2001-2019 The PHP Group
All rights reserved.
Last updated: Sun Oct 20 19:01:27 2019 UTC