Skip to content

Commit 8feb2d4

Browse files
committed
Turns out we cannot assert this due to the setAttribute() hack...
1 parent 9c66a1e commit 8feb2d4

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

ext/pdo/pdo_stmt.c

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1581,8 +1581,12 @@ void pdo_stmt_free_default_fetch_mode(pdo_stmt_t *stmt)
15811581
{
15821582
enum pdo_fetch_type default_fetch_mode = stmt->default_fetch_type & ~PDO_FETCH_FLAGS;
15831583
if (default_fetch_mode == PDO_FETCH_INTO) {
1584-
ZEND_ASSERT(stmt->fetch.into != NULL);
1585-
OBJ_RELEASE(stmt->fetch.into);
1584+
/* This can happen if the fetch flags are set via PDO::setAttribute()
1585+
* $pdo->setAttribute(PDO::ATTR_DEFAULT_FETCH_MODE, PDO::FETCH_INTO);
1586+
* See ext/pdo/tests/bug_38253.phpt */
1587+
if (EXPECTED(stmt->fetch.into != NULL)) {
1588+
OBJ_RELEASE(stmt->fetch.into);
1589+
}
15861590
} else if (default_fetch_mode == PDO_FETCH_CLASS) {
15871591
if (stmt->fetch.cls.ctor_args != NULL) {
15881592
zend_hash_release(stmt->fetch.cls.ctor_args);

0 commit comments

Comments
 (0)