Skip to content

Commit db8d35e

Browse files
authored
tree-wide: Replace ZEND_WRONG_PARAM_COUNT() by its definition (php#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.
1 parent c463770 commit db8d35e

File tree

6 files changed

+11
-6
lines changed

6 files changed

+11
-6
lines changed

UPGRADING.INTERNALS

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,9 @@ PHP 8.6 INTERNALS UPGRADE NOTES
4545
__callStatic zend_function* instead of a CE and a boolean argument.
4646
. The zend_set_hash_symbol() API has been removed.
4747
. Added zend_hash_str_lookup().
48+
. The WRONG_PARAM_COUNT and ZEND_WRONG_PARAM_COUNT() macros have been
49+
removed. Call zend_wrong_param_count(); followed by RETURN_THROWS();
50+
instead.
4851

4952
========================
5053
2. Build system changes

Zend/zend_API.h

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -523,9 +523,7 @@ ZEND_API const char *zend_get_type_by_const(int type);
523523
#define getThis() (hasThis() ? ZEND_THIS : NULL)
524524
#define ZEND_IS_METHOD_CALL() (EX(func)->common.scope != NULL)
525525

526-
#define WRONG_PARAM_COUNT ZEND_WRONG_PARAM_COUNT()
527526
#define ZEND_NUM_ARGS() EX_NUM_ARGS()
528-
#define ZEND_WRONG_PARAM_COUNT() { zend_wrong_param_count(); return; }
529527

530528
#ifndef ZEND_WIN32
531529
#define DLEXPORT

ext/ldap/ldap.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -980,7 +980,8 @@ PHP_FUNCTION(ldap_connect)
980980

981981
#ifdef HAVE_ORALDAP
982982
if (ZEND_NUM_ARGS() == 3 || ZEND_NUM_ARGS() == 4) {
983-
WRONG_PARAM_COUNT;
983+
zend_wrong_param_count();
984+
RETURN_THROWS();
984985
}
985986

986987
if (zend_parse_parameters(ZEND_NUM_ARGS(), "|s!lssl", &host, &hostlen, &port, &wallet, &walletlen, &walletpasswd, &walletpasswdlen, &authmode) != SUCCESS) {

ext/spl/spl_directory.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2501,7 +2501,8 @@ PHP_METHOD(SplFileObject, fscanf)
25012501
int result = php_sscanf_internal(ZSTR_VAL(intern->u.file.current_line), ZSTR_VAL(format_str), (int)num_varargs, varargs, 0, return_value);
25022502

25032503
if (SCAN_ERROR_WRONG_PARAM_COUNT == result) {
2504-
WRONG_PARAM_COUNT;
2504+
zend_wrong_param_count();
2505+
RETURN_THROWS();
25052506
}
25062507
}
25072508
/* }}} */

ext/standard/file.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -961,7 +961,8 @@ PHP_FUNCTION(fscanf)
961961
efree(buf);
962962

963963
if (SCAN_ERROR_WRONG_PARAM_COUNT == result) {
964-
WRONG_PARAM_COUNT;
964+
zend_wrong_param_count();
965+
RETURN_THROWS();
965966
}
966967
}
967968
/* }}} */

ext/standard/string.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5873,7 +5873,8 @@ PHP_FUNCTION(sscanf)
58735873
result = php_sscanf_internal(str, format, num_args, args, 0, return_value);
58745874

58755875
if (SCAN_ERROR_WRONG_PARAM_COUNT == result) {
5876-
WRONG_PARAM_COUNT;
5876+
zend_wrong_param_count();
5877+
RETURN_THROWS();
58775878
}
58785879
}
58795880
/* }}} */

0 commit comments

Comments
 (0)