@@ -764,13 +764,6 @@ static bool do_fetch(pdo_stmt_t *stmt, zval *return_value, enum pdo_fetch_type h
764
764
}
765
765
zval_ptr_dtor (& ce_name_from_column );
766
766
} else {
767
- /* This can happen if the fetch flags are set via PDO::setAttribute()
768
- * $pdo->setAttribute(PDO::ATTR_DEFAULT_FETCH_MODE, PDO::FETCH_CLASS);
769
- * See ext/pdo/tests/bug_38253.phpt */
770
- if (UNEXPECTED (ce == NULL )) {
771
- pdo_raise_impl_error (stmt -> dbh , stmt , "HY000" , "No fetch class specified" );
772
- goto in_fetch_error ;
773
- }
774
767
ctor_arguments = stmt -> fetch .cls .ctor_args ;
775
768
}
776
769
ZEND_ASSERT (ce != NULL );
@@ -795,14 +788,7 @@ static bool do_fetch(pdo_stmt_t *stmt, zval *return_value, enum pdo_fetch_type h
795
788
break ;
796
789
797
790
case PDO_FETCH_INTO :
798
- /* This can happen if the fetch flags are set via PDO::setAttribute()
799
- * $pdo->setAttribute(PDO::ATTR_DEFAULT_FETCH_MODE, PDO::FETCH_INTO);
800
- * See ext/pdo/tests/bug_38253.phpt */
801
- if (stmt -> fetch .into == NULL ) {
802
- pdo_raise_impl_error (stmt -> dbh , stmt , "HY000" , "No fetch-into object specified." );
803
- goto in_fetch_error ;
804
- }
805
-
791
+ ZEND_ASSERT (stmt -> fetch .into != NULL );
806
792
ZVAL_OBJ_COPY (return_value , stmt -> fetch .into );
807
793
808
794
/* We want the behaviour of fetching into an object to be called from the global scope rather
@@ -811,13 +797,7 @@ static bool do_fetch(pdo_stmt_t *stmt, zval *return_value, enum pdo_fetch_type h
811
797
break ;
812
798
813
799
case PDO_FETCH_FUNC :
814
- /* This can happen if the fetch flags are set via PDO::setAttribute()
815
- * $pdo->setAttribute(PDO::ATTR_DEFAULT_FETCH_MODE, PDO::FETCH_FUNC);
816
- * See ext/pdo/tests/bug_38253.phpt */
817
- if (UNEXPECTED (!ZEND_FCC_INITIALIZED (stmt -> fetch .func .fcc ))) {
818
- pdo_raise_impl_error (stmt -> dbh , stmt , "HY000" , "No fetch function specified" );
819
- goto in_fetch_error ;
820
- }
800
+ ZEND_ASSERT (ZEND_FCC_INITIALIZED (stmt -> fetch .func .fcc ));
821
801
/* There will be at most stmt->column_count parameters.
822
802
* However, if we fetch a group key we will have over allocated. */
823
803
fetch_function_params = safe_emalloc (sizeof (zval ), stmt -> column_count , 0 );
@@ -1598,12 +1578,8 @@ void pdo_stmt_free_default_fetch_mode(pdo_stmt_t *stmt)
1598
1578
{
1599
1579
enum pdo_fetch_type default_fetch_mode = stmt -> default_fetch_type & ~PDO_FETCH_FLAGS ;
1600
1580
if (default_fetch_mode == PDO_FETCH_INTO ) {
1601
- /* This can happen if the fetch flags are set via PDO::setAttribute()
1602
- * $pdo->setAttribute(PDO::ATTR_DEFAULT_FETCH_MODE, PDO::FETCH_INTO);
1603
- * See ext/pdo/tests/bug_38253.phpt */
1604
- if (EXPECTED (stmt -> fetch .into != NULL )) {
1605
- OBJ_RELEASE (stmt -> fetch .into );
1606
- }
1581
+ ZEND_ASSERT (stmt -> fetch .into != NULL );
1582
+ OBJ_RELEASE (stmt -> fetch .into );
1607
1583
} else if (default_fetch_mode == PDO_FETCH_CLASS ) {
1608
1584
if (stmt -> fetch .cls .ctor_args != NULL ) {
1609
1585
zend_array_release (stmt -> fetch .cls .ctor_args );
0 commit comments