Commit b4539c0e1b6 for php
commit b4539c0e1b6a98a5dbc5d41d7d0129c2d7d7f633
Author: Juan Versolato Lopes <juan.versolato@outlook.com>
Date: Tue Oct 27 11:58:37 2026 -0300
Fix GH-9670: List -C and -q in the CLI help
Both options are accepted by the CLI (they are no-ops kept for CGI
compatibility) and are documented in the manual, but php -h did not list
them.
Closes GH-24790.
diff --git a/NEWS b/NEWS
index f15ac3c808a..bd81e07a3f3 100644
--- a/NEWS
+++ b/NEWS
@@ -50,6 +50,7 @@ PHP NEWS
- CLI:
. Fixed bug GH-24697 (PHP_HTTP_PARSER_STRICT build option doesn't work).
(ndossche, devnexen)
+ . Fixed bug GH-9670 (List -C and -q in the CLI help). (Juan Versolato Lopes)
- Curl:
. Fix use-after-free of CURLOPT_STDERR stream on cloned curl handle.
diff --git a/sapi/cli/php_cli.c b/sapi/cli/php_cli.c
index 6894f57c12c..6dcc07a0c0b 100644
--- a/sapi/cli/php_cli.c
+++ b/sapi/cli/php_cli.c
@@ -484,6 +484,7 @@ static void php_cli_usage(char *argv0)
"\n"
" -a Run as interactive shell (requires readline extension)\n"
" -c <path>|<file> Look for php.ini file in this directory\n"
+ " -C Do not chdir to the script's directory (no-op in CLI)\n"
" -n No configuration (ini) files will be used\n"
" -d foo[=bar] Define INI entry foo with value 'bar'\n"
" -e Generate extended information for debugger/profiler\n"
@@ -492,6 +493,7 @@ static void php_cli_usage(char *argv0)
" -i PHP information\n"
" -l Syntax check only (lint)\n"
" -m Show compiled in modules\n"
+ " -q Do not output HTTP headers (no-op in CLI)\n"
" -r <code> Run PHP <code> without using script tags <?..?>\n"
" -B <begin_code> Run PHP <begin_code> before processing input lines\n"
" -R <code> Run PHP <code> for every input line\n"
diff --git a/sapi/cli/tests/gh9670.phpt b/sapi/cli/tests/gh9670.phpt
new file mode 100644
index 00000000000..2df588db372
--- /dev/null
+++ b/sapi/cli/tests/gh9670.phpt
@@ -0,0 +1,21 @@
+--TEST--
+GH-9670 (php -h does not list the -C and -q options)
+--SKIPIF--
+<?php
+include "skipif.inc";
+?>
+--FILE--
+<?php
+
+$php = getenv('TEST_PHP_EXECUTABLE_ESCAPED');
+
+foreach (explode("\n", `$php -n -h`) as $line) {
+ if (preg_match('/^ -[Cq] /', $line)) {
+ echo $line, "\n";
+ }
+}
+
+?>
+--EXPECT--
+ -C Do not chdir to the script's directory (no-op in CLI)
+ -q Do not output HTTP headers (no-op in CLI)