"exceptions". See https://www.php.net/manual/en/pdo.error-handling.php
for details of behavior changes and how to explicitly set this attribute.
RFC: https://wiki.php.net/rfc/pdo_default_errmode
- . The method PDOStatement::setFetchMode() now accepts the following signature:
+ . The signatures of some PDO methods have changed:
- PDOStatement::setFetchMode($mode, $classname, $params)
+ PDO::query(
+ string $statement, ?int $fetch_mode = null, ...$fetch_mode_args)
+ PDOStatement::setFetchMode(int $mode, ...$params)
- PDO_ODBC:
. The php.ini directive pdo_odbc.db2_instance_name has been removed
char *statement;
size_t statement_len;
zend_long fetch_mode;
+ zend_bool fetch_mode_is_null = 1;
zval *args = NULL;
uint32_t num_args = 0;
pdo_dbh_object_t *dbh_obj = Z_PDO_OBJECT_P(ZEND_THIS);
pdo_dbh_t *dbh = dbh_obj->inner;
- if (FAILURE == zend_parse_parameters(ZEND_NUM_ARGS(), "s|l*", &statement, &statement_len, &fetch_mode, &args, &num_args)) {
+ if (FAILURE == zend_parse_parameters(ZEND_NUM_ARGS(), "s|l!*", &statement, &statement_len, &fetch_mode, &fetch_mode_is_null, &args, &num_args)) {
RETURN_THROWS();
}
if (dbh->methods->preparer(dbh, statement, statement_len, stmt, NULL)) {
PDO_STMT_CLEAR_ERR();
- if (ZEND_NUM_ARGS() == 1 || SUCCESS == pdo_stmt_setup_fetch_mode(stmt, fetch_mode, args, num_args)) {
+ if (fetch_mode_is_null || SUCCESS == pdo_stmt_setup_fetch_mode(stmt, fetch_mode, args, num_args)) {
/* now execute the statement */
PDO_STMT_CLEAR_ERR();
public function prepare(string $statement, array $driver_options = []) {}
/** @return PDOStatement|false */
- public function query(string $statement, int $fetch_mode = UNKNOWN, ...$fetch_mode_args) {}
+ public function query(string $statement, ?int $fetch_mode = null, ...$fetch_mode_args) {}
/** @return string|false */
public function quote(string $string, int $parameter_type = PDO::PARAM_STR) {}
/* This is a generated file, edit the .stub.php file instead.
- * Stub hash: c329bfda55244467a2cd62f9d5c5120ec3f24eef */
+ * Stub hash: 36270d1418fc4ddd8f79018372b0ef00fb6f5889 */
ZEND_BEGIN_ARG_INFO_EX(arginfo_class_PDO___construct, 0, 0, 1)
ZEND_ARG_TYPE_INFO(0, dsn, IS_STRING, 0)
ZEND_BEGIN_ARG_INFO_EX(arginfo_class_PDO_query, 0, 0, 1)
ZEND_ARG_TYPE_INFO(0, statement, IS_STRING, 0)
- ZEND_ARG_TYPE_INFO(0, fetch_mode, IS_LONG, 0)
+ ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, fetch_mode, IS_LONG, 1, "null")
ZEND_ARG_VARIADIC_INFO(0, fetch_mode_args)
ZEND_END_ARG_INFO()
--EXPECTF--
Warning: PDO::query(): SQLSTATE[HY000]: General error: fetch mode doesn't allow any extra arguments in %s
bool(false)
-PDO::query(): Argument #2 ($fetch_mode) must be of type int, string given
+PDO::query(): Argument #2 ($fetch_mode) must be of type ?int, string given
Warning: PDO::query(): SQLSTATE[HY000]: General error: too many arguments in %s
bool(false)