@@ -66,6 +66,72 @@ public function testPostKey()
6666 );
6767 }
6868
69+ public function testPostWithQuotationMarkEncapsulatedBoundary ()
70+ {
71+ $ boundary = "---------------------------5844729766471062541057622570 " ;
72+
73+ $ data = "-- $ boundary \r\n" ;
74+ $ data .= "Content-Disposition: form-data; name= \"users[one] \"\r\n" ;
75+ $ data .= "\r\n" ;
76+ $ data .= "single \r\n" ;
77+ $ data .= "-- $ boundary \r\n" ;
78+ $ data .= "Content-Disposition: form-data; name= \"users[two] \"\r\n" ;
79+ $ data .= "\r\n" ;
80+ $ data .= "second \r\n" ;
81+ $ data .= "-- $ boundary-- \r\n" ;
82+
83+ $ request = new ServerRequest ('POST ' , 'http://example.com/ ' , array (
84+ 'Content-Type ' => 'multipart/form-data; boundary=" ' . $ boundary . '" ' ,
85+ ), $ data , 1.1 );
86+
87+ $ parser = new MultipartParser ();
88+ $ parsedRequest = $ parser ->parse ($ request );
89+
90+ $ this ->assertEmpty ($ parsedRequest ->getUploadedFiles ());
91+ $ this ->assertSame (
92+ array (
93+ 'users ' => array (
94+ 'one ' => 'single ' ,
95+ 'two ' => 'second ' ,
96+ ),
97+ ),
98+ $ parsedRequest ->getParsedBody ()
99+ );
100+ }
101+
102+ public function testPostFormDataNamesWithoutQuotationMark ()
103+ {
104+ $ boundary = "---------------------------5844729766471062541057622570 " ;
105+
106+ $ data = "-- $ boundary \r\n" ;
107+ $ data .= "Content-Disposition: form-data; name=users[one] \r\n" ;
108+ $ data .= "\r\n" ;
109+ $ data .= "single \r\n" ;
110+ $ data .= "-- $ boundary \r\n" ;
111+ $ data .= "Content-Disposition: form-data; name=users[two] \r\n" ;
112+ $ data .= "\r\n" ;
113+ $ data .= "second \r\n" ;
114+ $ data .= "-- $ boundary-- \r\n" ;
115+
116+ $ request = new ServerRequest ('POST ' , 'http://example.com/ ' , array (
117+ 'Content-Type ' => 'multipart/form-data; boundary=" ' . $ boundary . '" ' ,
118+ ), $ data , 1.1 );
119+
120+ $ parser = new MultipartParser ();
121+ $ parsedRequest = $ parser ->parse ($ request );
122+
123+ $ this ->assertEmpty ($ parsedRequest ->getUploadedFiles ());
124+ $ this ->assertSame (
125+ array (
126+ 'users ' => array (
127+ 'one ' => 'single ' ,
128+ 'two ' => 'second ' ,
129+ ),
130+ ),
131+ $ parsedRequest ->getParsedBody ()
132+ );
133+ }
134+
69135 public function testPostStringOverwritesMap ()
70136 {
71137 $ boundary = "---------------------------5844729766471062541057622570 " ;
0 commit comments