File tree Expand file tree Collapse file tree 4 files changed +25
-0
lines changed
Expand file tree Collapse file tree 4 files changed +25
-0
lines changed Original file line number Diff line number Diff line change @@ -457,6 +457,17 @@ jobs:
457457 OUTPUT=$(../../bin/phpstan analyze -l 0 -vvv test.php 2>&1)
458458 echo "$OUTPUT"
459459 ../bashunit -a contains 'Parallel processing scheduler' "$OUTPUT"
460+ - script : |
461+ cd e2e/bug-14093
462+ # Use a relative sys_temp_dir so the value starts with a letter (not /), just like Windows
463+ # paths starting with a drive letter. If the sys_temp_dir value isn't correctly quoted,
464+ # PHP evaluates ~ as a bitwise NOT rather than a literal character, truncating the path.
465+ mkdir tmp~1
466+ php -d "sys_temp_dir='tmp~1'" ../../bin/phpstan analyze
467+ if [ -d tmp ]; then
468+ echo "FAIL: tmp was created by a worker, meaning sys_temp_dir='tmp~1' was incorrectly evaluated to 'tmp'"
469+ exit 1
470+ fi
460471
461472 steps :
462473 - name : Harden the runner (Audit all outbound calls)
Original file line number Diff line number Diff line change 1+ parameters :
2+ level : 8
3+ paths :
4+ - test.php
Original file line number Diff line number Diff line change 1+ <?php declare (strict_types=1 );
2+
3+ function add (int $ a , int $ b ): int
4+ {
5+ return $ a + $ b ;
6+ }
Original file line number Diff line number Diff line change 1111use function is_bool ;
1212use function php_ini_loaded_file ;
1313use function sprintf ;
14+ use function sys_get_temp_dir ;
1415use const PHP_BINARY ;
1516
1617final class ProcessHelper
@@ -32,6 +33,9 @@ public static function getWorkerCommand(
3233
3334 $ processCommandArray = [
3435 $ phpCmd ,
36+ '-d ' ,
37+ // quote value so PHP will parse it as a string when the path contains a bitwise operator like ~
38+ 'sys_temp_dir= ' . escapeshellarg ("' " . sys_get_temp_dir () . "' " ),
3539 ];
3640
3741 if ($ input ->getOption ('memory-limit ' ) === null ) {
You can’t perform that action at this time.
0 commit comments