Bug #78136 [Opn->Dup]: False warnings may occur with open_basedir.
Edit report at https://bugs.php.net/bug.php?id=78136&edit=1
ID: 78136
Updated by: requinix@php.net
Reported by: ramsydx at gmail dot com
Summary: False warnings may occur with open_basedir.
-Status: Open
+Status: Duplicate
Type: Bug
Package: *General Issues
PHP Version: 7.3.6
Block user comment: N
Private report: N
New Comment:
Duplicate of bug #52065
Previous Comments:
------------------------------------------------------------------------
[2019-06-10 05:12:09] 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
------------------------------------------------------------------------
--
Edit this bug report at https://bugs.php.net/bug.php?id=78136&edit=1
Thread (2 messages)