Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
27 changes: 5 additions & 22 deletions frankenphp.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}

Expand Down
7 changes: 0 additions & 7 deletions frankenphp.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 0 additions & 2 deletions frankenphp.h
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down