mirror of
https://github.com/php/php-src.git
synced 2025-01-26 21:54:16 +08:00
Added tests for rfc1867 post handler
This commit is contained in:
parent
38af9b5535
commit
c6ad8c3079
58
tests/basic/rfc1867_anonymous_upload.phpt
Normal file
58
tests/basic/rfc1867_anonymous_upload.phpt
Normal file
@ -0,0 +1,58 @@
|
||||
--TEST--
|
||||
rfc1867 anonymous upload
|
||||
--INI--
|
||||
file_uploads=1
|
||||
error_reporting=E_ALL&~E_NOTICE
|
||||
comment=debug builds show some additional E_NOTICE errors
|
||||
upload_max_filesize=1024
|
||||
--SKIPIF--
|
||||
<?php if (php_sapi_name()=='cli') die('skip'); ?>
|
||||
--POST_RAW--
|
||||
Content-Type: multipart/form-data; boundary=---------------------------20896060251896012921717172737
|
||||
-----------------------------20896060251896012921717172737
|
||||
Content-Disposition: form-data; filename="file1.txt"
|
||||
Content-Type: text/plain-file1
|
||||
|
||||
1
|
||||
-----------------------------20896060251896012921717172737
|
||||
Content-Disposition: form-data; filename="file2.txt"
|
||||
Content-Type: text/plain-file2
|
||||
|
||||
2
|
||||
-----------------------------20896060251896012921717172737--
|
||||
--FILE--
|
||||
<?php
|
||||
var_dump($_FILES);
|
||||
var_dump($_POST);
|
||||
?>
|
||||
--EXPECTF--
|
||||
array(2) {
|
||||
[%d]=>
|
||||
array(5) {
|
||||
[%u|b%"name"]=>
|
||||
%string|unicode%(9) "file1.txt"
|
||||
[%u|b%"type"]=>
|
||||
%string|unicode%(16) "text/plain-file1"
|
||||
[%u|b%"tmp_name"]=>
|
||||
%string|unicode%(%d) "%s"
|
||||
[%u|b%"error"]=>
|
||||
int(0)
|
||||
[%u|b%"size"]=>
|
||||
int(1)
|
||||
}
|
||||
[%d]=>
|
||||
array(5) {
|
||||
[%u|b%"name"]=>
|
||||
%string|unicode%(9) "file2.txt"
|
||||
[%u|b%"type"]=>
|
||||
%string|unicode%(16) "text/plain-file2"
|
||||
[%u|b%"tmp_name"]=>
|
||||
%string|unicode%(%d) "%s"
|
||||
[%u|b%"error"]=>
|
||||
int(0)
|
||||
[%u|b%"size"]=>
|
||||
int(1)
|
||||
}
|
||||
}
|
||||
array(0) {
|
||||
}
|
85
tests/basic/rfc1867_array_upload.phpt
Normal file
85
tests/basic/rfc1867_array_upload.phpt
Normal file
@ -0,0 +1,85 @@
|
||||
--TEST--
|
||||
rfc1867 array upload
|
||||
--INI--
|
||||
file_uploads=1
|
||||
error_reporting=E_ALL&~E_NOTICE
|
||||
comment=debug builds show some additional E_NOTICE errors
|
||||
upload_max_filesize=1024
|
||||
--SKIPIF--
|
||||
<?php if (php_sapi_name()=='cli') die('skip'); ?>
|
||||
--POST_RAW--
|
||||
Content-Type: multipart/form-data; boundary=---------------------------20896060251896012921717172737
|
||||
-----------------------------20896060251896012921717172737
|
||||
Content-Disposition: form-data; name="file[]"; filename="file1.txt"
|
||||
Content-Type: text/plain-file1
|
||||
|
||||
1
|
||||
-----------------------------20896060251896012921717172737
|
||||
Content-Disposition: form-data; name="file[2]"; filename="file2.txt"
|
||||
Content-Type: text/plain-file2
|
||||
|
||||
2
|
||||
-----------------------------20896060251896012921717172737
|
||||
Content-Disposition: form-data; name="file[]"; filename="file3.txt"
|
||||
Content-Type: text/plain-file3
|
||||
|
||||
3
|
||||
-----------------------------20896060251896012921717172737--
|
||||
--FILE--
|
||||
<?php
|
||||
var_dump($_FILES);
|
||||
var_dump($_POST);
|
||||
?>
|
||||
--EXPECTF--
|
||||
array(1) {
|
||||
[%u|b%"file"]=>
|
||||
array(5) {
|
||||
[%u|b%"name"]=>
|
||||
array(3) {
|
||||
[0]=>
|
||||
%unicode|string%(9) "file1.txt"
|
||||
[2]=>
|
||||
%unicode|string%(9) "file2.txt"
|
||||
[3]=>
|
||||
%unicode|string%(9) "file3.txt"
|
||||
}
|
||||
[%u|b%"type"]=>
|
||||
array(3) {
|
||||
[0]=>
|
||||
%unicode|string%(16) "text/plain-file1"
|
||||
[2]=>
|
||||
%unicode|string%(16) "text/plain-file2"
|
||||
[3]=>
|
||||
%unicode|string%(16) "text/plain-file3"
|
||||
}
|
||||
[%u|b%"tmp_name"]=>
|
||||
array(3) {
|
||||
[0]=>
|
||||
%unicode|string%(%d) "%s"
|
||||
[2]=>
|
||||
%unicode|string%(%d) "%s"
|
||||
[3]=>
|
||||
%unicode|string%(%d) "%s"
|
||||
}
|
||||
[%u|b%"error"]=>
|
||||
array(3) {
|
||||
[0]=>
|
||||
int(0)
|
||||
[2]=>
|
||||
int(0)
|
||||
[3]=>
|
||||
int(0)
|
||||
}
|
||||
[%u|b%"size"]=>
|
||||
array(3) {
|
||||
[0]=>
|
||||
int(1)
|
||||
[2]=>
|
||||
int(1)
|
||||
[3]=>
|
||||
int(1)
|
||||
}
|
||||
}
|
||||
}
|
||||
array(0) {
|
||||
}
|
27
tests/basic/rfc1867_boundary_1.phpt
Normal file
27
tests/basic/rfc1867_boundary_1.phpt
Normal file
@ -0,0 +1,27 @@
|
||||
--TEST--
|
||||
rfc1867 boundary 1
|
||||
--INI--
|
||||
post_max_size=1024
|
||||
error_reporting=E_ALL&~E_NOTICE
|
||||
comment=debug builds show some additional E_NOTICE errors
|
||||
--SKIPIF--
|
||||
<?php if (php_sapi_name()=='cli') die('skip'); ?>
|
||||
--POST_RAW--
|
||||
Content-Type: multipart/form-data; boundary="------------------------------------foobar"
|
||||
--------------------------------------foobar
|
||||
Content-Disposition: form-data; name="foobar"
|
||||
|
||||
1
|
||||
--------------------------------------foobar--
|
||||
--FILE--
|
||||
<?php
|
||||
var_dump($_FILES);
|
||||
var_dump($_POST);
|
||||
?>
|
||||
--EXPECTF--
|
||||
array(0) {
|
||||
}
|
||||
array(1) {
|
||||
[%u|b%"foobar"]=>
|
||||
%unicode|string%(1) "1"
|
||||
}
|
27
tests/basic/rfc1867_boundary_2.phpt
Normal file
27
tests/basic/rfc1867_boundary_2.phpt
Normal file
@ -0,0 +1,27 @@
|
||||
--TEST--
|
||||
rfc1867 boundary 2
|
||||
--INI--
|
||||
post_max_size=1024
|
||||
error_reporting=E_ALL&~E_NOTICE
|
||||
comment=debug builds show some additional E_NOTICE errors
|
||||
--SKIPIF--
|
||||
<?php if (php_sapi_name()=='cli') die('skip'); ?>
|
||||
--POST_RAW--
|
||||
Content-Type: multipart/form-data; boundary=------------------------------------foo, bar
|
||||
--------------------------------------foo
|
||||
Content-Disposition: form-data; name="foobar"
|
||||
|
||||
1
|
||||
--------------------------------------foo--
|
||||
--FILE--
|
||||
<?php
|
||||
var_dump($_FILES);
|
||||
var_dump($_POST);
|
||||
?>
|
||||
--EXPECTF--
|
||||
array(0) {
|
||||
}
|
||||
array(1) {
|
||||
[%u|b%"foobar"]=>
|
||||
%unicode|string%(1) "1"
|
||||
}
|
90
tests/basic/rfc1867_empty_upload.phpt
Normal file
90
tests/basic/rfc1867_empty_upload.phpt
Normal file
@ -0,0 +1,90 @@
|
||||
--TEST--
|
||||
rfc1867 empty upload
|
||||
--INI--
|
||||
file_uploads=1
|
||||
error_reporting=E_ALL&~E_NOTICE
|
||||
comment=debug builds show some additional E_NOTICE errors
|
||||
upload_max_filesize=1024
|
||||
--SKIPIF--
|
||||
<?php if (php_sapi_name()=='cli') die('skip'); ?>
|
||||
--POST_RAW--
|
||||
Content-Type: multipart/form-data; boundary=---------------------------20896060251896012921717172737
|
||||
-----------------------------20896060251896012921717172737
|
||||
Content-Disposition: form-data; name="foo"
|
||||
|
||||
|
||||
-----------------------------20896060251896012921717172737
|
||||
Content-Disposition: form-data; name="file1"; filename="file1.txt"
|
||||
Content-Type: text/plain-file1
|
||||
|
||||
1
|
||||
-----------------------------20896060251896012921717172737
|
||||
Content-Disposition: form-data; name="file2"; filename=""
|
||||
Content-Type: text/plain-file2
|
||||
|
||||
|
||||
-----------------------------20896060251896012921717172737
|
||||
Content-Disposition: form-data; name="file3"; filename="file3.txt"
|
||||
Content-Type: text/plain-file3
|
||||
|
||||
3
|
||||
-----------------------------20896060251896012921717172737--
|
||||
--FILE--
|
||||
<?php
|
||||
var_dump($_FILES);
|
||||
var_dump($_POST);
|
||||
if (is_uploaded_file($_FILES["file1"]["tmp_name"])) {
|
||||
var_dump(file_get_contents($_FILES["file1"]["tmp_name"]));
|
||||
}
|
||||
if (is_uploaded_file($_FILES["file3"]["tmp_name"])) {
|
||||
var_dump(file_get_contents($_FILES["file3"]["tmp_name"]));
|
||||
}
|
||||
?>
|
||||
--EXPECTF--
|
||||
array(3) {
|
||||
[%u|b%"file1"]=>
|
||||
array(5) {
|
||||
[%u|b%"name"]=>
|
||||
%string|unicode%(9) "file1.txt"
|
||||
[%u|b%"type"]=>
|
||||
%string|unicode%(16) "text/plain-file1"
|
||||
[%u|b%"tmp_name"]=>
|
||||
%string|unicode%(%d) "%s"
|
||||
[%u|b%"error"]=>
|
||||
int(0)
|
||||
[%u|b%"size"]=>
|
||||
int(1)
|
||||
}
|
||||
[%u|b%"file2"]=>
|
||||
array(5) {
|
||||
[%u|b%"name"]=>
|
||||
%string|unicode%(0) ""
|
||||
[%u|b%"type"]=>
|
||||
%string|unicode%(0) ""
|
||||
[%u|b%"tmp_name"]=>
|
||||
%string|unicode%(0) ""
|
||||
[%u|b%"error"]=>
|
||||
int(4)
|
||||
[%u|b%"size"]=>
|
||||
int(0)
|
||||
}
|
||||
[%u|b%"file3"]=>
|
||||
array(5) {
|
||||
[%u|b%"name"]=>
|
||||
%string|unicode%(9) "file3.txt"
|
||||
[%u|b%"type"]=>
|
||||
%string|unicode%(16) "text/plain-file3"
|
||||
[%u|b%"tmp_name"]=>
|
||||
%string|unicode%(%d) "%s"
|
||||
[%u|b%"error"]=>
|
||||
int(0)
|
||||
[%u|b%"size"]=>
|
||||
int(1)
|
||||
}
|
||||
}
|
||||
array(1) {
|
||||
[%u|b%"foo"]=>
|
||||
%unicode|string%(0) ""
|
||||
}
|
||||
string(1) "1"
|
||||
string(1) "3"
|
38
tests/basic/rfc1867_file_upload_disabled.phpt
Normal file
38
tests/basic/rfc1867_file_upload_disabled.phpt
Normal file
@ -0,0 +1,38 @@
|
||||
--TEST--
|
||||
rfc1867 file_upload disabled
|
||||
--INI--
|
||||
file_uploads=0
|
||||
error_reporting=E_ALL&~E_NOTICE
|
||||
comment=debug builds show some additional E_NOTICE errors
|
||||
--SKIPIF--
|
||||
<?php if (php_sapi_name()=='cli') die('skip'); ?>
|
||||
--POST_RAW--
|
||||
Content-Type: multipart/form-data; boundary=---------------------------20896060251896012921717172737
|
||||
-----------------------------20896060251896012921717172737
|
||||
Content-Disposition: form-data; name="foo"
|
||||
|
||||
bar
|
||||
-----------------------------20896060251896012921717172737
|
||||
Content-Disposition: form-data; name="file1"; filename="file1.txt"
|
||||
Content-Type: text/plain-file1
|
||||
|
||||
1
|
||||
-----------------------------20896060251896012921717172737
|
||||
Content-Disposition: form-data; name="bar"
|
||||
|
||||
foo
|
||||
-----------------------------20896060251896012921717172737--
|
||||
--FILE--
|
||||
<?php
|
||||
var_dump($_FILES);
|
||||
var_dump($_POST);
|
||||
?>
|
||||
--EXPECTF--
|
||||
array(0) {
|
||||
}
|
||||
array(2) {
|
||||
[%u|b%"foo"]=>
|
||||
%unicode|string%(3) "bar"
|
||||
[%u|b%"bar"]=>
|
||||
%unicode|string%(3) "foo"
|
||||
}
|
27
tests/basic/rfc1867_garbled_mime_headers.phpt
Normal file
27
tests/basic/rfc1867_garbled_mime_headers.phpt
Normal file
@ -0,0 +1,27 @@
|
||||
--TEST--
|
||||
rfc1867 garbled mime headers
|
||||
--INI--
|
||||
file_uploads=1
|
||||
error_reporting=E_ALL&~E_NOTICE
|
||||
comment=debug builds show some additional E_NOTICE errors
|
||||
upload_max_filesize=1024
|
||||
--SKIPIF--
|
||||
<?php if (php_sapi_name()=='cli') die('skip'); ?>
|
||||
--POST_RAW--
|
||||
Content-Type: multipart/form-data; boundary=---------------------------20896060251896012921717172737
|
||||
-----------------------------20896060251896012921717172737
|
||||
Content-Disposition: form-data
|
||||
|
||||
|
||||
-----------------------------20896060251896012921717172737--
|
||||
--FILE--
|
||||
<?php
|
||||
var_dump($_FILES);
|
||||
var_dump($_POST);
|
||||
?>
|
||||
--EXPECTF--
|
||||
Warning: File Upload Mime headers garbled in %s
|
||||
array(0) {
|
||||
}
|
||||
array(0) {
|
||||
}
|
26
tests/basic/rfc1867_invalid_boundary.phpt
Normal file
26
tests/basic/rfc1867_invalid_boundary.phpt
Normal file
@ -0,0 +1,26 @@
|
||||
--TEST--
|
||||
rfc1867 invalid boundary
|
||||
--INI--
|
||||
post_max_size=1024
|
||||
error_reporting=E_ALL&~E_NOTICE
|
||||
comment=debug builds show some additional E_NOTICE errors
|
||||
--SKIPIF--
|
||||
<?php if (php_sapi_name()=='cli') die('skip'); ?>
|
||||
--POST_RAW--
|
||||
Content-Type: multipart/form-data; boundary="foobar
|
||||
-----------------------------20896060251896012921717172737
|
||||
Content-Disposition: form-data; name="foobar"
|
||||
|
||||
1
|
||||
-----------------------------20896060251896012921717172737--
|
||||
--FILE--
|
||||
<?php
|
||||
var_dump($_FILES);
|
||||
var_dump($_POST);
|
||||
?>
|
||||
--EXPECTF--
|
||||
Warning: Invalid boundary in multipart/form-data POST data in %s
|
||||
array(0) {
|
||||
}
|
||||
array(0) {
|
||||
}
|
27
tests/basic/rfc1867_malicious_input.phpt
Normal file
27
tests/basic/rfc1867_malicious_input.phpt
Normal file
@ -0,0 +1,27 @@
|
||||
--TEST--
|
||||
rfc1867 malicious input
|
||||
--INI--
|
||||
file_uploads=1
|
||||
error_reporting=E_ALL&~E_NOTICE
|
||||
comment=debug builds show some additional E_NOTICE errors
|
||||
upload_max_filesize=1024
|
||||
--SKIPIF--
|
||||
<?php if (php_sapi_name()=='cli') die('skip'); ?>
|
||||
--POST_RAW--
|
||||
Content-Type: multipart/form-data; boundary=---------------------------20896060251896012921717172737
|
||||
-----------------------------20896060251896012921717172737
|
||||
Content-Disposition: form-data; name="foo[]bar"; filename="file1.txt"
|
||||
Content-Type: text/plain-file1
|
||||
|
||||
1
|
||||
-----------------------------20896060251896012921717172737--
|
||||
--FILE--
|
||||
<?php
|
||||
var_dump($_FILES);
|
||||
var_dump($_POST);
|
||||
?>
|
||||
--EXPECTF--
|
||||
array(0) {
|
||||
}
|
||||
array(0) {
|
||||
}
|
90
tests/basic/rfc1867_max_file_size.phpt
Normal file
90
tests/basic/rfc1867_max_file_size.phpt
Normal file
@ -0,0 +1,90 @@
|
||||
--TEST--
|
||||
rfc1867 MAX_FILE_SIZE
|
||||
--INI--
|
||||
file_uploads=1
|
||||
error_reporting=E_ALL&~E_NOTICE
|
||||
comment=debug builds show some additional E_NOTICE errors
|
||||
upload_max_filesize=1024
|
||||
--SKIPIF--
|
||||
<?php if (php_sapi_name()=='cli') die('skip'); ?>
|
||||
--POST_RAW--
|
||||
Content-Type: multipart/form-data; boundary=---------------------------20896060251896012921717172737
|
||||
-----------------------------20896060251896012921717172737
|
||||
Content-Disposition: form-data; name="MAX_FILE_SIZE"
|
||||
|
||||
1
|
||||
-----------------------------20896060251896012921717172737
|
||||
Content-Disposition: form-data; name="file1"; filename="file1.txt"
|
||||
Content-Type: text/plain-file1
|
||||
|
||||
1
|
||||
-----------------------------20896060251896012921717172737
|
||||
Content-Disposition: form-data; name="file2"; filename="file2.txt"
|
||||
Content-Type: text/plain-file2
|
||||
|
||||
22
|
||||
-----------------------------20896060251896012921717172737
|
||||
Content-Disposition: form-data; name="file3"; filename="C:\foo\bar/file3.txt"
|
||||
Content-Type: text/plain-file3;
|
||||
|
||||
3
|
||||
-----------------------------20896060251896012921717172737--
|
||||
--FILE--
|
||||
<?php
|
||||
var_dump($_FILES);
|
||||
var_dump($_POST);
|
||||
if (is_uploaded_file($_FILES["file1"]["tmp_name"])) {
|
||||
var_dump(file_get_contents($_FILES["file1"]["tmp_name"]));
|
||||
}
|
||||
if (is_uploaded_file($_FILES["file3"]["tmp_name"])) {
|
||||
var_dump(file_get_contents($_FILES["file3"]["tmp_name"]));
|
||||
}
|
||||
?>
|
||||
--EXPECTF--
|
||||
array(3) {
|
||||
[%u|b%"file1"]=>
|
||||
array(5) {
|
||||
[%u|b%"name"]=>
|
||||
%string|unicode%(9) "file1.txt"
|
||||
[%u|b%"type"]=>
|
||||
%string|unicode%(16) "text/plain-file1"
|
||||
[%u|b%"tmp_name"]=>
|
||||
%string|unicode%(%d) "%s"
|
||||
[%u|b%"error"]=>
|
||||
int(0)
|
||||
[%u|b%"size"]=>
|
||||
int(1)
|
||||
}
|
||||
[%u|b%"file2"]=>
|
||||
array(5) {
|
||||
[%u|b%"name"]=>
|
||||
%string|unicode%(9) "file2.txt"
|
||||
[%u|b%"type"]=>
|
||||
%string|unicode%(0) ""
|
||||
[%u|b%"tmp_name"]=>
|
||||
%string|unicode%(0) ""
|
||||
[%u|b%"error"]=>
|
||||
int(2)
|
||||
[%u|b%"size"]=>
|
||||
int(0)
|
||||
}
|
||||
[%u|b%"file3"]=>
|
||||
array(5) {
|
||||
[%u|b%"name"]=>
|
||||
%string|unicode%(9) "file3.txt"
|
||||
[%u|b%"type"]=>
|
||||
%string|unicode%(16) "text/plain-file3"
|
||||
[%u|b%"tmp_name"]=>
|
||||
%string|unicode%(%d) "%s"
|
||||
[%u|b%"error"]=>
|
||||
int(0)
|
||||
[%u|b%"size"]=>
|
||||
int(1)
|
||||
}
|
||||
}
|
||||
array(1) {
|
||||
[%u|b%"MAX_FILE_SIZE"]=>
|
||||
%string|unicode%(1) "1"
|
||||
}
|
||||
string(1) "1"
|
||||
string(1) "3"
|
26
tests/basic/rfc1867_missing_boundary.phpt
Normal file
26
tests/basic/rfc1867_missing_boundary.phpt
Normal file
@ -0,0 +1,26 @@
|
||||
--TEST--
|
||||
rfc1867 missing boundary
|
||||
--INI--
|
||||
post_max_size=1024
|
||||
error_reporting=E_ALL&~E_NOTICE
|
||||
comment=debug builds show some additional E_NOTICE errors
|
||||
--SKIPIF--
|
||||
<?php if (php_sapi_name()=='cli') die('skip'); ?>
|
||||
--POST_RAW--
|
||||
Content-Type: multipart/form-data
|
||||
-----------------------------20896060251896012921717172737
|
||||
Content-Disposition: form-data; name="foobar"
|
||||
|
||||
1
|
||||
-----------------------------20896060251896012921717172737--
|
||||
--FILE--
|
||||
<?php
|
||||
var_dump($_FILES);
|
||||
var_dump($_POST);
|
||||
?>
|
||||
--EXPECTF--
|
||||
Warning: Missing boundary in multipart/form-data POST data in %s
|
||||
array(0) {
|
||||
}
|
||||
array(0) {
|
||||
}
|
39
tests/basic/rfc1867_missing_boundary_2.phpt
Normal file
39
tests/basic/rfc1867_missing_boundary_2.phpt
Normal file
@ -0,0 +1,39 @@
|
||||
--TEST--
|
||||
rfc1867 missing boundary 2
|
||||
--INI--
|
||||
file_uploads=1
|
||||
error_reporting=E_ALL&~E_NOTICE
|
||||
comment=debug builds show some additional E_NOTICE errors
|
||||
upload_max_filesize=1024
|
||||
--SKIPIF--
|
||||
<?php if (php_sapi_name()=='cli') die('skip'); ?>
|
||||
--POST_RAW--
|
||||
Content-Type: multipart/form-data; boundary=---------------------------20896060251896012921717172737
|
||||
-----------------------------20896060251896012921717172737
|
||||
Content-Disposition: form-data; name="file1"; filename="file1.txt"
|
||||
Content-Type: text/plain-file1
|
||||
|
||||
1
|
||||
--FILE--
|
||||
<?php
|
||||
var_dump($_FILES);
|
||||
var_dump($_POST);
|
||||
?>
|
||||
--EXPECTF--
|
||||
array(1) {
|
||||
[%u|b%"file1"]=>
|
||||
array(5) {
|
||||
[%u|b%"name"]=>
|
||||
%string|unicode%(9) "file1.txt"
|
||||
[%u|b%"type"]=>
|
||||
%string|unicode%(0) ""
|
||||
[%u|b%"tmp_name"]=>
|
||||
%string|unicode%(0) ""
|
||||
[%u|b%"error"]=>
|
||||
int(3)
|
||||
[%u|b%"size"]=>
|
||||
int(0)
|
||||
}
|
||||
}
|
||||
array(0) {
|
||||
}
|
84
tests/basic/rfc1867_post_max_filesize.phpt
Normal file
84
tests/basic/rfc1867_post_max_filesize.phpt
Normal file
@ -0,0 +1,84 @@
|
||||
--TEST--
|
||||
rfc1867 post_max_filesize
|
||||
--INI--
|
||||
file_uploads=1
|
||||
error_reporting=E_ALL&~E_NOTICE
|
||||
comment=debug builds show some additional E_NOTICE errors
|
||||
upload_max_filesize=1
|
||||
--SKIPIF--
|
||||
<?php if (php_sapi_name()=='cli') die('skip'); ?>
|
||||
--POST_RAW--
|
||||
Content-Type: multipart/form-data; boundary=---------------------------20896060251896012921717172737
|
||||
-----------------------------20896060251896012921717172737
|
||||
Content-Disposition: form-data; name="file1"; filename="file1.txt"
|
||||
Content-Type: text/plain-file1
|
||||
|
||||
1
|
||||
-----------------------------20896060251896012921717172737
|
||||
Content-Disposition: form-data; name="file2"; filename="file2.txt"
|
||||
Content-Type: text/plain-file2
|
||||
|
||||
22
|
||||
-----------------------------20896060251896012921717172737
|
||||
Content-Disposition: form-data; name="file3"; filename="file3.txt"
|
||||
Content-Type: text/plain-file3
|
||||
|
||||
3
|
||||
-----------------------------20896060251896012921717172737--
|
||||
--FILE--
|
||||
<?php
|
||||
var_dump($_FILES);
|
||||
var_dump($_POST);
|
||||
if (is_uploaded_file($_FILES["file1"]["tmp_name"])) {
|
||||
var_dump(file_get_contents($_FILES["file1"]["tmp_name"]));
|
||||
}
|
||||
if (is_uploaded_file($_FILES["file3"]["tmp_name"])) {
|
||||
var_dump(file_get_contents($_FILES["file3"]["tmp_name"]));
|
||||
}
|
||||
?>
|
||||
--EXPECTF--
|
||||
array(3) {
|
||||
[%u|b%"file1"]=>
|
||||
array(5) {
|
||||
[%u|b%"name"]=>
|
||||
%string|unicode%(9) "file1.txt"
|
||||
[%u|b%"type"]=>
|
||||
%string|unicode%(16) "text/plain-file1"
|
||||
[%u|b%"tmp_name"]=>
|
||||
%string|unicode%(%d) "%s"
|
||||
[%u|b%"error"]=>
|
||||
int(0)
|
||||
[%u|b%"size"]=>
|
||||
int(1)
|
||||
}
|
||||
[%u|b%"file2"]=>
|
||||
array(5) {
|
||||
[%u|b%"name"]=>
|
||||
%string|unicode%(9) "file2.txt"
|
||||
[%u|b%"type"]=>
|
||||
%string|unicode%(0) ""
|
||||
[%u|b%"tmp_name"]=>
|
||||
%string|unicode%(0) ""
|
||||
[%u|b%"error"]=>
|
||||
int(1)
|
||||
[%u|b%"size"]=>
|
||||
int(0)
|
||||
}
|
||||
[%u|b%"file3"]=>
|
||||
array(5) {
|
||||
[%u|b%"name"]=>
|
||||
%string|unicode%(9) "file3.txt"
|
||||
[%u|b%"type"]=>
|
||||
%string|unicode%(16) "text/plain-file3"
|
||||
[%u|b%"tmp_name"]=>
|
||||
%string|unicode%(%d) "%s"
|
||||
[%u|b%"error"]=>
|
||||
int(0)
|
||||
[%u|b%"size"]=>
|
||||
int(1)
|
||||
}
|
||||
}
|
||||
array(0) {
|
||||
}
|
||||
string(1) "1"
|
||||
string(1) "3"
|
26
tests/basic/rfc1867_post_max_size.phpt
Normal file
26
tests/basic/rfc1867_post_max_size.phpt
Normal file
@ -0,0 +1,26 @@
|
||||
--TEST--
|
||||
rfc1867 post_max_size
|
||||
--INI--
|
||||
post_max_size=1
|
||||
error_reporting=E_ALL&~E_NOTICE
|
||||
comment=debug builds show some additional E_NOTICE errors
|
||||
--SKIPIF--
|
||||
<?php if (php_sapi_name()=='cli') die('skip'); ?>
|
||||
--POST_RAW--
|
||||
Content-Type: multipart/form-data; boundary=---------------------------20896060251896012921717172737
|
||||
-----------------------------20896060251896012921717172737
|
||||
Content-Disposition: form-data; name="foobar"
|
||||
|
||||
1
|
||||
-----------------------------20896060251896012921717172737--
|
||||
--FILE--
|
||||
<?php
|
||||
var_dump($_FILES);
|
||||
var_dump($_POST);
|
||||
?>
|
||||
--EXPECTF--
|
||||
Warning: POST Content-Length of %d bytes exceeds the limit of 1 bytes in %s
|
||||
array(0) {
|
||||
}
|
||||
array(0) {
|
||||
}
|
Loading…
Reference in New Issue
Block a user