Skip to content

Commit b35bf56

Browse files
committed
Call opcache_reset PHP function directly
1 parent 072151d commit b35bf56

File tree

2 files changed

+5
-6
lines changed

2 files changed

+5
-6
lines changed

frankenphp.c

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1252,12 +1252,11 @@ int frankenphp_execute_php_function(const char *php_function) {
12521252
return success;
12531253
}
12541254

1255-
int frankenphp_reset_opcache(void) {
1256-
if (zend_hash_str_exists(CG(function_table), "opcache_reset",
1257-
sizeof("opcache_reset") - 1)) {
1258-
return frankenphp_execute_php_function("opcache_reset");
1255+
void frankenphp_reset_opcache(void) {
1256+
zend_function *opcache_reset = zend_hash_str_find_ptr(CG(function_table), ZEND_STRL("opcache_reset"));
1257+
if (opcache_reset) {
1258+
zend_call_known_function(opcache_reset, NULL, NULL, NULL, 0, NULL, NULL);
12591259
}
1260-
return 0;
12611260
}
12621261

12631262
int frankenphp_get_current_memory_limit() { return PG(memory_limit); }

frankenphp.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,7 @@ void frankenphp_register_variable_safe(char *key, char *var, size_t val_len,
7070
zval *track_vars_array);
7171
zend_string *frankenphp_init_persistent_string(const char *string, size_t len);
7272
void frankenphp_release_zend_string(zend_string *z_string);
73-
int frankenphp_reset_opcache(void);
73+
void frankenphp_reset_opcache(void);
7474
int frankenphp_get_current_memory_limit();
7575

7676
void frankenphp_register_single(zend_string *z_key, char *value, size_t val_len,

0 commit comments

Comments
 (0)