From 70b4bc963c559aba8d036a47804c8b21ca41a668 Mon Sep 17 00:00:00 2001 From: Tyson Andre Date: Fri, 8 Nov 2019 09:58:05 -0500 Subject: [PATCH] Fix compile error using zend_parse_parameters_throw() Fixes a bug introduced in 4008704f62 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. --- Zend/zend_API.h | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/Zend/zend_API.h b/Zend/zend_API.h index 2801b08266..ba6b4ed439 100644 --- a/Zend/zend_API.h +++ b/Zend/zend_API.h @@ -269,8 +269,9 @@ ZEND_API int zend_copy_parameters_array(int param_count, zval *argument_array); #define ZEND_PARSE_PARAMS_QUIET (1<<1) ZEND_API int zend_parse_parameters(int num_args, const char *type_spec, ...); ZEND_API int zend_parse_parameters_ex(int flags, int num_args, const char *type_spec, ...); -#define zend_parse_parameters_throw(num_args, type_spec, ...) \ - zend_parse_parameters(num_args, type_spec, __VA_ARGS__) +/* NOTE: This must have at least one value in __VA_ARGS__ for the expression to be valid */ +#define zend_parse_parameters_throw(num_args, ...) \ + zend_parse_parameters(num_args, __VA_ARGS__) ZEND_API const char *zend_zval_type_name(const zval *arg); ZEND_API zend_string *zend_zval_get_type(const zval *arg); -- 2.50.1