summaryrefslogtreecommitdiff
path: root/Zend
diff options
context:
space:
mode:
Diffstat (limited to 'Zend')
-rw-r--r--Zend/zend_API.h15
1 files changed, 12 insertions, 3 deletions
diff --git a/Zend/zend_API.h b/Zend/zend_API.h
index fe5694940c..a925651b83 100644
--- a/Zend/zend_API.h
+++ b/Zend/zend_API.h
@@ -1548,14 +1548,20 @@ ZEND_API ZEND_COLD void ZEND_FASTCALL zend_argument_value_error(uint32_t arg_num
#define Z_PARAM_VARIADIC(spec, dest, dest_num) \
Z_PARAM_VARIADIC_EX(spec, dest, dest_num, 0)
-#define Z_PARAM_STR_OR_ARRAY_HT(dest_str, dest_ht) \
+#define Z_PARAM_STR_OR_ARRAY_HT_EX(dest_str, dest_ht, allow_null) \
Z_PARAM_PROLOGUE(0, 0); \
- if (UNEXPECTED(!zend_parse_arg_str_or_array_ht(_arg, &dest_str, &dest_ht))) { \
+ if (UNEXPECTED(!zend_parse_arg_str_or_array_ht(_arg, &dest_str, &dest_ht, allow_null))) { \
_expected_type = Z_EXPECTED_STRING_OR_ARRAY; \
_error_code = ZPP_ERROR_WRONG_ARG; \
break; \
}
+#define Z_PARAM_STR_OR_ARRAY_HT(dest_str, dest_ht) \
+ Z_PARAM_STR_OR_ARRAY_HT_EX(dest_str, dest_ht, 0);
+
+#define Z_PARAM_STR_OR_ARRAY_HT_OR_NULL(dest_str, dest_ht) \
+ Z_PARAM_STR_OR_ARRAY_HT_EX(dest_str, dest_ht, 1);
+
/* End of new parameter parsing API */
/* Inlined implementations shared by new and old parameter parsing APIs */
@@ -1775,7 +1781,7 @@ static zend_always_inline void zend_parse_arg_zval_deref(zval *arg, zval **dest,
}
static zend_always_inline int zend_parse_arg_str_or_array_ht(
- zval *arg, zend_string **dest_str, HashTable **dest_ht)
+ zval *arg, zend_string **dest_str, HashTable **dest_ht, int allow_null)
{
if (EXPECTED(Z_TYPE_P(arg) == IS_STRING)) {
*dest_str = Z_STR_P(arg);
@@ -1783,6 +1789,9 @@ static zend_always_inline int zend_parse_arg_str_or_array_ht(
} else if (EXPECTED(Z_TYPE_P(arg) == IS_ARRAY)) {
*dest_ht = Z_ARRVAL_P(arg);
*dest_str = NULL;
+ } else if (allow_null && EXPECTED(Z_TYPE_P(arg) == IS_NULL)) {
+ *dest_ht = NULL;
+ *dest_str = NULL;
} else {
*dest_ht = NULL;
return zend_parse_arg_str_slow(arg, dest_str);