[PHP-CVS] [php-src] master: Enforce zero arity in apache_get_version() and apache_get_modules() (#23102)

[email protected] (Louis-Arnaud via GitHub)
Newsgroups php.cvs
Message-ID <[email protected]>
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 <[email protected]>

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) {
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.