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