Skip to content

Commit 6f8a145

Browse files
committed
Remove request_parse_body $input_stream and $content_type params
1 parent bbf45e1 commit 6f8a145

25 files changed

+130
-248
lines changed

Zend/tests/request_parse_body/invalid_boundary.phpt

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,15 @@
11
--TEST--
22
request_parse_body() with multipart and invalid boundary
3+
--ENV--
4+
REQUEST_METHOD=PUT
5+
--POST_RAW--
6+
Content-Type: multipart/form-data; boundary="foobar
7+
empty
38
--FILE--
49
<?php
510

6-
$stream = fopen('php://memory','r+');
7-
811
try {
9-
[$_POST, $_FILES] = request_parse_body($stream, 'multipart/form-data; boundary="foobar');
12+
[$_POST, $_FILES] = request_parse_body();
1013
} catch (Exception $e) {
1114
echo $e->getMessage(), "\n";
1215
}

Zend/tests/request_parse_body/multipart_garbled.phpt

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -2,22 +2,21 @@
22
request_parse_body() with multipart and garbled field
33
--INI--
44
max_file_uploads=1
5-
--FILE--
6-
<?php
7-
8-
$stream = fopen('php://memory','r+');
9-
fwrite($stream, <<<BODY
5+
--ENV--
6+
REQUEST_METHOD=PUT
7+
--POST_RAW--
8+
Content-Type: multipart/form-data; boundary=---------------------------84000087610663814162942123332
109
-----------------------------84000087610663814162942123332
1110
Content-Disposition: form-data;
1211
Content-Type: text/plain
1312

1413
post field data
1514
-----------------------------84000087610663814162942123332--
16-
BODY);
17-
rewind($stream);
15+
--FILE--
16+
<?php
1817

1918
try {
20-
[$_POST, $_FILES] = request_parse_body($stream, 'multipart/form-data; boundary=---------------------------84000087610663814162942123332');
19+
[$_POST, $_FILES] = request_parse_body();
2120
} catch (Exception $e) {
2221
echo $e->getMessage(), "\n";
2322
}

Zend/tests/request_parse_body/multipart_max_files.phpt

Lines changed: 7 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -2,13 +2,10 @@
22
request_parse_body() with multipart and exceeding max files
33
--INI--
44
max_file_uploads=1
5-
--FILE--
6-
<?php
7-
8-
$one_kb_data = str_repeat('a', 1024);
9-
10-
$stream = fopen('php://memory','r+');
11-
fwrite($stream, <<<BODY
5+
--ENV--
6+
REQUEST_METHOD=PUT
7+
--POST_RAW--
8+
Content-Type: multipart/form-data; boundary=---------------------------84000087610663814162942123332
129
-----------------------------84000087610663814162942123332
1310
Content-Disposition: form-data; name="file1"; filename="file1.txt"
1411
Content-Type: text/plain
@@ -20,11 +17,11 @@ Content-Type: text/plain
2017

2118
file data
2219
-----------------------------84000087610663814162942123332--
23-
BODY);
24-
rewind($stream);
20+
--FILE--
21+
<?php
2522

2623
try {
27-
[$_POST, $_FILES] = request_parse_body($stream, 'multipart/form-data; boundary=---------------------------84000087610663814162942123332');
24+
[$_POST, $_FILES] = request_parse_body();
2825
} catch (Exception $e) {
2926
echo $e->getMessage(), "\n";
3027
}

Zend/tests/request_parse_body/multipart_max_input_vars.phpt

Lines changed: 7 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -2,13 +2,10 @@
22
request_parse_body() with multipart and exceeding max input vars
33
--INI--
44
max_input_vars=1
5-
--FILE--
6-
<?php
7-
8-
$one_kb_data = str_repeat('a', 1024);
9-
10-
$stream = fopen('php://memory','r+');
11-
fwrite($stream, <<<BODY
5+
--ENV--
6+
REQUEST_METHOD=PUT
7+
--POST_RAW--
8+
Content-Type: multipart/form-data; boundary=---------------------------84000087610663814162942123332
129
-----------------------------84000087610663814162942123332
1310
Content-Disposition: form-data; name="field1"
1411

@@ -18,11 +15,11 @@ Content-Disposition: form-data; name="field2"
1815

1916
post field data
2017
-----------------------------84000087610663814162942123332--
21-
BODY);
22-
rewind($stream);
18+
--FILE--
19+
<?php
2320

2421
try {
25-
[$_POST, $_FILES] = request_parse_body($stream, 'multipart/form-data; boundary=---------------------------84000087610663814162942123332');
22+
[$_POST, $_FILES] = request_parse_body();
2623
} catch (Exception $e) {
2724
echo $e->getMessage(), "\n";
2825
}

