@@ -455,7 +455,7 @@ static zval *pdo_stmt_instantiate(pdo_dbh_t *dbh, zval *object, zend_class_entry
455
455
return object ;
456
456
} /* }}} */
457
457
458
- static void pdo_stmt_construct (zend_execute_data * execute_data , pdo_stmt_t * stmt , zval * object , zend_class_entry * dbstmt_ce , zval * ctor_args ) /* {{{ */
458
+ static void pdo_stmt_construct (pdo_stmt_t * stmt , zval * object , zend_class_entry * dbstmt_ce , HashTable * ctor_args )
459
459
{
460
460
zval query_string ;
461
461
zend_string * key ;
@@ -466,32 +466,9 @@ static void pdo_stmt_construct(zend_execute_data *execute_data, pdo_stmt_t *stmt
466
466
zend_string_release_ex (key , 0 );
467
467
468
468
if (dbstmt_ce -> constructor ) {
469
- zend_fcall_info fci ;
470
- zend_fcall_info_cache fcc ;
471
- zval retval ;
472
-
473
- fci .size = sizeof (zend_fcall_info );
474
- ZVAL_UNDEF (& fci .function_name );
475
- fci .object = Z_OBJ_P (object );
476
- fci .retval = & retval ;
477
- fci .param_count = 0 ;
478
- fci .params = NULL ;
479
- fci .named_params = NULL ;
480
-
481
- zend_fcall_info_args (& fci , ctor_args );
482
-
483
- fcc .function_handler = dbstmt_ce -> constructor ;
484
- fcc .called_scope = Z_OBJCE_P (object );
485
- fcc .object = Z_OBJ_P (object );
486
-
487
- if (zend_call_function (& fci , & fcc ) != FAILURE ) {
488
- zval_ptr_dtor (& retval );
489
- }
490
-
491
- zend_fcall_info_args_clear (& fci , 1 );
469
+ zend_call_known_function (dbstmt_ce -> constructor , Z_OBJ_P (object ), Z_OBJCE_P (object ), NULL , 0 , NULL , ctor_args );
492
470
}
493
471
}
494
- /* }}} */
495
472
496
473
/* {{{ Prepares a statement for execution and returns a statement object */
497
474
PHP_METHOD (PDO , prepare )
@@ -572,7 +549,11 @@ PHP_METHOD(PDO, prepare)
572
549
ZVAL_UNDEF (& stmt -> lazy_object_ref );
573
550
574
551
if (dbh -> methods -> preparer (dbh , statement , stmt , options )) {
575
- pdo_stmt_construct (execute_data , stmt , return_value , dbstmt_ce , & ctor_args );
552
+ if (Z_TYPE (ctor_args ) == IS_ARRAY ) {
553
+ pdo_stmt_construct (stmt , return_value , dbstmt_ce , Z_ARRVAL (ctor_args ));
554
+ } else {
555
+ pdo_stmt_construct (stmt , return_value , dbstmt_ce , /* ctor_args */ NULL );
556
+ }
576
557
return ;
577
558
}
578
559
@@ -1141,7 +1122,11 @@ PHP_METHOD(PDO, query)
1141
1122
stmt -> executed = 1 ;
1142
1123
}
1143
1124
if (ret ) {
1144
- pdo_stmt_construct (execute_data , stmt , return_value , dbh -> def_stmt_ce , & dbh -> def_stmt_ctor_args );
1125
+ if (Z_TYPE (dbh -> def_stmt_ctor_args ) == IS_ARRAY ) {
1126
+ pdo_stmt_construct (stmt , return_value , dbh -> def_stmt_ce , Z_ARRVAL (dbh -> def_stmt_ctor_args ));
1127
+ } else {
1128
+ pdo_stmt_construct (stmt , return_value , dbh -> def_stmt_ce , /* ctor_args */ NULL );
1129
+ }
1145
1130
return ;
1146
1131
}
1147
1132
}
0 commit comments