From eaa488368428bb6da9de9ffde562093e8e35d76a Mon Sep 17 00:00:00 2001 From: 953446 <128539227+953446@users.noreply.github.com> Date: Fri, 11 Oct 2024 22:45:51 +0700 Subject: [PATCH] =?UTF-8?q?swoole=E5=8D=8F=E7=A8=8B=E7=8A=B6=E6=80=81?= =?UTF-8?q?=E4=B8=8B=E6=97=A0=E6=B3=95=E8=AF=BB=E5=8F=96=E7=9B=AE=E5=BD=95?= =?UTF-8?q?=20=E5=88=A4=E6=96=AD=E6=98=AF=E5=90=A6=E6=9C=89=E6=8C=87?= =?UTF-8?q?=E5=AE=9A=E8=B7=AF=E5=BE=84=20=E6=B2=A1=E6=9C=89=E5=B0=B1?= =?UTF-8?q?=E4=BD=BF=E7=94=A8=E5=BD=93=E5=89=8D=E7=9B=AE=E5=BD=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/Magic.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/Magic.php b/src/Magic.php index 82360ed7d..3d1a7b532 100644 --- a/src/Magic.php +++ b/src/Magic.php @@ -235,7 +235,8 @@ final class Magic self::$isIpcWorker = \defined('MADELINE_WORKER_TYPE') ? MADELINE_WORKER_TYPE === 'madeline-ipc' : false; // Important, obtain root relative to caller script $backtrace = debug_backtrace(0); - self::$script_cwd = self::$cwd = \dirname(end($backtrace)['file']); + $lastTrace = end($backtrace); + self::$script_cwd = self::$cwd = isset($lastTrace['file']) ? \dirname($lastTrace['file']) : getcwd(); if (PHP_SAPI !== 'cli' && PHP_SAPI !== 'phpdbg') { try { error_reporting(E_ALL);