Skip to content

Commit 70b4bc9

Browse files
TysonAndrenikic
authored andcommitted
Fix compile error using zend_parse_parameters_throw()
Fixes a bug introduced in 4008704 The trailing comma is followed by `)` when the varargs list is empty in the macro, which is a syntax error in C This fixes compilation of code such as the following PHP_FUNCTION(get_metadata) { if (zend_parse_parameters_throw(ZEND_NUM_ARGS(), "") == FAILURE) { return; } Closes GH-4896.
1 parent 1cb69c4 commit 70b4bc9

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

Zend/zend_API.h

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -269,8 +269,9 @@ ZEND_API int zend_copy_parameters_array(int param_count, zval *argument_array);
269269
#define ZEND_PARSE_PARAMS_QUIET (1<<1)
270270
ZEND_API int zend_parse_parameters(int num_args, const char *type_spec, ...);
271271
ZEND_API int zend_parse_parameters_ex(int flags, int num_args, const char *type_spec, ...);
272-
#define zend_parse_parameters_throw(num_args, type_spec, ...) \
273-
zend_parse_parameters(num_args, type_spec, __VA_ARGS__)
272+
/* NOTE: This must have at least one value in __VA_ARGS__ for the expression to be valid */
273+
#define zend_parse_parameters_throw(num_args, ...) \
274+
zend_parse_parameters(num_args, __VA_ARGS__)
274275
ZEND_API const char *zend_zval_type_name(const zval *arg);
275276
ZEND_API zend_string *zend_zval_get_type(const zval *arg);
276277

0 commit comments

Comments
 (0)