Skip to content

Commit f84ca8d

Browse files
committed
Introduce ValueError for empty bind param names
1 parent d6e04a3 commit f84ca8d

File tree

2 files changed

+9
-1
lines changed

2 files changed

+9
-1
lines changed

ext/pdo/pdo_stmt.c

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1466,6 +1466,10 @@ static void register_bound_param(INTERNAL_FUNCTION_PARAMETERS, int is_param) /*
14661466
param.param_type = (int) param_type;
14671467

14681468
if (param.name) {
1469+
if (ZSTR_LEN(param.name) == 0) {
1470+
zend_argument_value_error(1, "cannot be empty");
1471+
RETURN_THROWS();
1472+
}
14691473
param.paramno = -1;
14701474
} else if (param.paramno > 0) {
14711475
--param.paramno; /* make it zero-based internally */
@@ -1510,6 +1514,10 @@ PHP_METHOD(PDOStatement, bindValue)
15101514
param.param_type = (int) param_type;
15111515

15121516
if (param.name) {
1517+
if (ZSTR_LEN(param.name) == 0) {
1518+
zend_argument_value_error(1, "cannot be empty");
1519+
RETURN_THROWS();
1520+
}
15131521
param.paramno = -1;
15141522
} else if (param.paramno > 0) {
15151523
--param.paramno; /* make it zero-based internally */

ext/pdo/pdo_stmt_arginfo.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/* This is a generated file, edit the .stub.php file instead.
2-
* Stub hash: 6d360d7d412e0ebbbc466f8abf104f3969eae738 */
2+
* Stub hash: 395813e5ab7b565718430dd17b8da3fc54889eeb */
33

44
ZEND_BEGIN_ARG_INFO_EX(arginfo_class_PDOStatement_bindColumn, 0, 0, 2)
55
ZEND_ARG_TYPE_MASK(0, column, MAY_BE_STRING|MAY_BE_LONG, NULL)

0 commit comments

Comments
 (0)