mirror of
https://github.com/php/php-src.git
synced 2026-03-24 00:02:20 +01:00
Merge branch 'PHP-8.2'
* PHP-8.2: Propagate STREAM_DISABLE_OPEN_BASEDIR src flag to php_stream_stat_path_ex
This commit is contained in:
28
Zend/tests/gh11138.phpt
Normal file
28
Zend/tests/gh11138.phpt
Normal file
@@ -0,0 +1,28 @@
|
||||
--TEST--
|
||||
move_uploaded_file() emits open_basedir warning for source file
|
||||
--POST_RAW--
|
||||
Content-type: multipart/form-data, boundary=AaB03x
|
||||
|
||||
--AaB03x
|
||||
content-disposition: form-data; name="file"; filename="file.txt"
|
||||
Content-Type: text/plain
|
||||
|
||||
foo
|
||||
--AaB03x--
|
||||
--FILE--
|
||||
<?php
|
||||
|
||||
ini_set('open_basedir', __DIR__);
|
||||
|
||||
$destination = __DIR__ . '/gh11138.tmp';
|
||||
var_dump(move_uploaded_file($_FILES['file']['tmp_name'], $destination));
|
||||
echo file_get_contents($destination), "\n";
|
||||
|
||||
?>
|
||||
--CLEAN--
|
||||
<?php
|
||||
@unlink(__DIR__ . '/gh11138.tmp');
|
||||
?>
|
||||
--EXPECT--
|
||||
bool(true)
|
||||
foo
|
||||
@@ -1539,8 +1539,9 @@ PHPAPI int php_copy_file_ctx(const char *src, const char *dest, int src_flg, php
|
||||
php_stream *srcstream = NULL, *deststream = NULL;
|
||||
int ret = FAILURE;
|
||||
php_stream_statbuf src_s, dest_s;
|
||||
int src_stat_flags = (src_flg & STREAM_DISABLE_OPEN_BASEDIR) ? PHP_STREAM_URL_STAT_IGNORE_OPEN_BASEDIR : 0;
|
||||
|
||||
switch (php_stream_stat_path_ex(src, 0, &src_s, ctx)) {
|
||||
switch (php_stream_stat_path_ex(src, src_stat_flags, &src_s, ctx)) {
|
||||
case -1:
|
||||
/* non-statable stream */
|
||||
goto safe_to_copy;
|
||||
|
||||
Reference in New Issue
Block a user