From bdb705e89a7d4faa95ac25a5d310f0b1ed8da4b9 Mon Sep 17 00:00:00 2001 From: DubbleClick Date: Tue, 22 Jul 2025 18:38:17 +0700 Subject: [PATCH] only escape path if required --- src/SPC/builder/Extension.php | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/SPC/builder/Extension.php b/src/SPC/builder/Extension.php index 590b8149..471cf611 100644 --- a/src/SPC/builder/Extension.php +++ b/src/SPC/builder/Extension.php @@ -83,12 +83,13 @@ class Extension */ public function getEnableArg(bool $shared = false): string { + $escapedPath = str_replace("'", '', escapeshellarg(BUILD_ROOT_PATH)) !== BUILD_ROOT_PATH ? '"' . BUILD_ROOT_PATH . '"' : BUILD_ROOT_PATH; $_name = str_replace('_', '-', $this->name); return match ($arg_type = Config::getExt($this->name, 'arg-type', 'enable')) { 'enable' => '--enable-' . $_name . ($shared ? '=shared' : '') . ' ', - 'enable-path' => '--enable-' . $_name . '=' . ($shared ? 'shared,' : '') . BUILD_ROOT_PATH . ' ', + 'enable-path' => '--enable-' . $_name . '=' . ($shared ? 'shared,' : '') . $escapedPath . ' ', 'with' => '--with-' . $_name . ($shared ? '=shared' : '') . ' ', - 'with-path' => '--with-' . $_name . '=' . ($shared ? 'shared,' : '') . BUILD_ROOT_PATH . ' ', + 'with-path' => '--with-' . $_name . '=' . ($shared ? 'shared,' : '') . $escapedPath . ' ', 'none', 'custom' => '', default => throw new WrongUsageException("argType does not accept {$arg_type}, use [enable/with/with-path] ."), };