File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -278,7 +278,7 @@ private function parseHeaders($header)
278278 private function getParameterFromHeader (array $ header , $ parameter )
279279 {
280280 foreach ($ header as $ part ) {
281- if (\preg_match ('/ ' . $ parameter . '="?(.*)" $/ ' , $ part , $ matches )) {
281+ if (\preg_match ('/ ' . $ parameter . '="?(.*?)"? $/ ' , $ part , $ matches )) {
282282 return $ matches [1 ];
283283 }
284284 }
Original file line number Diff line number Diff line change @@ -99,6 +99,39 @@ public function testPostWithQuotationMarkEncapsulatedBoundary()
9999 );
100100 }
101101
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+
102135 public function testPostStringOverwritesMap ()
103136 {
104137 $ boundary = "---------------------------5844729766471062541057622570 " ;
You can’t perform that action at this time.
0 commit comments