@@ -942,13 +942,16 @@ PHP_METHOD(SQLite3, createFunction)
942
942
zend_long flags = 0 ;
943
943
db_obj = Z_SQLITE3_DB_P (object );
944
944
945
- if (zend_parse_parameters (ZEND_NUM_ARGS (), "sf|ll" , & sql_func , & sql_func_len , & fci , & fcc , & sql_func_num_args , & flags ) == FAILURE ) {
945
+ if (zend_parse_parameters (ZEND_NUM_ARGS (), "sF|ll" , & sql_func , & sql_func_len , & fci , & fcc , & sql_func_num_args , & flags ) == FAILURE ) {
946
+ zend_release_fcall_info_cache (& fcc );
946
947
RETURN_THROWS ();
947
948
}
948
949
949
950
SQLITE3_CHECK_INITIALIZED (db_obj , db_obj -> initialised , SQLite3 )
950
951
951
952
if (!sql_func_len ) {
953
+ /* TODO Add warning/ValueError that name cannot be empty? */
954
+ zend_release_fcall_info_cache (& fcc );
952
955
RETURN_FALSE ;
953
956
}
954
957
@@ -990,13 +993,18 @@ PHP_METHOD(SQLite3, createAggregate)
990
993
zend_long sql_func_num_args = -1 ;
991
994
db_obj = Z_SQLITE3_DB_P (object );
992
995
993
- 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 ) {
996
+ 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 ) {
997
+ zend_release_fcall_info_cache (& step_fcc );
998
+ zend_release_fcall_info_cache (& fini_fcc );
994
999
RETURN_THROWS ();
995
1000
}
996
1001
997
1002
SQLITE3_CHECK_INITIALIZED (db_obj , db_obj -> initialised , SQLite3 )
998
1003
999
1004
if (!sql_func_len ) {
1005
+ /* TODO Add warning/ValueError that name cannot be empty? */
1006
+ zend_release_fcall_info_cache (& step_fcc );
1007
+ zend_release_fcall_info_cache (& fini_fcc );
1000
1008
RETURN_FALSE ;
1001
1009
}
1002
1010
@@ -1005,19 +1013,7 @@ PHP_METHOD(SQLite3, createAggregate)
1005
1013
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 ) {
1006
1014
func -> func_name = estrdup (sql_func );
1007
1015
1008
- if (!ZEND_FCC_INITIALIZED (step_fcc )) {
1009
- /* Call trampoline has been cleared by zpp. Refetch it, because we want to deal
1010
- * with it outselves. It is important that it is not refetched on every call,
1011
- * because calls may occur from different scopes. */
1012
- zend_is_callable_ex (& step_fci .function_name , NULL , IS_CALLABLE_SUPPRESS_DEPRECATIONS , NULL , & step_fcc , NULL );
1013
- }
1014
1016
zend_fcc_dup (& func -> step , & step_fcc );
1015
- if (!ZEND_FCC_INITIALIZED (fini_fcc )) {
1016
- /* Call trampoline has been cleared by zpp. Refetch it, because we want to deal
1017
- * with it outselves. It is important that it is not refetched on every call,
1018
- * because calls may occur from different scopes. */
1019
- zend_is_callable_ex (& fini_fci .function_name , NULL , IS_CALLABLE_SUPPRESS_DEPRECATIONS , NULL , & fini_fcc , NULL );
1020
- }
1021
1017
zend_fcc_dup (& func -> fini , & fini_fcc );
1022
1018
1023
1019
func -> argc = sql_func_num_args ;
@@ -1044,26 +1040,22 @@ PHP_METHOD(SQLite3, createCollation)
1044
1040
zend_fcall_info_cache fcc ;
1045
1041
db_obj = Z_SQLITE3_DB_P (object );
1046
1042
1047
- if (zend_parse_parameters (ZEND_NUM_ARGS (), "sf " , & collation_name , & collation_name_len , & fci , & fcc ) == FAILURE ) {
1043
+ if (zend_parse_parameters (ZEND_NUM_ARGS (), "sF " , & collation_name , & collation_name_len , & fci , & fcc ) == FAILURE ) {
1048
1044
RETURN_THROWS ();
1049
1045
}
1050
1046
1051
1047
SQLITE3_CHECK_INITIALIZED (db_obj , db_obj -> initialised , SQLite3 )
1052
1048
1053
1049
if (!collation_name_len ) {
1050
+ /* TODO Add warning/ValueError that name cannot be empty? */
1051
+ zend_release_fcall_info_cache (& fcc );
1054
1052
RETURN_FALSE ;
1055
1053
}
1056
1054
1057
1055
collation = (php_sqlite3_collation * )ecalloc (1 , sizeof (* collation ));
1058
1056
if (sqlite3_create_collation (db_obj -> db , collation_name , SQLITE_UTF8 , collation , php_sqlite3_callback_compare ) == SQLITE_OK ) {
1059
1057
collation -> collation_name = estrdup (collation_name );
1060
1058
1061
- if (!ZEND_FCC_INITIALIZED (fcc )) {
1062
- /* Call trampoline has been cleared by zpp. Refetch it, because we want to deal
1063
- * with it outselves. It is important that it is not refetched on every call,
1064
- * because calls may occur from different scopes. */
1065
- zend_is_callable_ex (& fci .function_name , NULL , IS_CALLABLE_SUPPRESS_DEPRECATIONS , NULL , & fcc , NULL );
1066
- }
1067
1059
zend_fcc_dup (& collation -> cmp_func , & fcc );
1068
1060
1069
1061
collation -> next = db_obj -> collations ;
@@ -1317,7 +1309,7 @@ PHP_METHOD(SQLite3, setAuthorizer)
1317
1309
zend_fcall_info_cache fcc ;
1318
1310
1319
1311
ZEND_PARSE_PARAMETERS_START (1 , 1 )
1320
- Z_PARAM_FUNC_OR_NULL (fci , fcc )
1312
+ Z_PARAM_FUNC_NO_TRAMPOLINE_FREE_OR_NULL (fci , fcc )
1321
1313
ZEND_PARSE_PARAMETERS_END ();
1322
1314
1323
1315
SQLITE3_CHECK_INITIALIZED (db_obj , db_obj -> initialised , SQLite3 )
@@ -1329,14 +1321,7 @@ PHP_METHOD(SQLite3, setAuthorizer)
1329
1321
1330
1322
/* Only enable userland authorizer if argument is not NULL */
1331
1323
if (ZEND_FCI_INITIALIZED (fci )) {
1332
- if (!ZEND_FCC_INITIALIZED (fcc )) {
1333
- zend_is_callable_ex (& fci .function_name , NULL , IS_CALLABLE_SUPPRESS_DEPRECATIONS , NULL , & fcc , NULL );
1334
- /* Call trampoline has been cleared by zpp. Refetch it, because we want to deal
1335
- * with it outselves. It is important that it is not refetched on every call,
1336
- * because calls may occur from different scopes. */
1337
- }
1338
- db_obj -> authorizer_fcc = fcc ;
1339
- zend_fcc_addref (& db_obj -> authorizer_fcc );
1324
+ zend_fcc_dup (& db_obj -> authorizer_fcc , & fcc );
1340
1325
}
1341
1326
1342
1327
RETURN_TRUE ;
0 commit comments