Zend/tests/request_parse_body/multipart_max_parts.phpt

Lines changed: 7 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -2,13 +2,10 @@
22
request_parse_body() with multipart and exceeding max parts
33
--INI--
44
max_multipart_body_parts=1
5-
--FILE--
6-
<?php
7-
8-
$one_kb_data = str_repeat('a', 1024);
9-
10-
$stream = fopen('php://memory','r+');
11-
fwrite($stream, <<<BODY
5+
--ENV--
6+
REQUEST_METHOD=PUT
7+
--POST_RAW--
8+
Content-Type: multipart/form-data; boundary=---------------------------84000087610663814162942123332
129
-----------------------------84000087610663814162942123332
1310
Content-Disposition: form-data; name="post_field_name"
1411

@@ -19,11 +16,11 @@ Content-Type: text/plain
1916

2017
file data
2118
-----------------------------84000087610663814162942123332--
22-
BODY);
23-
rewind($stream);
19+
--FILE--
20+
<?php
2421

2522
try {
26-
[$_POST, $_FILES] = request_parse_body($stream, 'multipart/form-data; boundary=---------------------------84000087610663814162942123332');
23+
[$_POST, $_FILES] = request_parse_body();
2724
} catch (Exception $e) {
2825
echo $e->getMessage(), "\n";
2926
}

Zend/tests/request_parse_body/multipart_missing_boundary.phpt

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,17 @@
11
--TEST--
22
request_parse_body() with multipart and missing boundary
3+
--ENV--
4+
REQUEST_METHOD=PUT
5+
--POST_RAW--
6+
Content-Type: multipart/form-data
7+
empty
38
--FILE--
49
<?php
510

6-
$one_kb_data = str_repeat('a', 1024);
7-
811
$stream = fopen('php://memory','r+');
912

1013
try {
11-
[$_POST, $_FILES] = request_parse_body($stream, 'multipart/form-data');
14+
[$_POST, $_FILES] = request_parse_body();
1215
} catch (Exception $e) {
1316
echo $e->getMessage(), "\n";
1417
}

Zend/tests/request_parse_body/multipart_options_max_files.phpt

Lines changed: 7 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -2,13 +2,10 @@
22
request_parse_body() max_file_uploads option
33
--INI--
44
max_file_uploads=10
5-
--FILE--
6-
<?php
7-
8-
$one_kb_data = str_repeat('a', 1024);
9-
10-
$stream = fopen('php://memory','r+');
11-
fwrite($stream, <<<BODY
5+
--ENV--
6+
REQUEST_METHOD=PUT
7+
--POST_RAW--
8+
Content-Type: multipart/form-data; boundary=---------------------------84000087610663814162942123332
129
-----------------------------84000087610663814162942123332
1310
Content-Disposition: form-data; name="file1"; filename="file1.txt"
1411
Content-Type: text/plain
@@ -20,11 +17,11 @@ Content-Type: text/plain
2017

2118
file data
2219
-----------------------------84000087610663814162942123332--
23-
BODY);
24-
rewind($stream);
20+
--FILE--
21+
<?php
2522

