From bc5fe7da6c62fce9cc25ad9d15bca461c6290ad6 Mon Sep 17 00:00:00 2001 From: Theodore Brown Date: Thu, 2 Apr 2026 18:13:28 -0500 Subject: [PATCH] Respect sys_temp_dir from the parent process Addresses phpstan/phpstan#13929 without the bug that caused #4699 to be reverted. Closes phpstan/phpstan#14093 --- src/Process/ProcessHelper.php | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/Process/ProcessHelper.php b/src/Process/ProcessHelper.php index 591e916feed..188d7c77fbe 100644 --- a/src/Process/ProcessHelper.php +++ b/src/Process/ProcessHelper.php @@ -11,6 +11,7 @@ use function is_bool; use function php_ini_loaded_file; use function sprintf; +use function sys_get_temp_dir; use const PHP_BINARY; final class ProcessHelper @@ -32,6 +33,9 @@ public static function getWorkerCommand( $processCommandArray = [ $phpCmd, + '-d', + // quote value so PHP will parse it as a string when the path contains a bitwise operator like ~ + 'sys_temp_dir=' . escapeshellarg("'" . sys_get_temp_dir() . "'"), ]; if ($input->getOption('memory-limit') === null) {