Commit 2c928d8368c9d6ee0d9c38e40f2ef1b83ee6079d

Authored by 谭苏航
1 parent b5e5f922

fix: CGI env emulation for admin portal

Showing 1 changed file with 6 additions and 3 deletions
@@ -690,9 +690,12 @@ $http_worker->onMessage = function ($connection, $request) use ($config, $authSe @@ -690,9 +690,12 @@ $http_worker->onMessage = function ($connection, $request) use ($config, $authSe
690 if ($ext === 'php') { 690 if ($ext === 'php') {
691 ob_start(); 691 ob_start();
692 try { 692 try {
693 - // Make request variables available to the included script  
694 - // Workerman already populates $_GET, $_POST, $_COOKIE, $_SERVER, $_FILES locally for the worker context  
695 - // But we explicitly ensure it inside the closure 693 + // Explicitly populate superglobals for the included script
  694 + $_SERVER['REQUEST_METHOD'] = $request->method();
  695 + $_SERVER['REQUEST_URI'] = $request->uri();
  696 + $_GET = $request->get();
  697 + $_POST = $request->post();
  698 + $_FILES = $request->file();
696 699
697 require $file; 700 require $file;
698 $content = ob_get_clean(); 701 $content = ob_get_clean();
Please register or login to post a comment