xref: /PHP-5.3/tests/basic/bug46313-win.phpt (revision 621fddab)
1--TEST--
2Bug #46313 (Magic quotes broke $_FILES)
3--SKIPIF--
4<?php if(substr(PHP_OS, 0, 3) != "WIN") die("skip Windows-only test"); ?>
5--INI--
6magic_quotes_gpc=1
7file_uploads=1
8register_globals=1
9display_errors=0
10--POST_RAW--
11Content-Type: multipart/form-data; boundary=---------------------------20896060251896012921717172737
12-----------------------------20896060251896012921717172737
13Content-Disposition: form-data; name="o1'file"; filename="o1'file.png"
14Content-Type: text/plain-file1
15
161
17-----------------------------20896060251896012921717172737
18Content-Disposition: form-data; name="o2'file"; filename="o2'file2.txt"
19Content-Type: text/plain-file2
20
212
22-----------------------------20896060251896012921717172737--
23--FILE--
24<?php
25var_dump($_FILES);
26var_dump($GLOBALS["o1\'file_name"]);
27var_dump($GLOBALS["o1\'file_name"] === $_FILES["o1\'file"]["name"]);
28var_dump($GLOBALS["o1\'file"]);
29var_dump($GLOBALS["o1\'file"] === $_FILES["o1\'file"]["tmp_name"]);
30/* The windows policy is walking to the last (single)quote in a file name and taking the remain.
31   This way some'file.gif becomes file.gif */
32?>
33--EXPECTF--
34array(2) {
35  ["o1\'file"]=>
36  array(5) {
37    ["name"]=>
38    string(8) "file.png"
39    ["type"]=>
40    string(16) "text/plain-file1"
41    ["tmp_name"]=>
42    string(%d) "%s.tmp"
43    ["error"]=>
44    int(0)
45    ["size"]=>
46    int(1)
47  }
48  ["o2\'file"]=>
49  array(5) {
50    ["name"]=>
51    string(9) "file2.txt"
52    ["type"]=>
53    string(16) "text/plain-file2"
54    ["tmp_name"]=>
55    string(%d) "%s.tmp"
56    ["error"]=>
57    int(0)
58    ["size"]=>
59    int(1)
60  }
61}
62string(8) "file.png"
63bool(true)
64string(%d) "%s"
65bool(true)
66