fix: guard Tia argv scanning against non-string args (#1736)

The Tia plugin scans the raw argv with str_starts_with() in
argumentPresent() and hasExplicitPathArgument(). In the parallel worker
path (bin/worker.php) the unserialized argv can contain an integer
--random-order-seed value as a separate element, which made
str_starts_with() throw:

    TypeError: str_starts_with(): Argument #1 ($haystack) must be of
    type string, int given

This is the same class of bug as #1206, which was only fixed in
HandleArguments; it resurfaced in the newer Tia plugin. Cast each argv
element to string before scanning, mirroring the #1206 fix.

Adds a regression test, and updates the parallel count assertion and the
success snapshot to account for it.

Co-authored-by: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
Conor Murphy
2026-06-26 05:03:06 +10:00
committed by GitHub
parent 87882a8561
commit ac8feafdcc
4 changed files with 30 additions and 4 deletions
+3 -1
View File
@@ -251,7 +251,7 @@ final class Tia implements AddsOutput, HandlesArguments, Terminable
return true;
}
if (str_starts_with($arg, "$argument=")) {
if (str_starts_with((string) $arg, "$argument=")) { // @phpstan-ignore-line
return true;
}
}
@@ -1489,6 +1489,8 @@ final class Tia implements AddsOutput, HandlesArguments, Terminable
}
foreach ($arguments as $index => $arg) {
$arg = (string) $arg; // @phpstan-ignore-line
if ($arg === '') {
continue;
}