1--TEST--
2Implement Req #61679 (Support HTTP PATCH method)
3--SKIPIF--
4<?php
5include "skipif.inc";
6?>
7--FILE--
8<?php
9include "php_cli_server.inc";
10php_cli_server_start(<<<'PHP'
11var_dump($_SERVER['REQUEST_METHOD']);
12PHP
13);
14
15list($host, $port) = explode(':', PHP_CLI_SERVER_ADDRESS);
16$port = intval($port)?:80;
17
18$fp = fsockopen($host, $port, $errno, $errstr, 0.5);
19if (!$fp) {
20  die("connect failed");
21}
22
23if(fwrite($fp, <<<HEADER
24PATCH / HTTP/1.1
25Host: {$host}
26
27
28HEADER
29)) {
30    while (!feof($fp)) {
31        echo fgets($fp);
32    }
33}
34
35fclose($fp);
36?>
37--EXPECTF--
38HTTP/1.1 200 OK
39Host: %s
40Connection: close
41X-Powered-By: %s
42Content-type: text/html
43
44string(5) "PATCH"
45