[php-src] master: Enforce zero arity in apache_get_version() and apache_get_modules() (#23102)
| From: | Louis-Arnaud via GitHub | Date: | Fri, 07 Aug 2026 17:05:40 +0000 |
| Subject: | [php-src] master: Enforce zero arity in apache_get_version() and apache_get_modules() (#23102) | ||
| Groups: | php.cvs | ||
| Request: | Send a blank email to php-cvs+get-140534@lists.php.net to get a copy of this message | ||
Author: Louis-Arnaud (lacatoire)
Committer: GitHub (web-flow)
Pusher: Girgias
Date: 2026-08-07T18:05:37+01:00
Commit: https://github.com/php/php-src/commit/b2cf4608e7bd99b044d98eebbc6467049391a23a
Raw diff: https://github.com/php/php-src/commit/b2cf4608e7bd99b044d98eebbc6467049391a23a.diff
Enforce zero arity in apache_get_version() and apache_get_modules() (#23102)
Both functions are declared with no parameters in the stub, but neither
implementation called ZEND_PARSE_PARAMETERS_NONE(), so extra positional
arguments were silently accepted instead of raising ArgumentCountError.
Every other zero-arity function of the same SAPI (apache_request_headers(),
apache_response_headers(), getallheaders()) already enforces its arity, and
so does the litespeed implementation of apache_get_modules(). No stub or
arginfo change is needed.
Co-authored-by: lacatoire <ext-lacatoire@cenef.fr>
Changed paths:
M sapi/apache2handler/php_functions.c
Diff:
diff --git a/sapi/apache2handler/php_functions.c b/sapi/apache2handler/php_functions.c
index 1baa1f5225e0..db2dcca72bda 100644
--- a/sapi/apache2handler/php_functions.c
+++ b/sapi/apache2handler/php_functions.c
@@ -308,6 +308,8 @@ static const char *php_apache_get_version(void)
/* {{{ Fetch Apache version */
PHP_FUNCTION(apache_get_version)
{
+ ZEND_PARSE_PARAMETERS_NONE();
+
const char *apv = php_apache_get_version();
if (apv && *apv) {
@@ -324,6 +326,8 @@ PHP_FUNCTION(apache_get_modules)
int n;
char *p;
+ ZEND_PARSE_PARAMETERS_NONE();
+
array_init(return_value);
for (n = 0; ap_loaded_modules[n]; ++n) {