2623
try {
27-
[$_POST, $_FILES] = request_parse_body($stream, 'multipart/form-data; boundary=---------------------------84000087610663814162942123332', [
24+
[$_POST, $_FILES] = request_parse_body([
2825
'max_file_uploads' => 1,
2926
]);
3027
} catch (Exception $e) {

Zend/tests/request_parse_body/multipart_options_max_input_vars.phpt

Lines changed: 7 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -2,13 +2,10 @@
22
request_parse_body() max_input_vars option
33
--INI--
44
max_input_vars=10
5-
--FILE--
6-
<?php
7-
8-
$one_kb_data = str_repeat('a', 1024);
9-
10-
$stream = fopen('php://memory','r+');
11-
fwrite($stream, <<<BODY
5+
--ENV--
6+
REQUEST_METHOD=PUT
7+
--POST_RAW--
8+
Content-Type: multipart/form-data; boundary=---------------------------84000087610663814162942123332
129
-----------------------------84000087610663814162942123332
1310
Content-Disposition: form-data; name="field1"
1411

@@ -18,11 +15,11 @@ Content-Disposition: form-data; name="field2"
1815

1916
post field data
2017
-----------------------------84000087610663814162942123332--
21-
BODY);
22-
rewind($stream);
18+
--FILE--
19+
<?php
2320

2421
try {
25-
[$_POST, $_FILES] = request_parse_body($stream, 'multipart/form-data; boundary=---------------------------84000087610663814162942123332', [
22+
[$_POST, $_FILES] = request_parse_body([
2623
'max_input_vars' => 1,
2724
]);
2825
} catch (Exception $e) {

Zend/tests/request_parse_body/multipart_options_max_parts.phpt

Lines changed: 7 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -2,13 +2,10 @@
22
request_parse_body() max_multipart_body_parts option
33
--INI--
44
max_multipart_body_parts=10
5-
--FILE--
6-
<?php
7-
8-
$one_kb_data = str_repeat('a', 1024);
9-
10-
$stream = fopen('php://memory','r+');
11-
fwrite($stream, <<<BODY
5+
--ENV--
6+
REQUEST_METHOD=PUT
7+
--POST_RAW--
8+
Content-Type: multipart/form-data; boundary=---------------------------84000087610663814162942123332
129
-----------------------------84000087610663814162942123332
1310
Content-Disposition: form-data; name="post_field_name"
1411

@@ -19,11 +16,11 @@ Content-Type: text/plain
1916

2017
file data
2118
-----------------------------84000087610663814162942123332--
22-
BODY);
23-
rewind($stream);
19+
--FILE--
20+
<?php
2421

2522
try {
26-
[$_POST, $_FILES] = request_parse_body($stream, 'multipart/form-data; boundary=---------------------------84000087610663814162942123332', [
23+
[$_POST, $_FILES] = request_parse_body([
2724
'max_multipart_body_parts' => 1,
2825
]);
2926
} catch (Exception $e) {

Zend/tests/request_parse_body/multipart_options_post_max_size.phpt

Lines changed: 10 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -2,28 +2,25 @@
22
request_parse_body() post_max_size option
33
--INI--
44
post_max_size=1M
5-
--FILE--
6-
<?php
7-
8-
$one_kb_data = str_repeat('a', 1024);
9-
10-
$stream = fopen('php://memory','r+');
11-
fwrite($stream, <<<BODY
5+
--ENV--
6+
REQUEST_METHOD=PUT
7+
--POST_RAW--
8+
Content-Type: multipart/form-data; boundary=---------------------------84000087610663814162942123332
129
-----------------------------84000087610663814162942123332
1310
Content-Disposition: form-data; name="field1"
1411

1512
post field data
1613
-----------------------------84000087610663814162942123332
1714
Content-Disposition: form-data; name="field2"
1815

19-
$one_kb_data
16+
post file data
2017
-----------------------------84000087610663814162942123332--
21-
BODY);
22-
rewind($stream);
18+
--FILE--
19+
<?php
2320

2421
try {
25-
[$_POST, $_FILES] = request_parse_body($stream, 'multipart/form-data; boundary=---------------------------84000087610663814162942123332', [
26-
'post_max_size' => '1K',
22+
[$_POST, $_FILES] = request_parse_body([
23+
'post_max_size' => '302',
2724
]);
2825
} catch (Exception $e) {
2926
echo $e->getMessage(), "\n";
@@ -33,7 +30,7 @@ var_dump($_POST, $_FILES);
3330

3431
?>
3532
--EXPECT--
36-
POST Content-Length of 0 bytes exceeds the limit of 1024 bytes
33+
POST Content-Length of 303 bytes exceeds the limit of 302 bytes
3734
array(0) {
3835
}
3936
array(0) {

Zend/tests/request_parse_body/multipart_options_upload_max_filesize.phpt

Lines changed: 9 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -2,24 +2,21 @@
22
request_parse_body() upload_max_filesize option
33
--INI--
44
upload_max_filesize=1M
5-
--FILE--
6-
<?php
7-
8-
$one_kb_data = str_repeat('a', 1025);
9-
10-
$stream = fopen('php://memory','r+');
11-
fwrite($stream, <<<BODY
5+
--ENV--
6+
REQUEST_METHOD=PUT
7+
--POST_RAW--
8+
Content-Type: multipart/form-data; boundary=---------------------------84000087610663814162942123332
129
-----------------------------84000087610663814162942123332
1310
Content-Disposition: name="file1"; filename="file1.txt"
1411

15-
$one_kb_data
12+
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
1613
-----------------------------84000087610663814162942123332--
17-
BODY);
18-
rewind($stream);
14+
--FILE--
15+
<?php
1916

2017
try {
21-
[$_POST, $_FILES] = request_parse_body($stream, 'multipart/form-data; boundary=---------------------------84000087610663814162942123332', [
22-
'upload_max_filesize' => '1K',
18+
[$_POST, $_FILES] = request_parse_body([
19+
'upload_max_filesize' => '128',
2320
]);
2421
} catch (Exception $e) {
2522
echo $e->getMessage(), "\n";

Zend/tests/request_parse_body/multipart_post_max_size.phpt

Lines changed: 0 additions & 38 deletions
This file was deleted.

0 commit comments

Comments
 (0)