php.net |  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
Description:
------------
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:
---------------
<?php
$dir_safe = __DIR__.'/dir.' . basename(__FILE__,'.php') . '.safe';
ini_set('open_basedir',"{$dir_safe}/");
file_put_contents("{$dir_safe}/test.txt","shall work");


Expected result:
----------------
Warning: file_put_contents(/FOO/dir.new.safe/test.txt): 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/dir.new.safe/test.txt) is not within the allowed path(s): (/FOO/dir.new.safe/) in /FOO/new.php on line 4

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

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2019-06-10 05:14 UTC] requinix@php.net
-Status: Open +Status: Duplicate
 [2019-06-10 05:14 UTC] requinix@php.net
Duplicate of bug #52065
 
PHP Copyright © 2001-2019 The PHP Group
All rights reserved.
Last updated: Wed Oct 16 04:01:26 2019 UTC