xref: /PHP-7.2/tests/basic/bug55500.phpt (revision 5af586be)
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(5) {
40    ["name"]=>
41    array(1) {
42      [0]=>
43      string(9) "file1.txt"
44    }
45    ["type"]=>
46    array(1) {
47      [0]=>
48      string(16) "text/plain-file1"
49    }
50    ["tmp_name"]=>
51    array(1) {
52      [0]=>
53      string(%d) "%s"
54    }
55    ["error"]=>
56    array(1) {
57      [0]=>
58      int(0)
59    }
60    ["size"]=>
61    array(1) {
62      [0]=>
63      int(1)
64    }
65  }
66}
67array(0) {
68}
69