@@ -455,7 +455,7 @@ static zval *pdo_stmt_instantiate(pdo_dbh_t *dbh, zval *object, zend_class_entry
455455 return object ;
456456} /* }}} */
457457
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 )
459459{
460460 zval query_string ;
461461 zend_string * key ;
@@ -466,32 +466,9 @@ static void pdo_stmt_construct(zend_execute_data *execute_data, pdo_stmt_t *stmt
466466 zend_string_release_ex (key , 0 );
467467
468468 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 );
492470 }
493471}
494- /* }}} */
495472
496473/* {{{ Prepares a statement for execution and returns a statement object */
497474PHP_METHOD (PDO , prepare )
@@ -572,7 +549,11 @@ PHP_METHOD(PDO, prepare)
572549 ZVAL_UNDEF (& stmt -> lazy_object_ref );
573550
574551 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+ }
576557 return ;
577558 }
578559
@@ -1141,7 +1122,11 @@ PHP_METHOD(PDO, query)
11411122 stmt -> executed = 1 ;
11421123 }
11431124 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+ }
11451130 return ;
11461131 }
11471132 }
0 commit comments