@@ -994,24 +994,14 @@ PHP_METHOD(SQLite3, createAggregate)
994
994
zend_long sql_func_num_args = -1 ;
995
995
db_obj = Z_SQLITE3_DB_P (object );
996
996
997
- if (zend_parse_parameters (ZEND_NUM_ARGS (), "sFF|l" , & sql_func , & sql_func_len , & step_fci , & step_fcc , & fini_fci , & fini_fcc , & sql_func_num_args ) == FAILURE ) {
998
- zend_release_fcall_info_cache (& step_fcc );
999
- zend_release_fcall_info_cache (& fini_fcc );
997
+ if (zend_parse_parameters (ZEND_NUM_ARGS (), "sff|l" , & sql_func , & sql_func_len , & step_fci , & step_fcc , & fini_fci , & fini_fcc , & sql_func_num_args ) == FAILURE ) {
1000
998
RETURN_THROWS ();
1001
999
}
1002
1000
1003
- /* Cannot use SQLITE3_CHECK_INITIALIZED_FREE_TRAMPOLINE() as we have 2 FCCs */
1004
- if (!db_obj || !db_obj -> initialised ) {
1005
- zend_release_fcall_info_cache (& step_fcc );
1006
- zend_release_fcall_info_cache (& fini_fcc );
1007
- zend_throw_error (NULL , "The SQLite3 object has not been correctly initialised or is already closed" );
1008
- RETURN_THROWS ();
1009
- }
1001
+ SQLITE3_CHECK_INITIALIZED (db_obj , db_obj -> initialised , SQLite3 )
1010
1002
1011
1003
if (!sql_func_len ) {
1012
1004
/* TODO Add warning/ValueError that name cannot be empty? */
1013
- zend_release_fcall_info_cache (& step_fcc );
1014
- zend_release_fcall_info_cache (& fini_fcc );
1015
1005
RETURN_FALSE ;
1016
1006
}
1017
1007
@@ -1020,7 +1010,19 @@ PHP_METHOD(SQLite3, createAggregate)
1020
1010
if (sqlite3_create_function (db_obj -> db , sql_func , sql_func_num_args , SQLITE_UTF8 , func , NULL , php_sqlite3_callback_step , php_sqlite3_callback_final ) == SQLITE_OK ) {
1021
1011
func -> func_name = estrdup (sql_func );
1022
1012
1013
+ if (!ZEND_FCC_INITIALIZED (step_fcc )) {
1014
+ /* Call trampoline has been cleared by zpp. Refetch it, because we want to deal
1015
+ * with it outselves. It is important that it is not refetched on every call,
1016
+ * because calls may occur from different scopes. */
1017
+ zend_is_callable_ex (& step_fci .function_name , NULL , IS_CALLABLE_SUPPRESS_DEPRECATIONS , NULL , & step_fcc , NULL );
1018
+ }
1023
1019
zend_fcc_dup (& func -> step , & step_fcc );
1020
+ if (!ZEND_FCC_INITIALIZED (fini_fcc )) {
1021
+ /* Call trampoline has been cleared by zpp. Refetch it, because we want to deal
1022
+ * with it outselves. It is important that it is not refetched on every call,
1023
+ * because calls may occur from different scopes. */
1024
+ zend_is_callable_ex (& fini_fci .function_name , NULL , IS_CALLABLE_SUPPRESS_DEPRECATIONS , NULL , & fini_fcc , NULL );
1025
+ }
1024
1026
zend_fcc_dup (& func -> fini , & fini_fcc );
1025
1027
1026
1028
func -> argc = sql_func_num_args ;
@@ -1030,8 +1032,6 @@ PHP_METHOD(SQLite3, createAggregate)
1030
1032
RETURN_TRUE ;
1031
1033
}
1032
1034
efree (func );
1033
- zend_release_fcall_info_cache (& step_fcc );
1034
- zend_release_fcall_info_cache (& fini_fcc );
1035
1035
1036
1036
RETURN_FALSE ;
1037
1037
}
0 commit comments