]> granicus.if.org Git - php/commitdiff
Fixed bug #55504 (Content-Type header is not parsed correctly on HTTP POST request
authorHannes Magnusson <bjori@php.net>
Wed, 7 Sep 2011 16:19:09 +0000 (16:19 +0000)
committerHannes Magnusson <bjori@php.net>
Wed, 7 Sep 2011 16:19:09 +0000 (16:19 +0000)
NEWS
main/rfc1867.c
tests/basic/030.phpt [new file with mode: 0644]
tests/basic/031.phpt [new file with mode: 0644]
tests/basic/032.phpt [new file with mode: 0644]

diff --git a/NEWS b/NEWS
index 7385e3955fda45934ec677d8f79440ea29835072..a13b1bdfcae74e8b49313a854f8082d4dae5db56 100644 (file)
--- a/NEWS
+++ b/NEWS
@@ -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
index 01b71317cc13be5256a3c4ae346d2baeed898283..95f9fa8bf20537bf73e94b08b7caf7e66e7ec0b7 100644 (file)
@@ -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';
diff --git a/tests/basic/030.phpt b/tests/basic/030.phpt
new file mode 100644 (file)
index 0000000..cf2a270
--- /dev/null
@@ -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"
+}
diff --git a/tests/basic/031.phpt b/tests/basic/031.phpt
new file mode 100644 (file)
index 0000000..12b8354
--- /dev/null
@@ -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"
+}
diff --git a/tests/basic/032.phpt b/tests/basic/032.phpt
new file mode 100644 (file)
index 0000000..a6aba5b
--- /dev/null
@@ -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"
+}