Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 6 additions & 6 deletions ext/pdo/pdo_stmt.c
Original file line number Diff line number Diff line change
Expand Up @@ -1729,18 +1729,16 @@ bool pdo_stmt_setup_fetch_mode(pdo_stmt_t *stmt, zend_long mode, uint32_t mode_a
;
}

stmt->default_fetch_type = PDO_FETCH_BOTH;
stmt->default_fetch_type = stmt->dbh->default_fetch_type;

flags = mode & PDO_FETCH_FLAGS;

if ((mode & ~PDO_FETCH_FLAGS) == PDO_FETCH_USE_DEFAULT) {
mode = stmt->dbh->default_fetch_type | flags;
}

if (!pdo_stmt_verify_mode(stmt, mode, mode_arg_num, false)) {
return false;
}

bool use_default = (mode & ~PDO_FETCH_FLAGS) == PDO_FETCH_USE_DEFAULT;

switch (mode & ~PDO_FETCH_FLAGS) {
case PDO_FETCH_USE_DEFAULT:
case PDO_FETCH_LAZY:
Expand Down Expand Up @@ -1862,7 +1860,9 @@ bool pdo_stmt_setup_fetch_mode(pdo_stmt_t *stmt, zend_long mode, uint32_t mode_a
return false;
}

stmt->default_fetch_type = mode;
if (!use_default) {
stmt->default_fetch_type = mode;
}

return true;
}
Expand Down
Loading