From b8dd50814820a9b5667d118cb9441eabe950ecbd Mon Sep 17 00:00:00 2001 From: henderkes Date: Sun, 24 May 2026 21:38:00 +0700 Subject: [PATCH 1/3] patch: strip trailing U+200E from spc_fix_avx512_cache_before_80400.patch The filename had a Left-To-Right Mark (U+200E) appended invisibly, so the file is unreachable by code that constructs the path from a plain ASCII string literal. Rename to the visible name. --- ...before_80400.patch‎ => spc_fix_avx512_cache_before_80400.patch} | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename src/globals/patch/{spc_fix_avx512_cache_before_80400.patch‎ => spc_fix_avx512_cache_before_80400.patch} (100%) diff --git a/src/globals/patch/spc_fix_avx512_cache_before_80400.patch‎ b/src/globals/patch/spc_fix_avx512_cache_before_80400.patch similarity index 100% rename from src/globals/patch/spc_fix_avx512_cache_before_80400.patch‎ rename to src/globals/patch/spc_fix_avx512_cache_before_80400.patch From c666cd6cd0d05e4ce809f38ebdef498019460d56 Mon Sep 17 00:00:00 2001 From: henderkes Date: Sun, 24 May 2026 21:38:22 +0700 Subject: [PATCH 2/3] deduplicate_flags: keep paired flag+value tokens together deduplicate_flags() split flags on whitespace then ran a per-token unique. For paired flags like `-Xclang -mllvm` or `-framework Cocoa`, where the value is a separate token, the value token could collide with an unrelated flag or value and get dropped, corrupting the command line. Group known paired flags (-Xclang, -Xpreprocessor, -Xlinker, -Xassembler, -framework, -arch, -target, -include, -imacros, -isystem, -isysroot, -iquote, -idirafter, -MT, -MF, -MQ) with their following token into a single atom before the unique pass. --- src/globals/functions.php | 24 ++++++++++++++++++++++-- 1 file changed, 22 insertions(+), 2 deletions(-) diff --git a/src/globals/functions.php b/src/globals/functions.php index 549ef498..c824bd3d 100644 --- a/src/globals/functions.php +++ b/src/globals/functions.php @@ -256,10 +256,30 @@ function clean_spaces(string $string): string */ function deduplicate_flags(string $flags): string { - $tokens = preg_split('/\s+/', trim($flags)); + // Flags that take their value as a separate token. + static $paired = [ + '-Xclang', '-Xpreprocessor', '-Xlinker', '-Xassembler', + '-framework', '-arch', '-target', + '-include', '-imacros', '-isystem', '-isysroot', '-iquote', '-idirafter', + '-MT', '-MF', '-MQ', + ]; + + $tokens = preg_split('/\s+/', trim($flags)) ?: []; + + // Group paired flag+value into a single atom before dedup. + $atoms = []; + $n = count($tokens); + for ($i = 0; $i < $n; ++$i) { + if (in_array($tokens[$i], $paired, true) && $i + 1 < $n) { + $atoms[] = $tokens[$i] . ' ' . $tokens[$i + 1]; + ++$i; + } else { + $atoms[] = $tokens[$i]; + } + } // Reverse, unique, reverse back - keeps last occurrence of duplicates - $deduplicated = array_reverse(array_unique(array_reverse($tokens))); + $deduplicated = array_reverse(array_unique(array_reverse($atoms))); return implode(' ', $deduplicated); } From e72f9aa623a23331dfa0e6a7c4846c4ff5d9c7dc Mon Sep 17 00:00:00 2001 From: henderkes Date: Sun, 24 May 2026 21:40:26 +0700 Subject: [PATCH 3/3] LinuxMuslCheck: pass tool env via setEnv instead of command prefixes Build the CC/CXX/AR/LD/RANLIB map once and hand it to shell()->setEnv() so the configure/make invocations don't have to repeat the same prefix on every line. For the sudo make-install path the env still needs to be on the command line (sudo strips the parent env), so the same map is rendered into $envFlags and prepended there. Also adds RANLIB, which the upstream Makefile honours. --- src/StaticPHP/Doctor/Item/LinuxMuslCheck.php | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/src/StaticPHP/Doctor/Item/LinuxMuslCheck.php b/src/StaticPHP/Doctor/Item/LinuxMuslCheck.php index df3b5241..1fe7ed00 100644 --- a/src/StaticPHP/Doctor/Item/LinuxMuslCheck.php +++ b/src/StaticPHP/Doctor/Item/LinuxMuslCheck.php @@ -73,13 +73,20 @@ class LinuxMuslCheck $prefix = 'sudo '; logger()->warning('Current user is not root, using sudo for running command'); } + $sysEnv = ['CC' => 'gcc', 'CXX' => 'g++', 'AR' => 'ar', 'LD' => 'ld', 'RANLIB' => 'ranlib']; + $envFlags = ''; + foreach ($sysEnv as $k => $v) { + $envFlags .= "{$k}={$v} "; + } + $envFlags = rtrim($envFlags); $shell = shell()->cd(SOURCE_PATH . '/musl-wrapper') - ->exec('CC=gcc CXX=g++ AR=ar LD=ld ./configure --disable-gcc-wrapper') - ->exec('CC=gcc CXX=g++ AR=ar LD=ld make -j'); + ->setEnv($sysEnv) + ->exec('./configure --disable-gcc-wrapper') + ->exec('make -j'); if ($prefix !== '') { - f_passthru('cd ' . SOURCE_PATH . "/musl-wrapper && CC=gcc CXX=g++ AR=ar LD=ld {$prefix}make install"); + f_passthru('cd ' . SOURCE_PATH . "/musl-wrapper && {$envFlags} {$prefix}make install"); } else { - $shell->exec("CC=gcc CXX=g++ AR=ar LD=ld {$prefix}make install"); + $shell->exec("{$prefix}make install"); } return true; }