com php-src: Fix compile error using zend_parse_parameters _throw(): Zend/zend_API.h
| From: | Nikita Popov | Date: | Fri, 08 Nov 2019 15:29:10 +0000 |
| Subject: | com php-src: Fix compile error using zend_parse_parameters _throw(): Zend/zend_API.h | ||
| Groups: | php.cvs | ||
| Request: | Send a blank email to php-cvs+get-109223@lists.php.net to get a copy of this message | ||
Commit: 70b4bc963c559aba8d036a47804c8b21ca41a668
Author: Tyson Andre <tysonandre775@hotmail.com> Fri, 8 Nov 2019 09:58:05 -0500
Committer: Nikita Popov <nikita.ppv@gmail.com> Fri, 8 Nov 2019 16:29:10 +0100
Parents: 1cb69c44d716cfea98a9566c80dd21a58732bbf8
Branches: master
Link: http://git.php.net/?p=php-src.git;a=commitdiff;h=70b4bc963c559aba8d036a47804c8b21ca41a668
Log:
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.
Changed paths:
M Zend/zend_API.h
Diff:
diff --git a/Zend/zend_API.h b/Zend/zend_API.h
index 2801b082668..ba6b4ed439d 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);