@@ -1342,8 +1342,8 @@ function run_test($php, $file, $env)
1342
1342
1343
1343
$ tested = trim ($ section_text ['TEST ' ]);
1344
1344
1345
- /* For GET/POST tests, check if cgi sapi is available and if it is, use it. */
1346
- if (!empty ($ section_text ['GET ' ]) || !empty ($ section_text ['POST ' ]) || !empty ($ section_text ['POST_RAW ' ]) || !empty ($ section_text ['COOKIE ' ]) || !empty ($ section_text ['EXPECTHEADERS ' ])) {
1345
+ /* For GET/POST/PUT tests, check if cgi sapi is available and if it is, use it. */
1346
+ if (!empty ($ section_text ['GET ' ]) || !empty ($ section_text ['POST ' ]) || !empty ($ section_text ['POST_RAW ' ]) || !empty ($ section_text ['PUT ' ]) || ! empty ( $ section_text [ ' COOKIE ' ]) || !empty ($ section_text ['EXPECTHEADERS ' ])) {
1347
1347
if (isset ($ php_cgi )) {
1348
1348
$ old_php = $ php ;
1349
1349
$ php = $ php_cgi . ' -C ' ;
@@ -1718,6 +1718,46 @@ function run_test($php, $file, $env)
1718
1718
save_text ($ tmp_post , $ request );
1719
1719
$ cmd = "$ php $ pass_options $ ini_settings -f \"$ test_file \" 2>&1 < \"$ tmp_post \"" ;
1720
1720
1721
+ } elseif (array_key_exists ('PUT ' , $ section_text ) && !empty ($ section_text ['PUT ' ])) {
1722
+
1723
+ $ post = trim ($ section_text ['PUT ' ]);
1724
+ $ raw_lines = explode ("\n" , $ post );
1725
+
1726
+ $ request = '' ;
1727
+ $ started = false ;
1728
+
1729
+ foreach ($ raw_lines as $ line ) {
1730
+
1731
+ if (empty ($ env ['CONTENT_TYPE ' ]) && preg_match ('/^Content-Type:(.*)/i ' , $ line , $ res )) {
1732
+ $ env ['CONTENT_TYPE ' ] = trim (str_replace ("\r" , '' , $ res [1 ]));
1733
+ continue ;
1734
+ }
1735
+
1736
+ if ($ started ) {
1737
+ $ request .= "\n" ;
1738
+ }
1739
+
1740
+ $ started = true ;
1741
+ $ request .= $ line ;
1742
+ }
1743
+
1744
+ $ env ['CONTENT_LENGTH ' ] = strlen ($ request );
1745
+ $ env ['REQUEST_METHOD ' ] = 'PUT ' ;
1746
+
1747
+ if (empty ($ request )) {
1748
+ if ($ JUNIT ) {
1749
+ $ JUNIT ['test_total ' ]++;
1750
+ $ JUNIT ['test_error ' ]++;
1751
+ $ JUNIT ['result_xml ' ] .= '<testcase classname=" ' .$ shortname .'" name=" ' .htmlspecialchars ($ tested , ENT_QUOTES ).'" time=" ' .$ test_execution_time .'"> ' ."\n" ;
1752
+ $ JUNIT ['result_xml ' ] .= '<error type="BORKED" message="empty $request" /> ' ."\n" ;
1753
+ $ JUNIT ['result_xml ' ] .= '</testcase> ' ."\n" ;
1754
+ }
1755
+ return 'BORKED ' ;
1756
+ }
1757
+
1758
+ save_text ($ tmp_post , $ request );
1759
+ $ cmd = "$ php $ pass_options $ ini_settings -f \"$ test_file \" 2>&1 < \"$ tmp_post \"" ;
1760
+
1721
1761
} else if (array_key_exists ('POST ' , $ section_text ) && !empty ($ section_text ['POST ' ])) {
1722
1762
1723
1763
$ post = trim ($ section_text ['POST ' ]);
0 commit comments