Skip to content

Commit 595a0b8

Browse files
committed
ValueError for incorrect Fetch Flag usage
1 parent 344829d commit 595a0b8

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

ext/pdo/pdo_stmt.c

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1137,24 +1137,24 @@ static bool pdo_stmt_verify_mode(pdo_stmt_t *stmt, zend_long mode, uint32_t mode
11371137
switch(mode) {
11381138
case PDO_FETCH_FUNC:
11391139
if (!fetch_all) {
1140-
pdo_raise_impl_error(stmt->dbh, stmt, "HY000", "PDO::FETCH_FUNC is only allowed in PDOStatement::fetchAll()");
1140+
zend_argument_value_error(mode_arg_num, "can only use PDO::FETCH_FUNC in PDOStatement::fetchAll()");
11411141
return 0;
11421142
}
11431143
return 1;
11441144

11451145
case PDO_FETCH_LAZY:
11461146
if (fetch_all) {
1147-
pdo_raise_impl_error(stmt->dbh, stmt, "HY000", "PDO::FETCH_LAZY can't be used with PDOStatement::fetchAll()");
1147+
zend_argument_value_error(mode_arg_num, "cannot use PDO::FETCH_LAZY in PDOStatement::fetchAll()");
11481148
return 0;
11491149
}
11501150
/* fall through */
11511151
default:
11521152
if ((flags & PDO_FETCH_SERIALIZE) == PDO_FETCH_SERIALIZE) {
1153-
pdo_raise_impl_error(stmt->dbh, stmt, "HY000", "PDO::FETCH_SERIALIZE can only be used together with PDO::FETCH_CLASS");
1153+
zend_argument_value_error(mode_arg_num, "must use PDO::FETCH_SERIALIZE with PDO::FETCH_CLASS");
11541154
return 0;
11551155
}
11561156
if ((flags & PDO_FETCH_CLASSTYPE) == PDO_FETCH_CLASSTYPE) {
1157-
pdo_raise_impl_error(stmt->dbh, stmt, "HY000", "PDO::FETCH_CLASSTYPE can only be used together with PDO::FETCH_CLASS");
1157+
zend_argument_value_error(mode_arg_num, "must use PDO::FETCH_CLASSTYPE with PDO::FETCH_CLASS");
11581158
return 0;
11591159
}
11601160
if (mode >= PDO_FETCH__MAX) {

0 commit comments

Comments
 (0)