From 4b7020fbbb190b6a069e4f5007f0c016d9da4e0a Mon Sep 17 00:00:00 2001 From: DubbleClick Date: Tue, 22 Jul 2025 19:01:46 +0700 Subject: [PATCH] also escape if it contains a space --- src/SPC/builder/Extension.php | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/SPC/builder/Extension.php b/src/SPC/builder/Extension.php index c34875ac..9770b62a 100644 --- a/src/SPC/builder/Extension.php +++ b/src/SPC/builder/Extension.php @@ -4,7 +4,6 @@ declare(strict_types=1); namespace SPC\builder; -use PharIo\Version\BuildMetaData; use SPC\exception\FileSystemException; use SPC\exception\RuntimeException; use SPC\exception\WrongUsageException; @@ -84,7 +83,7 @@ class Extension */ public function getEnableArg(bool $shared = false): string { - $escapedPath = str_contains(BUILD_ROOT_PATH, ' ') ? '"' . BUILD_ROOT_PATH . '"' : BUILD_ROOT_PATH; + $escapedPath = str_replace("'", '', escapeshellarg(BUILD_ROOT_PATH)) !== BUILD_ROOT_PATH || str_contains(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' : '') . ' ',