diff --git a/frankenphp.c b/frankenphp.c index f9be7a5a22..1c67d2b640 100644 --- a/frankenphp.c +++ b/frankenphp.c @@ -1161,30 +1161,13 @@ int frankenphp_execute_script_cli(char *script, int argc, char **argv) { return (intptr_t)exit_status; } -int frankenphp_execute_php_function(const char *php_function) { - zval retval = {0}; - zend_fcall_info fci = {0}; - zend_fcall_info_cache fci_cache = {0}; - zend_string *func_name = - zend_string_init(php_function, strlen(php_function), 0); - ZVAL_STR(&fci.function_name, func_name); - fci.size = sizeof fci; - fci.retval = &retval; - int success = 0; - - zend_try { success = zend_call_function(&fci, &fci_cache) == SUCCESS; } - zend_end_try(); - - zend_string_release(func_name); - - return success; -} - int frankenphp_reset_opcache(void) { - if (zend_hash_str_exists(CG(function_table), "opcache_reset", - sizeof("opcache_reset") - 1)) { - return frankenphp_execute_php_function("opcache_reset"); + zend_function *opcache_reset = + zend_hash_str_find_ptr(CG(function_table), ZEND_STRL("opcache_reset")); + if (opcache_reset) { + zend_call_known_function(opcache_reset, NULL, NULL, NULL, 0, NULL, NULL); } + return 0; } diff --git a/frankenphp.go b/frankenphp.go index 57d4a7cb3c..17caea1c9b 100644 --- a/frankenphp.go +++ b/frankenphp.go @@ -653,13 +653,6 @@ func freeArgs(argv []*C.char) { } } -func executePHPFunction(functionName string) bool { - cFunctionName := C.CString(functionName) - defer C.free(unsafe.Pointer(cFunctionName)) - - return C.frankenphp_execute_php_function(cFunctionName) == 1 -} - func timeoutChan(timeout time.Duration) <-chan time.Time { if timeout == 0 { return nil diff --git a/frankenphp.h b/frankenphp.h index d47adb47b3..7839bcf7e0 100644 --- a/frankenphp.h +++ b/frankenphp.h @@ -63,8 +63,6 @@ int frankenphp_execute_script(char *file_name); int frankenphp_execute_script_cli(char *script, int argc, char **argv); -int frankenphp_execute_php_function(const char *php_function); - void frankenphp_register_variables_from_request_info( zval *track_vars_array, zend_string *content_type, zend_string *path_translated, zend_string *query_string,