1
0
mirror of https://github.com/php/php-src.git synced 2026-03-24 00:02:20 +01:00

tree-wide: Replace ZEND_WRONG_PARAM_COUNT() by its definition (#20066)

* tree-wide: Replace `WRONG_PARAM_COUNT` by `ZEND_WRONG_PARAM_COUNT()`

This is a direct alias.

* tree-wide: Replace `ZEND_WRONG_PARAM_COUNT()` by its definition

This macro was hiding control flow (the return statement) and thus was
particularly unhygienic.
This commit is contained in:
Tim Düsterhus
2025-11-12 21:28:56 +01:00
committed by GitHub
parent c463770c2b
commit db8d35e7eb
6 changed files with 11 additions and 6 deletions

View File

@@ -45,6 +45,9 @@ PHP 8.6 INTERNALS UPGRADE NOTES
__callStatic zend_function* instead of a CE and a boolean argument.
. The zend_set_hash_symbol() API has been removed.
. Added zend_hash_str_lookup().
. The WRONG_PARAM_COUNT and ZEND_WRONG_PARAM_COUNT() macros have been
removed. Call zend_wrong_param_count(); followed by RETURN_THROWS();
instead.
========================
2. Build system changes

View File

@@ -523,9 +523,7 @@ ZEND_API const char *zend_get_type_by_const(int type);
#define getThis() (hasThis() ? ZEND_THIS : NULL)
#define ZEND_IS_METHOD_CALL() (EX(func)->common.scope != NULL)
#define WRONG_PARAM_COUNT ZEND_WRONG_PARAM_COUNT()
#define ZEND_NUM_ARGS() EX_NUM_ARGS()
#define ZEND_WRONG_PARAM_COUNT() { zend_wrong_param_count(); return; }
#ifndef ZEND_WIN32
#define DLEXPORT

View File

@@ -980,7 +980,8 @@ PHP_FUNCTION(ldap_connect)
#ifdef HAVE_ORALDAP
if (ZEND_NUM_ARGS() == 3 || ZEND_NUM_ARGS() == 4) {
WRONG_PARAM_COUNT;
zend_wrong_param_count();
RETURN_THROWS();
}
if (zend_parse_parameters(ZEND_NUM_ARGS(), "|s!lssl", &host, &hostlen, &port, &wallet, &walletlen, &walletpasswd, &walletpasswdlen, &authmode) != SUCCESS) {

View File

@@ -2501,7 +2501,8 @@ PHP_METHOD(SplFileObject, fscanf)
int result = php_sscanf_internal(ZSTR_VAL(intern->u.file.current_line), ZSTR_VAL(format_str), (int)num_varargs, varargs, 0, return_value);
if (SCAN_ERROR_WRONG_PARAM_COUNT == result) {
WRONG_PARAM_COUNT;
zend_wrong_param_count();
RETURN_THROWS();
}
}
/* }}} */

View File

@@ -961,7 +961,8 @@ PHP_FUNCTION(fscanf)
efree(buf);
if (SCAN_ERROR_WRONG_PARAM_COUNT == result) {
WRONG_PARAM_COUNT;
zend_wrong_param_count();
RETURN_THROWS();
}
}
/* }}} */

View File

@@ -5873,7 +5873,8 @@ PHP_FUNCTION(sscanf)
result = php_sscanf_internal(str, format, num_args, args, 0, return_value);
if (SCAN_ERROR_WRONG_PARAM_COUNT == result) {
WRONG_PARAM_COUNT;
zend_wrong_param_count();
RETURN_THROWS();
}
}
/* }}} */