|  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #78136 False warnings may occur with open_basedir.
Submitted: 2019-06-10 05:12 UTC Modified: 2019-06-10 05:14 UTC
From: ramsydx at gmail dot com Assigned:
Status: Duplicate Package: *General Issues
PHP Version: 7.3.6 OS:
Private report: No CVE-ID: None
 [2019-06-10 05:12 UTC] ramsydx at gmail dot com
Even if the directory does not exist, you will get the same warning as a path that does not apply to open_basedir.

Test script:
$dir_safe = __DIR__.'/dir.' . basename(__FILE__,'.php') . '.safe';
file_put_contents("{$dir_safe}/test.txt","shall work");

Expected result:
Warning: file_put_contents(/FOO/ failed to open stream: No such file or directory in /FOO/test.php on line 4

Actual result:
Warning: file_put_contents(): open_basedir restriction in effect. File(/FOO/ is not within the allowed path(s): (/FOO/ in /FOO/new.php on line 4

Warning: file_put_contents(/FOO/ failed to open stream: Operation not permitted in /FOO/new.php on line 4


Add a Patch

Pull Requests

Add a Pull Request


AllCommentsChangesGit/SVN commitsRelated reports
 [2019-06-10 05:14 UTC]
-Status: Open +Status: Duplicate
 [2019-06-10 05:14 UTC]
Duplicate of bug #52065
PHP Copyright © 2001-2023 The PHP Group
All rights reserved.
Last updated: Mon Mar 27 11:03:36 2023 UTC