Commit 35881e12982 for php.net

commit 35881e12982933fd7eaea30da10994e91c84e1e5
Author: Vazha Aptsiauri <37383700+Afcyy@users.noreply.github.com>
Date:   Wed Jul 8 18:10:01 2026 +0400

    sapi/cli: support HTTP QUERY method in built-in server (#22615)

    Co-authored-by: Vazha Aptsiauri <v.aptsiauri@tnet.ge>

diff --git a/UPGRADING b/UPGRADING
index b9c659ccc40..6a1f1b12e4a 100644
--- a/UPGRADING
+++ b/UPGRADING
@@ -297,6 +297,10 @@ PHP 8.6 UPGRADE NOTES
 3. Changes in SAPI modules
 ========================================

+- CLI:
+  . The built-in development server now accepts requests using the QUERY HTTP
+    method instead of returning 501 Not Implemented.
+
 ========================================
 4. Deprecated Functionality
 ========================================
diff --git a/sapi/cli/php_http_parser.c b/sapi/cli/php_http_parser.c
index c7c2ad0caae..ac3c19d5d96 100644
--- a/sapi/cli/php_http_parser.c
+++ b/sapi/cli/php_http_parser.c
@@ -82,6 +82,7 @@ static const char *method_strings[] =
   , "POST"
   , "PUT"
   , "PATCH"
+  , "QUERY"
   , "CONNECT"
   , "OPTIONS"
   , "TRACE"
@@ -521,6 +522,7 @@ size_t php_http_parser_execute (php_http_parser *parser,
           case 'N': parser->method = PHP_HTTP_NOTIFY; break;
           case 'O': parser->method = PHP_HTTP_OPTIONS; break;
           case 'P': parser->method = PHP_HTTP_POST; /* or PROPFIND or PROPPATCH or PUT */ break;
+          case 'Q': parser->method = PHP_HTTP_QUERY; break;
           case 'R': parser->method = PHP_HTTP_REPORT; break;
           case 'S': parser->method = PHP_HTTP_SUBSCRIBE; /* or SEARCH */ break;
           case 'T': parser->method = PHP_HTTP_TRACE; break;
diff --git a/sapi/cli/php_http_parser.h b/sapi/cli/php_http_parser.h
index 345ca405edd..d7006b6d04d 100644
--- a/sapi/cli/php_http_parser.h
+++ b/sapi/cli/php_http_parser.h
@@ -79,6 +79,7 @@ enum php_http_method
   , PHP_HTTP_POST
   , PHP_HTTP_PUT
   , PHP_HTTP_PATCH
+  , PHP_HTTP_QUERY
   /* pathological */
   , PHP_HTTP_CONNECT
   , PHP_HTTP_OPTIONS
diff --git a/sapi/cli/tests/php_cli_server_query_method.phpt b/sapi/cli/tests/php_cli_server_query_method.phpt
new file mode 100644
index 00000000000..58ce95bfd1e
--- /dev/null
+++ b/sapi/cli/tests/php_cli_server_query_method.phpt
@@ -0,0 +1,40 @@
+--TEST--
+Support HTTP QUERY method
+--SKIPIF--
+<?php
+include "skipif.inc";
+?>
+--FILE--
+<?php
+include "php_cli_server.inc";
+php_cli_server_start(<<<'PHP'
+var_dump($_SERVER['REQUEST_METHOD']);
+PHP
+);
+
+$host = PHP_CLI_SERVER_HOSTNAME;
+$fp = php_cli_server_connect();
+
+if (fwrite($fp, <<<HEADER
+QUERY / HTTP/1.1
+Host: {$host}
+
+
+HEADER
+)) {
+    while (!feof($fp)) {
+        echo fgets($fp);
+    }
+}
+
+fclose($fp);
+?>
+--EXPECTF--
+HTTP/1.1 200 OK
+Host: %s
+Date: %s
+Connection: close
+X-Powered-By: %s
+Content-type: text/html; charset=UTF-8
+
+string(5) "QUERY"