xref: /PHP-8.3/tests/basic/bug55500.phpt (revision d764f1dc)
1--TEST--
2Bug #55500 (Corrupted $_FILES indices lead to security concern)
3--INI--
4file_uploads=1
5error_reporting=E_ALL&~E_NOTICE
6upload_max_filesize=1024
7max_file_uploads=10
8--POST_RAW--
9Content-Type: multipart/form-data; boundary=---------------------------20896060251896012921717172737
10-----------------------------20896060251896012921717172737
11Content-Disposition: form-data; name="file[]"; filename="file1.txt"
12Content-Type: text/plain-file1
13
141
15-----------------------------20896060251896012921717172737
16Content-Disposition: form-data; name="file[[type]"; filename="file2.txt"
17Content-Type: text/plain-file2
18
192
20-----------------------------20896060251896012921717172737
21Content-Disposition: form-data; name="file[[name]"; filename="file3.txt"
22Content-Type: text/plain-file3
23
243
25-----------------------------20896060251896012921717172737
26Content-Disposition: form-data; name="file[name]["; filename="file4.txt"
27Content-Type: text/plain-file3
28
294
30-----------------------------20896060251896012921717172737--
31--FILE--
32<?php
33var_dump($_FILES);
34var_dump($_POST);
35?>
36--EXPECTF--
37array(1) {
38  ["file"]=>
39  array(6) {
40    ["name"]=>
41    array(1) {
42      [0]=>
43      string(9) "file1.txt"
44    }
45    ["full_path"]=>
46    array(1) {
47      [0]=>
48      string(9) "file1.txt"
49    }
50    ["type"]=>
51    array(1) {
52      [0]=>
53      string(16) "text/plain-file1"
54    }
55    ["tmp_name"]=>
56    array(1) {
57      [0]=>
58      string(%d) "%s"
59    }
60    ["error"]=>
61    array(1) {
62      [0]=>
63      int(0)
64    }
65    ["size"]=>
66    array(1) {
67      [0]=>
68      int(1)
69    }
70  }
71}
72array(0) {
73}
74