@@ -721,6 +721,39 @@ public function testUploadTooLargeFile()
721721 $ this ->assertSame (UPLOAD_ERR_INI_SIZE , $ file ->getError ());
722722 }
723723
724+ public function testUploadTooLargeFileWithIniLikeSize ()
725+ {
726+ $ boundary = "---------------------------12758086162038677464950549563 " ;
727+
728+ $ data = "-- $ boundary \r\n" ;
729+ $ data .= "Content-Disposition: form-data; name= \"file \"; filename= \"hello \"\r\n" ;
730+ $ data .= "Content-type: text/plain \r\n" ;
731+ $ data .= "\r\n" ;
732+ $ data .= str_repeat ('world ' , 1024 ) . "\r\n" ;
733+ $ data .= "-- $ boundary-- \r\n" ;
734+
735+ $ request = new ServerRequest ('POST ' , 'http://example.com/ ' , array (
736+ 'Content-Type ' => 'multipart/form-data; boundary= ' . $ boundary ,
737+ ), $ data , 1.1 );
738+
739+ $ parser = new MultipartParser ('1K ' );
740+ $ parsedRequest = $ parser ->parse ($ request );
741+
742+ $ files = $ parsedRequest ->getUploadedFiles ();
743+
744+ $ this ->assertCount (1 , $ files );
745+ $ this ->assertTrue (isset ($ files ['file ' ]));
746+ $ this ->assertInstanceOf ('Psr\Http\Message\UploadedFileInterface ' , $ files ['file ' ]);
747+
748+ /* @var $file \Psr\Http\Message\UploadedFileInterface */
749+ $ file = $ files ['file ' ];
750+
751+ $ this ->assertSame ('hello ' , $ file ->getClientFilename ());
752+ $ this ->assertSame ('text/plain ' , $ file ->getClientMediaType ());
753+ $ this ->assertSame (5120 , $ file ->getSize ());
754+ $ this ->assertSame (UPLOAD_ERR_INI_SIZE , $ file ->getError ());
755+ }
756+
724757 public function testUploadNoFile ()
725758 {
726759 $ boundary = "---------------------------12758086162038677464950549563 " ;
0 commit comments