Skip to content

Commit d66e929

Browse files
committed
Fix null handling in mysqli_begin_transaction()
We don't want an explicit null name hit the !name_len check.
1 parent 124bce3 commit d66e929

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

ext/mysqli/mysqli_nonapi.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1160,7 +1160,7 @@ PHP_FUNCTION(mysqli_begin_transaction)
11601160
zval *mysql_link;
11611161
zend_long flags = TRANS_START_NO_OPT;
11621162
char * name = NULL;
1163-
size_t name_len = -1;
1163+
size_t name_len = 0;
11641164

11651165
if (zend_parse_method_parameters(ZEND_NUM_ARGS(), getThis(), "O|ls!", &mysql_link, mysqli_link_class_entry, &flags, &name, &name_len) == FAILURE) {
11661166
RETURN_THROWS();
@@ -1170,7 +1170,7 @@ PHP_FUNCTION(mysqli_begin_transaction)
11701170
zend_argument_value_error(ERROR_ARG_POS(2), "must be one of the MYSQLI_TRANS_* constants");
11711171
RETURN_THROWS();
11721172
}
1173-
if (!name_len) {
1173+
if (name && !name_len) {
11741174
zend_argument_value_error(ERROR_ARG_POS(3), "cannot be empty");
11751175
RETURN_THROWS();
11761176
}

0 commit comments

Comments
 (0)