summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNikita Popov <nikita.ppv@gmail.com>2020-10-13 17:10:41 +0200
committerNikita Popov <nikita.ppv@gmail.com>2020-10-13 17:12:50 +0200
commitd66e9299158c98e797901dd24073e91fa8063d4b (patch)
treed00392ee3d43b35c3bfaeec492de3fa6de9102ff
parent124bce3c7ab553b249b4503e9950bddf9ac54813 (diff)
downloadphp-git-d66e9299158c98e797901dd24073e91fa8063d4b.tar.gz
Fix null handling in mysqli_begin_transaction()
We don't want an explicit null name hit the !name_len check.
-rw-r--r--ext/mysqli/mysqli_nonapi.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/ext/mysqli/mysqli_nonapi.c b/ext/mysqli/mysqli_nonapi.c
index 5bbb1d3888..c75527ff93 100644
--- a/ext/mysqli/mysqli_nonapi.c
+++ b/ext/mysqli/mysqli_nonapi.c
@@ -1160,7 +1160,7 @@ PHP_FUNCTION(mysqli_begin_transaction)
zval *mysql_link;
zend_long flags = TRANS_START_NO_OPT;
char * name = NULL;
- size_t name_len = -1;
+ size_t name_len = 0;
if (zend_parse_method_parameters(ZEND_NUM_ARGS(), getThis(), "O|ls!", &mysql_link, mysqli_link_class_entry, &flags, &name, &name_len) == FAILURE) {
RETURN_THROWS();
@@ -1170,7 +1170,7 @@ PHP_FUNCTION(mysqli_begin_transaction)
zend_argument_value_error(ERROR_ARG_POS(2), "must be one of the MYSQLI_TRANS_* constants");
RETURN_THROWS();
}
- if (!name_len) {
+ if (name && !name_len) {
zend_argument_value_error(ERROR_ARG_POS(3), "cannot be empty");
RETURN_THROWS();
}