Skip to content

Commit d764f1d

Browse files
bjoern-tantauBjörn Tantau
andauthored
Fix #77372: Retain full path of files for directory uploads (#6917)
To fix https://bugs.php.net/bug.php?id=77372 and improve support of `<input type="file" name="files" multiple webkitdirectory>` I introduced another item to the `$_FILES` array called `full_path`, containing the full filename, as supplied by the user-agent. Co-authored-by: Björn Tantau <[email protected]>
1 parent 21422e8 commit d764f1d

26 files changed

+238
-49
lines changed

ext/session/tests/rfc1867.phpt

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -54,9 +54,11 @@ string(%d) "rfc1867"
5454
bool(true)
5555
array(2) {
5656
["file1"]=>
57-
array(5) {
57+
array(6) {
5858
["name"]=>
5959
string(9) "file1.txt"
60+
["full_path"]=>
61+
string(9) "file1.txt"
6062
["type"]=>
6163
string(0) ""
6264
["tmp_name"]=>
@@ -67,9 +69,11 @@ array(2) {
6769
int(1)
6870
}
6971
["file2"]=>
70-
array(5) {
72+
array(6) {
7173
["name"]=>
7274
string(9) "file2.txt"
75+
["full_path"]=>
76+
string(9) "file2.txt"
7377
["type"]=>
7478
string(0) ""
7579
["tmp_name"]=>

ext/session/tests/rfc1867_cleanup.phpt

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -54,9 +54,11 @@ string(%d) "rfc1867-cleanup"
5454
bool(true)
5555
array(2) {
5656
["file1"]=>
57-
array(5) {
57+
array(6) {
5858
["name"]=>
5959
string(9) "file1.txt"
60+
["full_path"]=>
61+
string(9) "file1.txt"
6062
["type"]=>
6163
string(0) ""
6264
["tmp_name"]=>
@@ -67,9 +69,11 @@ array(2) {
6769
int(1)
6870
}
6971
["file2"]=>
70-
array(5) {
72+
array(6) {
7173
["name"]=>
7274
string(9) "file2.txt"
75+
["full_path"]=>
76+
string(9) "file2.txt"
7377
["type"]=>
7478
string(0) ""
7579
["tmp_name"]=>

ext/session/tests/rfc1867_disabled.phpt

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -47,9 +47,11 @@ session_destroy();
4747
string(%d) "rfc1867-disabled"
4848
array(2) {
4949
["file1"]=>
50-
array(5) {
50+
array(6) {
5151
["name"]=>
5252
string(9) "file1.txt"
53+
["full_path"]=>
54+
string(9) "file1.txt"
5355
["type"]=>
5456
string(0) ""
5557
["tmp_name"]=>
@@ -60,9 +62,11 @@ array(2) {
6062
int(1)
6163
}
6264
["file2"]=>
63-
array(5) {
65+
array(6) {
6466
["name"]=>
6567
string(9) "file2.txt"
68+
["full_path"]=>
69+
string(9) "file2.txt"
6670
["type"]=>
6771
string(0) ""
6872
["tmp_name"]=>

ext/session/tests/rfc1867_disabled_2.phpt

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -47,9 +47,11 @@ session_destroy();
4747
string(%d) "rfc1867-disabled-2"
4848
array(2) {
4949
["file1"]=>
50-
array(5) {
50+
array(6) {
5151
["name"]=>
5252
string(9) "file1.txt"
53+
["full_path"]=>
54+
string(9) "file1.txt"
5355
["type"]=>
5456
string(0) ""
5557
["tmp_name"]=>
@@ -60,9 +62,11 @@ array(2) {
6062
int(1)
6163
}
6264
["file2"]=>
63-
array(5) {
65+
array(6) {
6466
["name"]=>
6567
string(9) "file2.txt"
68+
["full_path"]=>
69+
string(9) "file2.txt"
6670
["type"]=>
6771
string(0) ""
6872
["tmp_name"]=>

ext/session/tests/rfc1867_inter.phpt

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -57,9 +57,11 @@ session_destroy();
5757
string(%d) "rfc1867-inter"
5858
array(2) {
5959
["file1"]=>
60-
array(5) {
60+
array(6) {
6161
["name"]=>
6262
string(9) "file1.txt"
63+
["full_path"]=>
64+
string(9) "file1.txt"
6365
["type"]=>
6466
string(0) ""
6567
["tmp_name"]=>
@@ -70,9 +72,11 @@ array(2) {
7072
int(1)
7173
}
7274
["file2"]=>
73-
array(5) {
75+
array(6) {
7476
["name"]=>
7577
string(9) "file2.txt"
78+
["full_path"]=>
79+
string(9) "file2.txt"
7680
["type"]=>
7781
string(0) ""
7882
["tmp_name"]=>

ext/session/tests/rfc1867_no_name.phpt

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -47,9 +47,11 @@ session_destroy();
4747
string(%d) "rfc1867-no-name"
4848
array(2) {
4949
["file1"]=>
50-
array(5) {
50+
array(6) {
5151
["name"]=>
5252
string(9) "file1.txt"
53+
["full_path"]=>
54+
string(9) "file1.txt"
5355
["type"]=>
5456
string(0) ""
5557
["tmp_name"]=>
@@ -60,9 +62,11 @@ array(2) {
6062
int(1)
6163
}
6264
["file2"]=>
63-
array(5) {
65+
array(6) {
6466
["name"]=>
6567
string(9) "file2.txt"
68+
["full_path"]=>
69+
string(9) "file2.txt"
6670
["type"]=>
6771
string(0) ""
6872
["tmp_name"]=>

ext/session/tests/rfc1867_sid_cookie.phpt

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -53,9 +53,11 @@ string(%d) "rfc1867-sid-cookie"
5353
bool(true)
5454
array(2) {
5555
["file1"]=>
56-
array(5) {
56+
array(6) {
5757
["name"]=>
5858
string(9) "file1.txt"
59+
["full_path"]=>
60+
string(9) "file1.txt"
5961
["type"]=>
6062
string(0) ""
6163
["tmp_name"]=>
@@ -66,9 +68,11 @@ array(2) {
6668
int(1)
6769
}
6870
["file2"]=>
69-
array(5) {
71+
array(6) {
7072
["name"]=>
7173
string(9) "file2.txt"
74+
["full_path"]=>
75+
string(9) "file2.txt"
7276
["type"]=>
7377
string(0) ""
7478
["tmp_name"]=>

ext/session/tests/rfc1867_sid_get.phpt

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -51,9 +51,11 @@ string(%d) "rfc1867-sid-get"
5151
bool(true)
5252
array(2) {
5353
["file1"]=>
54-
array(5) {
54+
array(6) {
5555
["name"]=>
5656
string(9) "file1.txt"
57+
["full_path"]=>
58+
string(9) "file1.txt"
5759
["type"]=>
5860
string(0) ""
5961
["tmp_name"]=>
@@ -64,9 +66,11 @@ array(2) {
6466
int(1)
6567
}
6668
["file2"]=>
67-
array(5) {
69+
array(6) {
6870
["name"]=>
6971
string(9) "file2.txt"
72+
["full_path"]=>
73+
string(9) "file2.txt"
7074
["type"]=>
7175
string(0) ""
7276
["tmp_name"]=>

ext/session/tests/rfc1867_sid_get_2.phpt

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -53,9 +53,11 @@ string(%d) "rfc1867-sid-get-2"
5353
bool(true)
5454
array(2) {
5555
["file1"]=>
56-
array(5) {
56+
array(6) {
5757
["name"]=>
5858
string(9) "file1.txt"
59+
["full_path"]=>
60+
string(9) "file1.txt"
5961
["type"]=>
6062
string(0) ""
6163
["tmp_name"]=>
@@ -66,9 +68,11 @@ array(2) {
6668
int(1)
6769
}
6870
["file2"]=>
69-
array(5) {
71+
array(6) {
7072
["name"]=>
7173
string(9) "file2.txt"
74+
["full_path"]=>
75+
string(9) "file2.txt"
7276
["type"]=>
7377
string(0) ""
7478
["tmp_name"]=>

ext/session/tests/rfc1867_sid_invalid.phpt

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -65,9 +65,11 @@ string(%d) ""
6565
bool(true)
6666
array(2) {
6767
["file1"]=>
68-
array(5) {
68+
array(6) {
6969
["name"]=>
7070
string(9) "file1.txt"
71+
["full_path"]=>
72+
string(9) "file1.txt"
7173
["type"]=>
7274
string(0) ""
7375
["tmp_name"]=>
@@ -78,9 +80,11 @@ array(2) {
7880
int(1)
7981
}
8082
["file2"]=>
81-
array(5) {
83+
array(6) {
8284
["name"]=>
8385
string(9) "file2.txt"
86+
["full_path"]=>
87+
string(9) "file2.txt"
8488
["type"]=>
8589
string(0) ""
8690
["tmp_name"]=>

0 commit comments

Comments
 (0)