Skip to content

Commit 7be8c15

Browse files
committed
ValueError for empty query in PDO::exec()
1 parent b2bc9f3 commit 7be8c15

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

ext/pdo/pdo_dbh.c

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -943,11 +943,11 @@ PHP_METHOD(PDO, exec)
943943
Z_PARAM_STRING(statement, statement_len)
944944
ZEND_PARSE_PARAMETERS_END();
945945

946-
if (!statement_len) {
947-
/* TODO ValueError */
948-
pdo_raise_impl_error(dbh, NULL, "HY000", "trying to execute an empty query");
949-
RETURN_FALSE;
946+
if (statement_len == 0) {
947+
zend_argument_value_error(1, "cannot be empty");
948+
RETURN_THROWS();
950949
}
950+
951951
PDO_DBH_CLEAR_ERR();
952952
PDO_CONSTRUCT_CHECK;
953953
ret = dbh->methods->doer(dbh, statement, statement_len);

0 commit comments

Comments
 (0)