Skip to content

Commit

Permalink
Fixed bug #55504 (Content-Type header is not parsed correctly on HTTP…
Browse files Browse the repository at this point in the history
… POST request
  • Loading branch information
bjori committed Sep 7, 2011
1 parent 565cf8b commit 797a1ce
Show file tree
Hide file tree
Showing 5 changed files with 75 additions and 1 deletion.
2 changes: 2 additions & 0 deletions NEWS
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@ PHP NEWS
(Arpad)
. Fixed bug #55576: Cannot conditionally move uploaded file without race
condition. (Gustavo)
. Fixed bug #55504 (Content-Type header is not parsed correctly on
HTTP POST request). (Hannes)

- DateTime:
. Fixed bug #48476 (cloning extended DateTime class without calling
Expand Down
2 changes: 1 addition & 1 deletion main/rfc1867.c
Original file line number Diff line number Diff line change
Expand Up @@ -816,7 +816,7 @@ SAPI_API SAPI_POST_HANDLER_FUNC(rfc1867_post_handler) /* {{{ */
}
} else {
/* search for the end of the boundary */
boundary_end = strchr(boundary, ',');
boundary_end = strpbrk(boundary, ",;");
}
if (boundary_end) {
boundary_end[0] = '\0';
Expand Down
20 changes: 20 additions & 0 deletions tests/basic/030.phpt
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
--TEST--
Bug#55504 (Content-Type header is not parsed correctly on HTTP POST request)
--INI--
file_uploads=1
--POST_RAW--
Content-Type: multipart/form-data; boundary=BVoyv; charset=iso-8859-1
--BVoyv
Content-Disposition: form-data; name="data"

abc
--BVoyv--
--FILE--
<?php
var_dump($_POST);
?>
--EXPECT--
array(1) {
["data"]=>
string(3) "abc"
}
32 changes: 32 additions & 0 deletions tests/basic/031.phpt
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
--TEST--
Bug#55504 (Content-Type header is not parsed correctly on HTTP POST request)
--INI--
file_uploads=1
--POST_RAW--
Content-Type: multipart/form-data; boundary=BVoyv; charset=iso-8859-1
--BVoyv
Content-Disposition: form-data; name="data"

abc
--BVoyv
Content-Disposition: form-data; name="data2"

more data
--BVoyv
Content-Disposition: form-data; name="data3"

even more data
--BVoyv--
--FILE--
<?php
var_dump($_POST);
?>
--EXPECT--
array(3) {
["data"]=>
string(3) "abc"
["data2"]=>
string(9) "more data"
["data3"]=>
string(14) "even more data"
}
20 changes: 20 additions & 0 deletions tests/basic/032.phpt
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
--TEST--
Bug#18792 (no form variables after multipart/form-data)
--INI--
file_uploads=1
--POST_RAW--
Content-Type: multipart/form-data; boundary=BVoyv, charset=iso-8859-1
--BVoyv
Content-Disposition: form-data; name="data"

abc
--BVoyv--
--FILE--
<?php
var_dump($_POST);
?>
--EXPECT--
array(1) {
["data"]=>
string(3) "abc"
}

0 comments on commit 797a1ce

Please sign in to comment.