Skip to content

Commit a247742

Browse files
committed
Assertion + always throw on invalid Fetch mode
1 parent dc55eda commit a247742

File tree

1 file changed

+2
-6
lines changed

1 file changed

+2
-6
lines changed

ext/pdo/pdo_stmt.c

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -923,10 +923,7 @@ static bool do_fetch(pdo_stmt_t *stmt, zval *return_value, enum pdo_fetch_type h
923923
}
924924
}
925925
break;
926-
927-
default:
928-
/* shouldn't happen */
929-
return 0;
926+
EMPTY_SWITCH_DEFAULT_CASE();
930927
}
931928

932929
if (return_all && how != PDO_FETCH_KEY_PAIR) {
@@ -1052,9 +1049,8 @@ static bool do_fetch(pdo_stmt_t *stmt, zval *return_value, enum pdo_fetch_type h
10521049

10531050
default:
10541051
zval_ptr_dtor(&val);
1055-
pdo_raise_impl_error(stmt->dbh, stmt, "22003", "mode is out of range");
1052+
zend_value_error("Fetch mode must be a bitmask of PDO::FETCH_* constants");
10561053
return 0;
1057-
break;
10581054
}
10591055
}
10601056

0 commit comments

Comments
 (0)