Skip to content

Commit 70a3a90

Browse files
committed
Add the Z_PARAM_PATH_OR_NULL() and Z_PARAM_ZVAL_OR_NULL() macros
1 parent 0a5b7c8 commit 70a3a90

File tree

2 files changed

+7
-1
lines changed

2 files changed

+7
-1
lines changed

Zend/zend_API.h

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1601,6 +1601,9 @@ ZEND_API ZEND_COLD void ZEND_FASTCALL zend_argument_value_error(uint32_t arg_num
16011601
#define Z_PARAM_PATH(dest, dest_len) \
16021602
Z_PARAM_PATH_EX(dest, dest_len, 0, 0)
16031603

1604+
#define Z_PARAM_PATH_OR_NULL(dest, dest_len) \
1605+
Z_PARAM_PATH_EX(dest, dest_len, 1, 0)
1606+
16041607
/* old "P" */
16051608
#define Z_PARAM_PATH_STR_EX2(dest, check_null, deref, separate) \
16061609
Z_PARAM_PROLOGUE(deref, separate); \
@@ -1681,6 +1684,9 @@ ZEND_API ZEND_COLD void ZEND_FASTCALL zend_argument_value_error(uint32_t arg_num
16811684
#define Z_PARAM_ZVAL(dest) \
16821685
Z_PARAM_ZVAL_EX(dest, 0, 0)
16831686

1687+
#define Z_PARAM_ZVAL_OR_NULL(dest) \
1688+
Z_PARAM_ZVAL_EX(dest, 1, 0)
1689+
16841690
/* old "+" and "*" */
16851691
#define Z_PARAM_VARIADIC_EX(spec, dest, dest_num, post_varargs) do { \
16861692
uint32_t _num_varargs = _num_args - _i - (post_varargs); \

ext/pdo/pdo_stmt.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1595,7 +1595,7 @@ PHP_METHOD(PDOStatement, setAttribute)
15951595

15961596
ZEND_PARSE_PARAMETERS_START(2, 2)
15971597
Z_PARAM_LONG(attr)
1598-
Z_PARAM_ZVAL_EX(value, 1, 0)
1598+
Z_PARAM_ZVAL_OR_NULL(value)
15991599
ZEND_PARSE_PARAMETERS_END();
16001600

16011601
PHP_STMT_GET_OBJ;

0 commit comments

Comments
 (0)