Browse Source

remove opcache_reset (#1173)

* remove opcache_reset

* reset opcache if the function exists

* simplify the check

* reformat
Rob Landers 3 months ago
parent
commit
0c123a2563
3 changed files with 10 additions and 1 deletions
  1. 8 0
      frankenphp.c
  2. 1 0
      frankenphp.h
  3. 1 1
      worker.go

+ 8 - 0
frankenphp.c

@@ -1169,3 +1169,11 @@ int frankenphp_execute_php_function(const char *php_function) {
 
   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");
+  }
+  return 0;
+}

+ 1 - 0
frankenphp.h

@@ -66,5 +66,6 @@ void frankenphp_register_trusted_var(zend_string *z_key, char *value,
                                      int val_len, zval *track_vars_array);
 zend_string *frankenphp_init_persistent_string(const char *string, size_t len);
 void frankenphp_release_zend_string(zend_string *z_string);
+int frankenphp_reset_opcache(void);
 
 #endif

+ 1 - 1
worker.go

@@ -289,7 +289,7 @@ func go_frankenphp_worker_handle_request_start(threadIndex C.uintptr_t) C.bool {
 			c.Write(zap.String("worker", thread.worker.fileName))
 		}
 		thread.worker = nil
-		executePHPFunction("opcache_reset")
+		C.frankenphp_reset_opcache()
 
 		return C.bool(false)
 	case r = <-thread.worker.requestChan: