From ef375cb66a1cddb4936974a2ca84671e3b4b2343 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bj=C3=B6rn=20Tantau?= Date: Mon, 26 Apr 2021 19:02:44 +0200 Subject: [PATCH 1/7] Retain full path of files for directory uploads To fix https://bugs.php.net/bug.php?id=77372 and improve support of `` I introduced another item to the `$_FILES` array called `fullpath`, containing the full filename, as supplied by the user-agent. --- main/rfc1867.c | 32 +++++++++++++++++++++++++++++++- 1 file changed, 31 insertions(+), 1 deletion(-) diff --git a/main/rfc1867.c b/main/rfc1867.c index 583b3166d537f..0fb9fdcd4f1ff 100644 --- a/main/rfc1867.c +++ b/main/rfc1867.c @@ -1142,9 +1142,39 @@ SAPI_API SAPI_POST_HANDLER_FUNC(rfc1867_post_handler) /* {{{ */ snprintf(lbuf, llen, "%s[name]", param); } register_http_post_files_variable(lbuf, s, &PG(http_globals)[TRACK_VARS_FILES], 0); - efree(filename); s = NULL; + /* Add $foo_fullpath */ + if (llen < strlen(param) + MAX_SIZE_OF_INDEX + 1) { + llen = (int)strlen(param); + lbuf = (char *) safe_erealloc(lbuf, llen, 1, MAX_SIZE_OF_INDEX + 1); + llen += MAX_SIZE_OF_INDEX + 1; + } + + if (is_arr_upload) { + if (abuf) efree(abuf); + abuf = estrndup(param, strlen(param)-array_len); + snprintf(lbuf, llen, "%s_fullpath[%s]", abuf, array_index); + } else { + snprintf(lbuf, llen, "%s_fullpath", param); + } + + /* Add full path of supplied file for folder uploads via + * + */ + if (!is_anonymous) { + safe_php_register_variable(lbuf, filename, strlen(filename), NULL, 0); + } + + /* Add $foo[fullname] */ + if (is_arr_upload) { + snprintf(lbuf, llen, "%s[fullpath][%s]", abuf, array_index); + } else { + snprintf(lbuf, llen, "%s[fullpath]", param); + } + register_http_post_files_variable(lbuf, filename, &PG(http_globals)[TRACK_VARS_FILES], 0); + efree(filename); + /* Possible Content-Type: */ if (cancel_upload || !(cd = php_mime_get_hdr_value(header, "Content-Type"))) { cd = ""; From 4b6aa56a1538afc6c392cd412fb8f7e2634b0724 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bj=C3=B6rn=20Tantau?= Date: Tue, 27 Apr 2021 10:07:29 +0200 Subject: [PATCH 2/7] Include fullpath in file upload tests. refs #6917 --- ext/session/tests/rfc1867.phpt | 8 ++++++-- ext/session/tests/rfc1867_cleanup.phpt | 8 ++++++-- ext/session/tests/rfc1867_disabled.phpt | 8 ++++++-- ext/session/tests/rfc1867_disabled_2.phpt | 8 ++++++-- ext/session/tests/rfc1867_inter.phpt | 8 ++++++-- ext/session/tests/rfc1867_no_name.phpt | 4 +++- ext/session/tests/rfc1867_sid_cookie.phpt | 8 ++++++-- ext/session/tests/rfc1867_sid_get.phpt | 8 ++++++-- ext/session/tests/rfc1867_sid_get_2.phpt | 8 ++++++-- ext/session/tests/rfc1867_sid_invalid.phpt | 8 ++++++-- ext/session/tests/rfc1867_sid_only_cookie.phpt | 8 ++++++-- ext/session/tests/rfc1867_sid_only_cookie_2.phpt | 8 ++++++-- ext/session/tests/rfc1867_sid_post.phpt | 8 ++++++-- sapi/cli/tests/php_cli_server_005.phpt | 4 +++- tests/basic/021.phpt | 4 +++- tests/basic/029.phpt | 4 +++- tests/basic/bug55500.phpt | 7 ++++++- tests/basic/rfc1867_anonymous_upload.phpt | 8 ++++++-- tests/basic/rfc1867_array_upload.phpt | 11 ++++++++++- tests/basic/rfc1867_empty_upload.phpt | 12 +++++++++--- tests/basic/rfc1867_max_file_size.phpt | 12 +++++++++--- .../rfc1867_max_file_uploads_empty_files.phpt | 16 ++++++++++++---- tests/basic/rfc1867_missing_boundary_2.phpt | 4 +++- tests/basic/rfc1867_post_max_filesize.phpt | 12 +++++++++--- 24 files changed, 148 insertions(+), 46 deletions(-) diff --git a/ext/session/tests/rfc1867.phpt b/ext/session/tests/rfc1867.phpt index a5ae8b22181f7..8769340958289 100644 --- a/ext/session/tests/rfc1867.phpt +++ b/ext/session/tests/rfc1867.phpt @@ -54,9 +54,11 @@ string(%d) "rfc1867" bool(true) array(2) { ["file1"]=> - array(5) { + array(6) { ["name"]=> string(9) "file1.txt" + ["fullpath"]=> + string(9) "file1.txt" ["type"]=> string(0) "" ["tmp_name"]=> @@ -67,9 +69,11 @@ array(2) { int(1) } ["file2"]=> - array(5) { + array(6) { ["name"]=> string(9) "file2.txt" + ["fullpath"]=> + string(9) "file2.txt" ["type"]=> string(0) "" ["tmp_name"]=> diff --git a/ext/session/tests/rfc1867_cleanup.phpt b/ext/session/tests/rfc1867_cleanup.phpt index 9baa6144ba688..8cb616fdc3603 100644 --- a/ext/session/tests/rfc1867_cleanup.phpt +++ b/ext/session/tests/rfc1867_cleanup.phpt @@ -54,9 +54,11 @@ string(%d) "rfc1867-cleanup" bool(true) array(2) { ["file1"]=> - array(5) { + array(6) { ["name"]=> string(9) "file1.txt" + ["fullpath"]=> + string(9) "file1.txt" ["type"]=> string(0) "" ["tmp_name"]=> @@ -67,9 +69,11 @@ array(2) { int(1) } ["file2"]=> - array(5) { + array(6) { ["name"]=> string(9) "file2.txt" + ["fullpath"]=> + string(9) "file2.txt" ["type"]=> string(0) "" ["tmp_name"]=> diff --git a/ext/session/tests/rfc1867_disabled.phpt b/ext/session/tests/rfc1867_disabled.phpt index 8d8effd1f42ca..20ed74d31d67c 100644 --- a/ext/session/tests/rfc1867_disabled.phpt +++ b/ext/session/tests/rfc1867_disabled.phpt @@ -47,9 +47,11 @@ session_destroy(); string(%d) "rfc1867-disabled" array(2) { ["file1"]=> - array(5) { + array(6) { ["name"]=> string(9) "file1.txt" + ["fullpath"]=> + string(9) "file1.txt" ["type"]=> string(0) "" ["tmp_name"]=> @@ -60,9 +62,11 @@ array(2) { int(1) } ["file2"]=> - array(5) { + array(6) { ["name"]=> string(9) "file2.txt" + ["fullpath"]=> + string(9) "file2.txt" ["type"]=> string(0) "" ["tmp_name"]=> diff --git a/ext/session/tests/rfc1867_disabled_2.phpt b/ext/session/tests/rfc1867_disabled_2.phpt index c539c6eaeae4e..ce03c06524e60 100644 --- a/ext/session/tests/rfc1867_disabled_2.phpt +++ b/ext/session/tests/rfc1867_disabled_2.phpt @@ -47,9 +47,11 @@ session_destroy(); string(%d) "rfc1867-disabled-2" array(2) { ["file1"]=> - array(5) { + array(6) { ["name"]=> string(9) "file1.txt" + ["fullpath"]=> + string(9) "file1.txt" ["type"]=> string(0) "" ["tmp_name"]=> @@ -60,9 +62,11 @@ array(2) { int(1) } ["file2"]=> - array(5) { + array(6) { ["name"]=> string(9) "file2.txt" + ["fullpath"]=> + string(9) "file2.txt" ["type"]=> string(0) "" ["tmp_name"]=> diff --git a/ext/session/tests/rfc1867_inter.phpt b/ext/session/tests/rfc1867_inter.phpt index fd28dfe07a30c..0911e7765a990 100644 --- a/ext/session/tests/rfc1867_inter.phpt +++ b/ext/session/tests/rfc1867_inter.phpt @@ -57,9 +57,11 @@ session_destroy(); string(%d) "rfc1867-inter" array(2) { ["file1"]=> - array(5) { + array(6) { ["name"]=> string(9) "file1.txt" + ["fullpath"]=> + string(9) "file1.txt" ["type"]=> string(0) "" ["tmp_name"]=> @@ -70,9 +72,11 @@ array(2) { int(1) } ["file2"]=> - array(5) { + array(6) { ["name"]=> string(9) "file2.txt" + ["fullpath"]=> + string(9) "file2.txt" ["type"]=> string(0) "" ["tmp_name"]=> diff --git a/ext/session/tests/rfc1867_no_name.phpt b/ext/session/tests/rfc1867_no_name.phpt index 15877a664e644..8de2073424a4d 100644 --- a/ext/session/tests/rfc1867_no_name.phpt +++ b/ext/session/tests/rfc1867_no_name.phpt @@ -47,9 +47,11 @@ session_destroy(); string(%d) "rfc1867-no-name" array(2) { ["file1"]=> - array(5) { + array(6) { ["name"]=> string(9) "file1.txt" + ["fullpath"]=> + string(9) "file1.txt" ["type"]=> string(0) "" ["tmp_name"]=> diff --git a/ext/session/tests/rfc1867_sid_cookie.phpt b/ext/session/tests/rfc1867_sid_cookie.phpt index 85c28934f440b..a0ba86e27b917 100644 --- a/ext/session/tests/rfc1867_sid_cookie.phpt +++ b/ext/session/tests/rfc1867_sid_cookie.phpt @@ -53,9 +53,11 @@ string(%d) "rfc1867-sid-cookie" bool(true) array(2) { ["file1"]=> - array(5) { + array(6) { ["name"]=> string(9) "file1.txt" + ["fullpath"]=> + string(9) "file1.txt" ["type"]=> string(0) "" ["tmp_name"]=> @@ -66,9 +68,11 @@ array(2) { int(1) } ["file2"]=> - array(5) { + array(6) { ["name"]=> string(9) "file2.txt" + ["fullpath"]=> + string(9) "file2.txt" ["type"]=> string(0) "" ["tmp_name"]=> diff --git a/ext/session/tests/rfc1867_sid_get.phpt b/ext/session/tests/rfc1867_sid_get.phpt index dfb192cb47cb0..de23dfaf3ebe3 100644 --- a/ext/session/tests/rfc1867_sid_get.phpt +++ b/ext/session/tests/rfc1867_sid_get.phpt @@ -51,9 +51,11 @@ string(%d) "rfc1867-sid-get" bool(true) array(2) { ["file1"]=> - array(5) { + array(6) { ["name"]=> string(9) "file1.txt" + ["fullpath"]=> + string(9) "file1.txt" ["type"]=> string(0) "" ["tmp_name"]=> @@ -64,9 +66,11 @@ array(2) { int(1) } ["file2"]=> - array(5) { + array(6) { ["name"]=> string(9) "file2.txt" + ["fullpath"]=> + string(9) "file2.txt" ["type"]=> string(0) "" ["tmp_name"]=> diff --git a/ext/session/tests/rfc1867_sid_get_2.phpt b/ext/session/tests/rfc1867_sid_get_2.phpt index 33e4489cc8bd8..318612cd86a6a 100644 --- a/ext/session/tests/rfc1867_sid_get_2.phpt +++ b/ext/session/tests/rfc1867_sid_get_2.phpt @@ -53,9 +53,11 @@ string(%d) "rfc1867-sid-get-2" bool(true) array(2) { ["file1"]=> - array(5) { + array(6) { ["name"]=> string(9) "file1.txt" + ["fullpath"]=> + string(9) "file1.txt" ["type"]=> string(0) "" ["tmp_name"]=> @@ -66,9 +68,11 @@ array(2) { int(1) } ["file2"]=> - array(5) { + array(6) { ["name"]=> string(9) "file2.txt" + ["fullpath"]=> + string(9) "file2.txt" ["type"]=> string(0) "" ["tmp_name"]=> diff --git a/ext/session/tests/rfc1867_sid_invalid.phpt b/ext/session/tests/rfc1867_sid_invalid.phpt index 4d8372c538149..d1ee725c3a2f6 100644 --- a/ext/session/tests/rfc1867_sid_invalid.phpt +++ b/ext/session/tests/rfc1867_sid_invalid.phpt @@ -65,9 +65,11 @@ string(%d) "" bool(true) array(2) { ["file1"]=> - array(5) { + array(6) { ["name"]=> string(9) "file1.txt" + ["fullpath"]=> + string(9) "file1.txt" ["type"]=> string(0) "" ["tmp_name"]=> @@ -78,9 +80,11 @@ array(2) { int(1) } ["file2"]=> - array(5) { + array(6) { ["name"]=> string(9) "file2.txt" + ["fullpath"]=> + string(9) "file2.txt" ["type"]=> string(0) "" ["tmp_name"]=> diff --git a/ext/session/tests/rfc1867_sid_only_cookie.phpt b/ext/session/tests/rfc1867_sid_only_cookie.phpt index 54897b91c8582..2581ab4ebc576 100644 --- a/ext/session/tests/rfc1867_sid_only_cookie.phpt +++ b/ext/session/tests/rfc1867_sid_only_cookie.phpt @@ -53,9 +53,11 @@ string(%d) "rfc1867-sid-only-cookie" bool(true) array(2) { ["file1"]=> - array(5) { + array(6) { ["name"]=> string(9) "file1.txt" + ["fullpath"]=> + string(9) "file1.txt" ["type"]=> string(0) "" ["tmp_name"]=> @@ -66,9 +68,11 @@ array(2) { int(1) } ["file2"]=> - array(5) { + array(6) { ["name"]=> string(9) "file2.txt" + ["fullpath"]=> + string(9) "file2.txt" ["type"]=> string(0) "" ["tmp_name"]=> diff --git a/ext/session/tests/rfc1867_sid_only_cookie_2.phpt b/ext/session/tests/rfc1867_sid_only_cookie_2.phpt index 3fd46148d724e..fc177a46d2451 100644 --- a/ext/session/tests/rfc1867_sid_only_cookie_2.phpt +++ b/ext/session/tests/rfc1867_sid_only_cookie_2.phpt @@ -50,9 +50,11 @@ string(%d) "%s" bool(true) array(2) { ["file1"]=> - array(5) { + array(6) { ["name"]=> string(9) "file1.txt" + ["fullpath"]=> + string(9) "file1.txt" ["type"]=> string(0) "" ["tmp_name"]=> @@ -63,9 +65,11 @@ array(2) { int(1) } ["file2"]=> - array(5) { + array(6) { ["name"]=> string(9) "file2.txt" + ["fullpath"]=> + string(9) "file2.txt" ["type"]=> string(0) "" ["tmp_name"]=> diff --git a/ext/session/tests/rfc1867_sid_post.phpt b/ext/session/tests/rfc1867_sid_post.phpt index f22f1534039dc..d06dc9fdc7cbb 100644 --- a/ext/session/tests/rfc1867_sid_post.phpt +++ b/ext/session/tests/rfc1867_sid_post.phpt @@ -49,9 +49,11 @@ string(%d) "rfc1867-sid-post" bool(true) array(2) { ["file1"]=> - array(5) { + array(6) { ["name"]=> string(9) "file1.txt" + ["fullpath"]=> + string(9) "file1.txt" ["type"]=> string(0) "" ["tmp_name"]=> @@ -62,9 +64,11 @@ array(2) { int(1) } ["file2"]=> - array(5) { + array(6) { ["name"]=> string(9) "file2.txt" + ["fullpath"]=> + string(9) "file2.txt" ["type"]=> string(0) "" ["tmp_name"]=> diff --git a/sapi/cli/tests/php_cli_server_005.phpt b/sapi/cli/tests/php_cli_server_005.phpt index 41e57881a10b9..763a18de58bae 100644 --- a/sapi/cli/tests/php_cli_server_005.phpt +++ b/sapi/cli/tests/php_cli_server_005.phpt @@ -52,9 +52,11 @@ Content-type: text/html; charset=UTF-8 array(1) { ["userfile"]=> - array(5) { + array(6) { ["name"]=> string(12) "laruence.txt" + ["fullpath"]=> + string(12) "laruence.txt" ["type"]=> string(10) "text/plain" ["tmp_name"]=> diff --git a/tests/basic/021.phpt b/tests/basic/021.phpt index eeaf58869b0b5..bb596965a8b9e 100644 --- a/tests/basic/021.phpt +++ b/tests/basic/021.phpt @@ -24,9 +24,11 @@ var_dump($_POST); --EXPECTF-- array(1) { ["pics"]=> - array(5) { + array(6) { ["name"]=> string(12) "bug37276.txt" + ["fullpath"]=> + string(12) "bug37276.txt" ["type"]=> string(10) "text/plain" ["tmp_name"]=> diff --git a/tests/basic/029.phpt b/tests/basic/029.phpt index 21d9082cffb8b..f4cd01d857327 100644 --- a/tests/basic/029.phpt +++ b/tests/basic/029.phpt @@ -32,9 +32,11 @@ var_dump($_POST); --EXPECTF-- array(1) { ["pics"]=> - array(5) { + array(6) { ["name"]=> string(9) "file1.txt" + ["fullpath"]=> + string(9) "file1.txt" ["type"]=> string(10) "text/plain" ["tmp_name"]=> diff --git a/tests/basic/bug55500.phpt b/tests/basic/bug55500.phpt index 2f9e393348aec..13c6cfadcc63c 100644 --- a/tests/basic/bug55500.phpt +++ b/tests/basic/bug55500.phpt @@ -36,12 +36,17 @@ var_dump($_POST); --EXPECTF-- array(1) { ["file"]=> - array(5) { + array(6) { ["name"]=> array(1) { [0]=> string(9) "file1.txt" } + ["fullpath"]=> + array(1) { + [0]=> + string(9) "file1.txt" + } ["type"]=> array(1) { [0]=> diff --git a/tests/basic/rfc1867_anonymous_upload.phpt b/tests/basic/rfc1867_anonymous_upload.phpt index 5650b5cd5db09..3cc6b192f1fd3 100644 --- a/tests/basic/rfc1867_anonymous_upload.phpt +++ b/tests/basic/rfc1867_anonymous_upload.phpt @@ -25,9 +25,11 @@ var_dump($_POST); --EXPECTF-- array(2) { [%d]=> - array(5) { + array(6) { ["name"]=> string(9) "file1.txt" + ["fullpath"]=> + string(9) "file1.txt" ["type"]=> string(16) "text/plain-file1" ["tmp_name"]=> @@ -38,9 +40,11 @@ array(2) { int(1) } [%d]=> - array(5) { + array(6) { ["name"]=> string(9) "file2.txt" + ["fullpath"]=> + string(9) "file2.txt" ["type"]=> string(16) "text/plain-file2" ["tmp_name"]=> diff --git a/tests/basic/rfc1867_array_upload.phpt b/tests/basic/rfc1867_array_upload.phpt index 90ed0c36e02b5..2f77598ad9ee1 100644 --- a/tests/basic/rfc1867_array_upload.phpt +++ b/tests/basic/rfc1867_array_upload.phpt @@ -30,7 +30,7 @@ var_dump($_POST); --EXPECTF-- array(1) { ["file"]=> - array(5) { + array(6) { ["name"]=> array(3) { [0]=> @@ -40,6 +40,15 @@ array(1) { [3]=> string(9) "file3.txt" } + ["fullpath"]=> + array(3) { + [0]=> + string(9) "file1.txt" + [2]=> + string(9) "file2.txt" + [3]=> + string(9) "file3.txt" + } ["type"]=> array(3) { [0]=> diff --git a/tests/basic/rfc1867_empty_upload.phpt b/tests/basic/rfc1867_empty_upload.phpt index 2b89ca8888b71..2730236e1e7eb 100644 --- a/tests/basic/rfc1867_empty_upload.phpt +++ b/tests/basic/rfc1867_empty_upload.phpt @@ -40,9 +40,11 @@ if (is_uploaded_file($_FILES["file3"]["tmp_name"])) { --EXPECTF-- array(3) { ["file1"]=> - array(5) { + array(6) { ["name"]=> string(9) "file1.txt" + ["fullpath"]=> + string(9) "file1.txt" ["type"]=> string(16) "text/plain-file1" ["tmp_name"]=> @@ -53,9 +55,11 @@ array(3) { int(1) } ["file2"]=> - array(5) { + array(6) { ["name"]=> string(0) "" + ["fullpath"]=> + string(0) "" ["type"]=> string(0) "" ["tmp_name"]=> @@ -66,9 +70,11 @@ array(3) { int(0) } ["file3"]=> - array(5) { + array(6) { ["name"]=> string(9) "file3.txt" + ["fullpath"]=> + string(9) "file3.txt" ["type"]=> string(16) "text/plain-file3" ["tmp_name"]=> diff --git a/tests/basic/rfc1867_max_file_size.phpt b/tests/basic/rfc1867_max_file_size.phpt index 8d585f750322b..4b11899c9313c 100644 --- a/tests/basic/rfc1867_max_file_size.phpt +++ b/tests/basic/rfc1867_max_file_size.phpt @@ -40,9 +40,11 @@ if (is_uploaded_file($_FILES["file3"]["tmp_name"])) { --EXPECTF-- array(3) { ["file1"]=> - array(5) { + array(6) { ["name"]=> string(9) "file1.txt" + ["fullpath"]=> + string(9) "file1.txt" ["type"]=> string(16) "text/plain-file1" ["tmp_name"]=> @@ -53,9 +55,11 @@ array(3) { int(1) } ["file2"]=> - array(5) { + array(6) { ["name"]=> string(9) "file2.txt" + ["fullpath"]=> + string(9) "file2.txt" ["type"]=> string(0) "" ["tmp_name"]=> @@ -66,9 +70,11 @@ array(3) { int(0) } ["file3"]=> - array(5) { + array(6) { ["name"]=> string(9) "file3.txt" + ["fullpath"]=> + string(20) "C:\foo\bar/file3.txt" ["type"]=> string(16) "text/plain-file3" ["tmp_name"]=> diff --git a/tests/basic/rfc1867_max_file_uploads_empty_files.phpt b/tests/basic/rfc1867_max_file_uploads_empty_files.phpt index b85ed20971989..b1435c3d5ed2d 100644 --- a/tests/basic/rfc1867_max_file_uploads_empty_files.phpt +++ b/tests/basic/rfc1867_max_file_uploads_empty_files.phpt @@ -40,9 +40,11 @@ if (is_uploaded_file($_FILES["file4"]["tmp_name"])) { --EXPECTF-- array(4) { ["file2"]=> - array(5) { + array(6) { ["name"]=> string(0) "" + ["fullpath"]=> + string(0) "" ["type"]=> string(0) "" ["tmp_name"]=> @@ -53,9 +55,11 @@ array(4) { int(0) } ["file3"]=> - array(5) { + array(6) { ["name"]=> string(0) "" + ["fullpath"]=> + string(0) "" ["type"]=> string(0) "" ["tmp_name"]=> @@ -66,9 +70,11 @@ array(4) { int(0) } ["file4"]=> - array(5) { + array(6) { ["name"]=> string(9) "file4.txt" + ["fullpath"]=> + string(9) "file4.txt" ["type"]=> string(15) "text/plain-file" ["tmp_name"]=> @@ -79,9 +85,11 @@ array(4) { int(0) } ["file1"]=> - array(5) { + array(6) { ["name"]=> string(9) "file1.txt" + ["fullpath"]=> + string(9) "file1.txt" ["type"]=> string(15) "text/plain-file" ["tmp_name"]=> diff --git a/tests/basic/rfc1867_missing_boundary_2.phpt b/tests/basic/rfc1867_missing_boundary_2.phpt index d3f93f838715c..e23169c254a9a 100644 --- a/tests/basic/rfc1867_missing_boundary_2.phpt +++ b/tests/basic/rfc1867_missing_boundary_2.phpt @@ -18,9 +18,11 @@ var_dump($_POST); --EXPECT-- array(1) { ["file1"]=> - array(5) { + array(6) { ["name"]=> string(9) "file1.txt" + ["fullpath"]=> + string(9) "file1.txt" ["type"]=> string(0) "" ["tmp_name"]=> diff --git a/tests/basic/rfc1867_post_max_filesize.phpt b/tests/basic/rfc1867_post_max_filesize.phpt index b03220e915a7b..cf5891f814d7b 100644 --- a/tests/basic/rfc1867_post_max_filesize.phpt +++ b/tests/basic/rfc1867_post_max_filesize.phpt @@ -36,9 +36,11 @@ if (is_uploaded_file($_FILES["file3"]["tmp_name"])) { --EXPECTF-- array(3) { ["file1"]=> - array(5) { + array(6) { ["name"]=> string(9) "file1.txt" + ["fullpath"]=> + string(9) "file1.txt" ["type"]=> string(16) "text/plain-file1" ["tmp_name"]=> @@ -49,9 +51,11 @@ array(3) { int(1) } ["file2"]=> - array(5) { + array(6) { ["name"]=> string(9) "file2.txt" + ["fullpath"]=> + string(9) "file2.txt" ["type"]=> string(0) "" ["tmp_name"]=> @@ -62,9 +66,11 @@ array(3) { int(0) } ["file3"]=> - array(5) { + array(6) { ["name"]=> string(9) "file3.txt" + ["fullpath"]=> + string(9) "file3.txt" ["type"]=> string(16) "text/plain-file3" ["tmp_name"]=> From 6a1940332762f80d9382d195fb61032500cfe5ce Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bj=C3=B6rn=20Tantau?= Date: Tue, 27 Apr 2021 11:12:23 +0200 Subject: [PATCH 3/7] Add fullpath to second file in test session rfc1867 no name --- ext/session/tests/rfc1867_no_name.phpt | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/ext/session/tests/rfc1867_no_name.phpt b/ext/session/tests/rfc1867_no_name.phpt index 8de2073424a4d..5d16f3f33fcab 100644 --- a/ext/session/tests/rfc1867_no_name.phpt +++ b/ext/session/tests/rfc1867_no_name.phpt @@ -62,9 +62,11 @@ array(2) { int(1) } ["file2"]=> - array(5) { + array(6) { ["name"]=> string(9) "file2.txt" + ["fullpath"]=> + string(9) "file2.txt" ["type"]=> string(0) "" ["tmp_name"]=> From 984c48999c9564d481be4dff0cdca1548cf17331 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bj=C3=B6rn=20Tantau?= Date: Tue, 27 Apr 2021 13:27:09 +0200 Subject: [PATCH 4/7] Remove is_anonymous checks, like in 61ba79df17867715b265de8b47238f96e62edf9c. --- main/rfc1867.c | 4 ---- 1 file changed, 4 deletions(-) diff --git a/main/rfc1867.c b/main/rfc1867.c index 0fb9fdcd4f1ff..ad3cefbde4ac8 100644 --- a/main/rfc1867.c +++ b/main/rfc1867.c @@ -1162,10 +1162,6 @@ SAPI_API SAPI_POST_HANDLER_FUNC(rfc1867_post_handler) /* {{{ */ /* Add full path of supplied file for folder uploads via * */ - if (!is_anonymous) { - safe_php_register_variable(lbuf, filename, strlen(filename), NULL, 0); - } - /* Add $foo[fullname] */ if (is_arr_upload) { snprintf(lbuf, llen, "%s[fullpath][%s]", abuf, array_index); From d281776e0db7909f6186cd64342502b4a5e9ec60 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bj=C3=B6rn=20Tantau?= Date: Tue, 27 Apr 2021 17:00:19 +0200 Subject: [PATCH 5/7] Remove unneeded code blocks. --- main/rfc1867.c | 15 --------------- 1 file changed, 15 deletions(-) diff --git a/main/rfc1867.c b/main/rfc1867.c index ad3cefbde4ac8..0f20203f85735 100644 --- a/main/rfc1867.c +++ b/main/rfc1867.c @@ -1144,21 +1144,6 @@ SAPI_API SAPI_POST_HANDLER_FUNC(rfc1867_post_handler) /* {{{ */ register_http_post_files_variable(lbuf, s, &PG(http_globals)[TRACK_VARS_FILES], 0); s = NULL; - /* Add $foo_fullpath */ - if (llen < strlen(param) + MAX_SIZE_OF_INDEX + 1) { - llen = (int)strlen(param); - lbuf = (char *) safe_erealloc(lbuf, llen, 1, MAX_SIZE_OF_INDEX + 1); - llen += MAX_SIZE_OF_INDEX + 1; - } - - if (is_arr_upload) { - if (abuf) efree(abuf); - abuf = estrndup(param, strlen(param)-array_len); - snprintf(lbuf, llen, "%s_fullpath[%s]", abuf, array_index); - } else { - snprintf(lbuf, llen, "%s_fullpath", param); - } - /* Add full path of supplied file for folder uploads via * */ From 47d851d9026bd7fce6f4953310d0e0487d6ebada Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bj=C3=B6rn=20Tantau?= Date: Tue, 11 May 2021 16:23:52 +0200 Subject: [PATCH 6/7] Rename $_FILES[][fullpath] to $_FILES[][full_path]. --- ext/session/tests/rfc1867.phpt | 4 ++-- ext/session/tests/rfc1867_cleanup.phpt | 4 ++-- ext/session/tests/rfc1867_disabled.phpt | 4 ++-- ext/session/tests/rfc1867_disabled_2.phpt | 4 ++-- ext/session/tests/rfc1867_inter.phpt | 4 ++-- ext/session/tests/rfc1867_no_name.phpt | 4 ++-- ext/session/tests/rfc1867_sid_cookie.phpt | 4 ++-- ext/session/tests/rfc1867_sid_get.phpt | 4 ++-- ext/session/tests/rfc1867_sid_get_2.phpt | 4 ++-- ext/session/tests/rfc1867_sid_invalid.phpt | 4 ++-- ext/session/tests/rfc1867_sid_only_cookie.phpt | 4 ++-- ext/session/tests/rfc1867_sid_only_cookie_2.phpt | 4 ++-- ext/session/tests/rfc1867_sid_post.phpt | 4 ++-- main/rfc1867.c | 8 ++++---- sapi/cli/tests/php_cli_server_005.phpt | 2 +- tests/basic/021.phpt | 2 +- tests/basic/029.phpt | 2 +- tests/basic/bug55500.phpt | 2 +- tests/basic/rfc1867_anonymous_upload.phpt | 4 ++-- tests/basic/rfc1867_array_upload.phpt | 2 +- tests/basic/rfc1867_empty_upload.phpt | 6 +++--- tests/basic/rfc1867_max_file_size.phpt | 6 +++--- tests/basic/rfc1867_max_file_uploads_empty_files.phpt | 8 ++++---- tests/basic/rfc1867_missing_boundary_2.phpt | 2 +- tests/basic/rfc1867_post_max_filesize.phpt | 6 +++--- 25 files changed, 51 insertions(+), 51 deletions(-) diff --git a/ext/session/tests/rfc1867.phpt b/ext/session/tests/rfc1867.phpt index 8769340958289..aed179d757333 100644 --- a/ext/session/tests/rfc1867.phpt +++ b/ext/session/tests/rfc1867.phpt @@ -57,7 +57,7 @@ array(2) { array(6) { ["name"]=> string(9) "file1.txt" - ["fullpath"]=> + ["full_path"]=> string(9) "file1.txt" ["type"]=> string(0) "" @@ -72,7 +72,7 @@ array(2) { array(6) { ["name"]=> string(9) "file2.txt" - ["fullpath"]=> + ["full_path"]=> string(9) "file2.txt" ["type"]=> string(0) "" diff --git a/ext/session/tests/rfc1867_cleanup.phpt b/ext/session/tests/rfc1867_cleanup.phpt index 8cb616fdc3603..9a0bf626f33ad 100644 --- a/ext/session/tests/rfc1867_cleanup.phpt +++ b/ext/session/tests/rfc1867_cleanup.phpt @@ -57,7 +57,7 @@ array(2) { array(6) { ["name"]=> string(9) "file1.txt" - ["fullpath"]=> + ["full_path"]=> string(9) "file1.txt" ["type"]=> string(0) "" @@ -72,7 +72,7 @@ array(2) { array(6) { ["name"]=> string(9) "file2.txt" - ["fullpath"]=> + ["full_path"]=> string(9) "file2.txt" ["type"]=> string(0) "" diff --git a/ext/session/tests/rfc1867_disabled.phpt b/ext/session/tests/rfc1867_disabled.phpt index 20ed74d31d67c..43c1079064d65 100644 --- a/ext/session/tests/rfc1867_disabled.phpt +++ b/ext/session/tests/rfc1867_disabled.phpt @@ -50,7 +50,7 @@ array(2) { array(6) { ["name"]=> string(9) "file1.txt" - ["fullpath"]=> + ["full_path"]=> string(9) "file1.txt" ["type"]=> string(0) "" @@ -65,7 +65,7 @@ array(2) { array(6) { ["name"]=> string(9) "file2.txt" - ["fullpath"]=> + ["full_path"]=> string(9) "file2.txt" ["type"]=> string(0) "" diff --git a/ext/session/tests/rfc1867_disabled_2.phpt b/ext/session/tests/rfc1867_disabled_2.phpt index ce03c06524e60..f2ff6ebb96424 100644 --- a/ext/session/tests/rfc1867_disabled_2.phpt +++ b/ext/session/tests/rfc1867_disabled_2.phpt @@ -50,7 +50,7 @@ array(2) { array(6) { ["name"]=> string(9) "file1.txt" - ["fullpath"]=> + ["full_path"]=> string(9) "file1.txt" ["type"]=> string(0) "" @@ -65,7 +65,7 @@ array(2) { array(6) { ["name"]=> string(9) "file2.txt" - ["fullpath"]=> + ["full_path"]=> string(9) "file2.txt" ["type"]=> string(0) "" diff --git a/ext/session/tests/rfc1867_inter.phpt b/ext/session/tests/rfc1867_inter.phpt index 0911e7765a990..db0ca00a05dcc 100644 --- a/ext/session/tests/rfc1867_inter.phpt +++ b/ext/session/tests/rfc1867_inter.phpt @@ -60,7 +60,7 @@ array(2) { array(6) { ["name"]=> string(9) "file1.txt" - ["fullpath"]=> + ["full_path"]=> string(9) "file1.txt" ["type"]=> string(0) "" @@ -75,7 +75,7 @@ array(2) { array(6) { ["name"]=> string(9) "file2.txt" - ["fullpath"]=> + ["full_path"]=> string(9) "file2.txt" ["type"]=> string(0) "" diff --git a/ext/session/tests/rfc1867_no_name.phpt b/ext/session/tests/rfc1867_no_name.phpt index 5d16f3f33fcab..b27120dc5bb33 100644 --- a/ext/session/tests/rfc1867_no_name.phpt +++ b/ext/session/tests/rfc1867_no_name.phpt @@ -50,7 +50,7 @@ array(2) { array(6) { ["name"]=> string(9) "file1.txt" - ["fullpath"]=> + ["full_path"]=> string(9) "file1.txt" ["type"]=> string(0) "" @@ -65,7 +65,7 @@ array(2) { array(6) { ["name"]=> string(9) "file2.txt" - ["fullpath"]=> + ["full_path"]=> string(9) "file2.txt" ["type"]=> string(0) "" diff --git a/ext/session/tests/rfc1867_sid_cookie.phpt b/ext/session/tests/rfc1867_sid_cookie.phpt index a0ba86e27b917..9acd8d68f808b 100644 --- a/ext/session/tests/rfc1867_sid_cookie.phpt +++ b/ext/session/tests/rfc1867_sid_cookie.phpt @@ -56,7 +56,7 @@ array(2) { array(6) { ["name"]=> string(9) "file1.txt" - ["fullpath"]=> + ["full_path"]=> string(9) "file1.txt" ["type"]=> string(0) "" @@ -71,7 +71,7 @@ array(2) { array(6) { ["name"]=> string(9) "file2.txt" - ["fullpath"]=> + ["full_path"]=> string(9) "file2.txt" ["type"]=> string(0) "" diff --git a/ext/session/tests/rfc1867_sid_get.phpt b/ext/session/tests/rfc1867_sid_get.phpt index de23dfaf3ebe3..b9dde7bb2ed01 100644 --- a/ext/session/tests/rfc1867_sid_get.phpt +++ b/ext/session/tests/rfc1867_sid_get.phpt @@ -54,7 +54,7 @@ array(2) { array(6) { ["name"]=> string(9) "file1.txt" - ["fullpath"]=> + ["full_path"]=> string(9) "file1.txt" ["type"]=> string(0) "" @@ -69,7 +69,7 @@ array(2) { array(6) { ["name"]=> string(9) "file2.txt" - ["fullpath"]=> + ["full_path"]=> string(9) "file2.txt" ["type"]=> string(0) "" diff --git a/ext/session/tests/rfc1867_sid_get_2.phpt b/ext/session/tests/rfc1867_sid_get_2.phpt index 318612cd86a6a..4f0f598a8a517 100644 --- a/ext/session/tests/rfc1867_sid_get_2.phpt +++ b/ext/session/tests/rfc1867_sid_get_2.phpt @@ -56,7 +56,7 @@ array(2) { array(6) { ["name"]=> string(9) "file1.txt" - ["fullpath"]=> + ["full_path"]=> string(9) "file1.txt" ["type"]=> string(0) "" @@ -71,7 +71,7 @@ array(2) { array(6) { ["name"]=> string(9) "file2.txt" - ["fullpath"]=> + ["full_path"]=> string(9) "file2.txt" ["type"]=> string(0) "" diff --git a/ext/session/tests/rfc1867_sid_invalid.phpt b/ext/session/tests/rfc1867_sid_invalid.phpt index d1ee725c3a2f6..23e3bdcd37cf7 100644 --- a/ext/session/tests/rfc1867_sid_invalid.phpt +++ b/ext/session/tests/rfc1867_sid_invalid.phpt @@ -68,7 +68,7 @@ array(2) { array(6) { ["name"]=> string(9) "file1.txt" - ["fullpath"]=> + ["full_path"]=> string(9) "file1.txt" ["type"]=> string(0) "" @@ -83,7 +83,7 @@ array(2) { array(6) { ["name"]=> string(9) "file2.txt" - ["fullpath"]=> + ["full_path"]=> string(9) "file2.txt" ["type"]=> string(0) "" diff --git a/ext/session/tests/rfc1867_sid_only_cookie.phpt b/ext/session/tests/rfc1867_sid_only_cookie.phpt index 2581ab4ebc576..d438068c8f661 100644 --- a/ext/session/tests/rfc1867_sid_only_cookie.phpt +++ b/ext/session/tests/rfc1867_sid_only_cookie.phpt @@ -56,7 +56,7 @@ array(2) { array(6) { ["name"]=> string(9) "file1.txt" - ["fullpath"]=> + ["full_path"]=> string(9) "file1.txt" ["type"]=> string(0) "" @@ -71,7 +71,7 @@ array(2) { array(6) { ["name"]=> string(9) "file2.txt" - ["fullpath"]=> + ["full_path"]=> string(9) "file2.txt" ["type"]=> string(0) "" diff --git a/ext/session/tests/rfc1867_sid_only_cookie_2.phpt b/ext/session/tests/rfc1867_sid_only_cookie_2.phpt index fc177a46d2451..698fc1609d36e 100644 --- a/ext/session/tests/rfc1867_sid_only_cookie_2.phpt +++ b/ext/session/tests/rfc1867_sid_only_cookie_2.phpt @@ -53,7 +53,7 @@ array(2) { array(6) { ["name"]=> string(9) "file1.txt" - ["fullpath"]=> + ["full_path"]=> string(9) "file1.txt" ["type"]=> string(0) "" @@ -68,7 +68,7 @@ array(2) { array(6) { ["name"]=> string(9) "file2.txt" - ["fullpath"]=> + ["full_path"]=> string(9) "file2.txt" ["type"]=> string(0) "" diff --git a/ext/session/tests/rfc1867_sid_post.phpt b/ext/session/tests/rfc1867_sid_post.phpt index d06dc9fdc7cbb..4ab3e6c33efb8 100644 --- a/ext/session/tests/rfc1867_sid_post.phpt +++ b/ext/session/tests/rfc1867_sid_post.phpt @@ -52,7 +52,7 @@ array(2) { array(6) { ["name"]=> string(9) "file1.txt" - ["fullpath"]=> + ["full_path"]=> string(9) "file1.txt" ["type"]=> string(0) "" @@ -67,7 +67,7 @@ array(2) { array(6) { ["name"]=> string(9) "file2.txt" - ["fullpath"]=> + ["full_path"]=> string(9) "file2.txt" ["type"]=> string(0) "" diff --git a/main/rfc1867.c b/main/rfc1867.c index 0f20203f85735..315e87b041425 100644 --- a/main/rfc1867.c +++ b/main/rfc1867.c @@ -55,7 +55,7 @@ PHPAPI int (*php_rfc1867_callback)(unsigned int event, void *event_data, void ** static void safe_php_register_variable(char *var, char *strval, size_t val_len, zval *track_vars_array, bool override_protection); /* The longest property name we use in an uploaded file array */ -#define MAX_SIZE_OF_INDEX sizeof("[tmp_name]") +#define MAX_SIZE_OF_INDEX sizeof("[full_path]") /* The longest anonymous name */ #define MAX_SIZE_ANONNAME 33 @@ -1147,11 +1147,11 @@ SAPI_API SAPI_POST_HANDLER_FUNC(rfc1867_post_handler) /* {{{ */ /* Add full path of supplied file for folder uploads via * */ - /* Add $foo[fullname] */ + /* Add $foo[full_path] */ if (is_arr_upload) { - snprintf(lbuf, llen, "%s[fullpath][%s]", abuf, array_index); + snprintf(lbuf, llen, "%s[full_path][%s]", abuf, array_index); } else { - snprintf(lbuf, llen, "%s[fullpath]", param); + snprintf(lbuf, llen, "%s[full_path]", param); } register_http_post_files_variable(lbuf, filename, &PG(http_globals)[TRACK_VARS_FILES], 0); efree(filename); diff --git a/sapi/cli/tests/php_cli_server_005.phpt b/sapi/cli/tests/php_cli_server_005.phpt index 763a18de58bae..339f25424499b 100644 --- a/sapi/cli/tests/php_cli_server_005.phpt +++ b/sapi/cli/tests/php_cli_server_005.phpt @@ -55,7 +55,7 @@ array(1) { array(6) { ["name"]=> string(12) "laruence.txt" - ["fullpath"]=> + ["full_path"]=> string(12) "laruence.txt" ["type"]=> string(10) "text/plain" diff --git a/tests/basic/021.phpt b/tests/basic/021.phpt index bb596965a8b9e..37e853e58ac70 100644 --- a/tests/basic/021.phpt +++ b/tests/basic/021.phpt @@ -27,7 +27,7 @@ array(1) { array(6) { ["name"]=> string(12) "bug37276.txt" - ["fullpath"]=> + ["full_path"]=> string(12) "bug37276.txt" ["type"]=> string(10) "text/plain" diff --git a/tests/basic/029.phpt b/tests/basic/029.phpt index f4cd01d857327..d720cbc6ba9a0 100644 --- a/tests/basic/029.phpt +++ b/tests/basic/029.phpt @@ -35,7 +35,7 @@ array(1) { array(6) { ["name"]=> string(9) "file1.txt" - ["fullpath"]=> + ["full_path"]=> string(9) "file1.txt" ["type"]=> string(10) "text/plain" diff --git a/tests/basic/bug55500.phpt b/tests/basic/bug55500.phpt index 13c6cfadcc63c..4f2387e0f184e 100644 --- a/tests/basic/bug55500.phpt +++ b/tests/basic/bug55500.phpt @@ -42,7 +42,7 @@ array(1) { [0]=> string(9) "file1.txt" } - ["fullpath"]=> + ["full_path"]=> array(1) { [0]=> string(9) "file1.txt" diff --git a/tests/basic/rfc1867_anonymous_upload.phpt b/tests/basic/rfc1867_anonymous_upload.phpt index 3cc6b192f1fd3..923ee3e258d1c 100644 --- a/tests/basic/rfc1867_anonymous_upload.phpt +++ b/tests/basic/rfc1867_anonymous_upload.phpt @@ -28,7 +28,7 @@ array(2) { array(6) { ["name"]=> string(9) "file1.txt" - ["fullpath"]=> + ["full_path"]=> string(9) "file1.txt" ["type"]=> string(16) "text/plain-file1" @@ -43,7 +43,7 @@ array(2) { array(6) { ["name"]=> string(9) "file2.txt" - ["fullpath"]=> + ["full_path"]=> string(9) "file2.txt" ["type"]=> string(16) "text/plain-file2" diff --git a/tests/basic/rfc1867_array_upload.phpt b/tests/basic/rfc1867_array_upload.phpt index 2f77598ad9ee1..9f48e59913c50 100644 --- a/tests/basic/rfc1867_array_upload.phpt +++ b/tests/basic/rfc1867_array_upload.phpt @@ -40,7 +40,7 @@ array(1) { [3]=> string(9) "file3.txt" } - ["fullpath"]=> + ["full_path"]=> array(3) { [0]=> string(9) "file1.txt" diff --git a/tests/basic/rfc1867_empty_upload.phpt b/tests/basic/rfc1867_empty_upload.phpt index 2730236e1e7eb..c8a96955be905 100644 --- a/tests/basic/rfc1867_empty_upload.phpt +++ b/tests/basic/rfc1867_empty_upload.phpt @@ -43,7 +43,7 @@ array(3) { array(6) { ["name"]=> string(9) "file1.txt" - ["fullpath"]=> + ["full_path"]=> string(9) "file1.txt" ["type"]=> string(16) "text/plain-file1" @@ -58,7 +58,7 @@ array(3) { array(6) { ["name"]=> string(0) "" - ["fullpath"]=> + ["full_path"]=> string(0) "" ["type"]=> string(0) "" @@ -73,7 +73,7 @@ array(3) { array(6) { ["name"]=> string(9) "file3.txt" - ["fullpath"]=> + ["full_path"]=> string(9) "file3.txt" ["type"]=> string(16) "text/plain-file3" diff --git a/tests/basic/rfc1867_max_file_size.phpt b/tests/basic/rfc1867_max_file_size.phpt index 4b11899c9313c..81133e30a2dec 100644 --- a/tests/basic/rfc1867_max_file_size.phpt +++ b/tests/basic/rfc1867_max_file_size.phpt @@ -43,7 +43,7 @@ array(3) { array(6) { ["name"]=> string(9) "file1.txt" - ["fullpath"]=> + ["full_path"]=> string(9) "file1.txt" ["type"]=> string(16) "text/plain-file1" @@ -58,7 +58,7 @@ array(3) { array(6) { ["name"]=> string(9) "file2.txt" - ["fullpath"]=> + ["full_path"]=> string(9) "file2.txt" ["type"]=> string(0) "" @@ -73,7 +73,7 @@ array(3) { array(6) { ["name"]=> string(9) "file3.txt" - ["fullpath"]=> + ["full_path"]=> string(20) "C:\foo\bar/file3.txt" ["type"]=> string(16) "text/plain-file3" diff --git a/tests/basic/rfc1867_max_file_uploads_empty_files.phpt b/tests/basic/rfc1867_max_file_uploads_empty_files.phpt index b1435c3d5ed2d..e95b8454d1337 100644 --- a/tests/basic/rfc1867_max_file_uploads_empty_files.phpt +++ b/tests/basic/rfc1867_max_file_uploads_empty_files.phpt @@ -43,7 +43,7 @@ array(4) { array(6) { ["name"]=> string(0) "" - ["fullpath"]=> + ["full_path"]=> string(0) "" ["type"]=> string(0) "" @@ -58,7 +58,7 @@ array(4) { array(6) { ["name"]=> string(0) "" - ["fullpath"]=> + ["full_path"]=> string(0) "" ["type"]=> string(0) "" @@ -73,7 +73,7 @@ array(4) { array(6) { ["name"]=> string(9) "file4.txt" - ["fullpath"]=> + ["full_path"]=> string(9) "file4.txt" ["type"]=> string(15) "text/plain-file" @@ -88,7 +88,7 @@ array(4) { array(6) { ["name"]=> string(9) "file1.txt" - ["fullpath"]=> + ["full_path"]=> string(9) "file1.txt" ["type"]=> string(15) "text/plain-file" diff --git a/tests/basic/rfc1867_missing_boundary_2.phpt b/tests/basic/rfc1867_missing_boundary_2.phpt index e23169c254a9a..7011a2d86b8dd 100644 --- a/tests/basic/rfc1867_missing_boundary_2.phpt +++ b/tests/basic/rfc1867_missing_boundary_2.phpt @@ -21,7 +21,7 @@ array(1) { array(6) { ["name"]=> string(9) "file1.txt" - ["fullpath"]=> + ["full_path"]=> string(9) "file1.txt" ["type"]=> string(0) "" diff --git a/tests/basic/rfc1867_post_max_filesize.phpt b/tests/basic/rfc1867_post_max_filesize.phpt index cf5891f814d7b..f8e99e574fd08 100644 --- a/tests/basic/rfc1867_post_max_filesize.phpt +++ b/tests/basic/rfc1867_post_max_filesize.phpt @@ -39,7 +39,7 @@ array(3) { array(6) { ["name"]=> string(9) "file1.txt" - ["fullpath"]=> + ["full_path"]=> string(9) "file1.txt" ["type"]=> string(16) "text/plain-file1" @@ -54,7 +54,7 @@ array(3) { array(6) { ["name"]=> string(9) "file2.txt" - ["fullpath"]=> + ["full_path"]=> string(9) "file2.txt" ["type"]=> string(0) "" @@ -69,7 +69,7 @@ array(3) { array(6) { ["name"]=> string(9) "file3.txt" - ["fullpath"]=> + ["full_path"]=> string(9) "file3.txt" ["type"]=> string(16) "text/plain-file3" From b5955b2bbfbd354a7a77521b5c70ed20942a6b5f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bj=C3=B6rn=20Tantau?= Date: Tue, 11 May 2021 16:24:20 +0200 Subject: [PATCH 7/7] Add test for $_FILES[full_path]. --- .../rfc1867_multiple_webkitdirectory.phpt | 74 +++++++++++++++++++ 1 file changed, 74 insertions(+) create mode 100644 tests/basic/rfc1867_multiple_webkitdirectory.phpt diff --git a/tests/basic/rfc1867_multiple_webkitdirectory.phpt b/tests/basic/rfc1867_multiple_webkitdirectory.phpt new file mode 100644 index 0000000000000..00dc12fda6086 --- /dev/null +++ b/tests/basic/rfc1867_multiple_webkitdirectory.phpt @@ -0,0 +1,74 @@ +--TEST-- +Request #77372 (Relative file path is removed from uploaded file) +--INI-- +file_uploads=1 +upload_max_filesize=1024 +max_file_uploads=10 +--POST_RAW-- +Content-Type: multipart/form-data; boundary=---------------------------64369134225794159231042985467 +-----------------------------64369134225794159231042985467 +Content-Disposition: form-data; name="files[]"; filename="directory/subdirectory/file2.txt" +Content-Type: text/plain + +2 +-----------------------------64369134225794159231042985467 +Content-Disposition: form-data; name="files[]"; filename="directory/file1.txt" +Content-Type: text/plain + +1 +-----------------------------64369134225794159231042985467-- +--FILE-- + +--EXPECTF-- +array(1) { + ["files"]=> + array(6) { + ["name"]=> + array(2) { + [0]=> + string(9) "file2.txt" + [1]=> + string(9) "file1.txt" + } + ["full_path"]=> + array(2) { + [0]=> + string(32) "directory/subdirectory/file2.txt" + [1]=> + string(19) "directory/file1.txt" + } + ["type"]=> + array(2) { + [0]=> + string(10) "text/plain" + [1]=> + string(10) "text/plain" + } + ["tmp_name"]=> + array(2) { + [0]=> + string(%d) "%s" + [1]=> + string(%d) "%s" + } + ["error"]=> + array(2) { + [0]=> + int(0) + [1]=> + int(0) + } + ["size"]=> + array(2) { + [0]=> + int(1) + [1]=> + int(1) + } + } +} +array(0) { +}