[php-src] PR #25261: sapi/cli/php_cli.c: later -n and -c should supersede earlier ones
| From: | orlitzky | Date: | Sat, 07 Nov 2026 02:35:20 +0000 |
| Subject: | [php-src] PR #25261: sapi/cli/php_cli.c: later -n and -c should supersede earlier ones | ||
| Groups: | php.git-pulls | ||
| Request: | Send a blank email to git-pulls+get-40374@lists.php.net to get a copy of this message | ||
Pull Request: https://github.com/php/php-src/pull/25261
Author: orlitzky
The
-n and -c flags serve essentially the same purpose, to indicate which
ini file should be used. The -c flag lets you name an ini file explicitly, while
-n means that no ini file should be used.
Typically, argument parsers will override earlier occurrences of a flag with later ones. Later
occurrences of -c do indeed override earlier -c flags, but if you specify
-n after -c, the -n is essentially ignored; the ini file
passed to -c is loaded anyway.
After updating _ext/standard/tests/ini_info/php_ini_loaded_file.phpt_ to support
TEST_PHP_EXTRA_ARGS, that test fails if the extra args include -c. In
particular, it fails "make test". This commit updates the argument parser so that
subsequent -n override any existing -c flags, fixing the tests.
See also:
* https://github.com/php/php-src/pull/25236
* https://github.com/php/php-src/issues/25237