@@ -155,7 +155,6 @@ PHP_METHOD(SQLite3, open)
155
155
#endif
156
156
157
157
db_obj -> initialised = 1 ;
158
- db_obj -> authorizer_fci = empty_fcall_info ;
159
158
db_obj -> authorizer_fcc = empty_fcall_info_cache ;
160
159
161
160
sqlite3_set_authorizer (db_obj -> db , php_sqlite3_authorizer , db_obj );
@@ -1296,16 +1295,15 @@ PHP_METHOD(SQLite3, setAuthorizer)
1296
1295
SQLITE3_CHECK_INITIALIZED (db_obj , db_obj -> initialised , SQLite3 )
1297
1296
1298
1297
/* Clear previously set callback */
1299
- if (ZEND_FCI_INITIALIZED (db_obj -> authorizer_fci )) {
1300
- zval_ptr_dtor (& db_obj -> authorizer_fci . function_name );
1301
- db_obj -> authorizer_fci . size = 0 ;
1298
+ if (ZEND_FCC_INITIALIZED (db_obj -> authorizer_fcc )) {
1299
+ zend_fcc_dtor (& db_obj -> authorizer_fcc );
1300
+ memcpy ( & db_obj -> authorizer_fcc , & empty_fcall_info_cache , sizeof ( zend_fcall_info_cache )) ;
1302
1301
}
1303
1302
1304
1303
/* Only enable userland authorizer if argument is not NULL */
1305
1304
if (ZEND_FCI_INITIALIZED (fci )) {
1306
- db_obj -> authorizer_fci = fci ;
1307
- Z_ADDREF (db_obj -> authorizer_fci .function_name );
1308
1305
db_obj -> authorizer_fcc = fcc ;
1306
+ zend_fcc_addref (& db_obj -> authorizer_fcc );
1309
1307
}
1310
1308
1311
1309
RETURN_TRUE ;
@@ -2072,10 +2070,9 @@ static int php_sqlite3_authorizer(void *autharg, int action, const char *arg1, c
2072
2070
}
2073
2071
2074
2072
php_sqlite3_db_object * db_obj = (php_sqlite3_db_object * )autharg ;
2075
- zend_fcall_info * fci = & db_obj -> authorizer_fci ;
2076
2073
2077
2074
/* fallback to access allowed if authorizer callback is not defined */
2078
- if (fci -> size == 0 ) {
2075
+ if (! ZEND_FCC_INITIALIZED ( db_obj -> authorizer_fcc ) ) {
2079
2076
return SQLITE_OK ;
2080
2077
}
2081
2078
@@ -2109,13 +2106,10 @@ static int php_sqlite3_authorizer(void *autharg, int action, const char *arg1, c
2109
2106
ZVAL_STRING (& argv [4 ], arg4 );
2110
2107
}
2111
2108
2112
- fci -> retval = & retval ;
2113
- fci -> param_count = 5 ;
2114
- fci -> params = argv ;
2115
-
2116
2109
int authreturn = SQLITE_DENY ;
2117
2110
2118
- if (zend_call_function (fci , & db_obj -> authorizer_fcc ) != SUCCESS || Z_ISUNDEF (retval )) {
2111
+ zend_call_known_fcc (& db_obj -> authorizer_fcc , & retval , /* argc */ 5 , argv , /* named_params */ NULL );
2112
+ if (Z_ISUNDEF (retval )) {
2119
2113
php_sqlite3_error (db_obj , "An error occurred while invoking the authorizer callback" );
2120
2114
} else {
2121
2115
if (Z_TYPE (retval ) != IS_LONG ) {
@@ -2130,8 +2124,13 @@ static int php_sqlite3_authorizer(void *autharg, int action, const char *arg1, c
2130
2124
}
2131
2125
}
2132
2126
2133
- zend_fcall_info_args_clear ( fci , 0 );
2127
+ /* Free local return and argument values */
2134
2128
zval_ptr_dtor (& retval );
2129
+ zval_ptr_dtor (& argv [0 ]);
2130
+ zval_ptr_dtor (& argv [1 ]);
2131
+ zval_ptr_dtor (& argv [2 ]);
2132
+ zval_ptr_dtor (& argv [3 ]);
2133
+ zval_ptr_dtor (& argv [4 ]);
2135
2134
2136
2135
return authreturn ;
2137
2136
}
@@ -2173,8 +2172,8 @@ static void php_sqlite3_object_free_storage(zend_object *object) /* {{{ */
2173
2172
}
2174
2173
2175
2174
/* Release function_name from authorizer */
2176
- if (intern -> authorizer_fci . size > 0 ) {
2177
- zval_ptr_dtor (& intern -> authorizer_fci . function_name );
2175
+ if (ZEND_FCC_INITIALIZED ( intern -> authorizer_fcc ) ) {
2176
+ zend_fcc_dtor (& intern -> authorizer_fcc );
2178
2177
}
2179
2178
2180
2179
while (intern -> funcs ) {
0 commit comments