Skip to content

Commit 6065ce7

Browse files
fix: identify php-sync-tool by exact binary path, not path shape
1 parent acd1a95 commit 6065ce7

1 file changed

Lines changed: 8 additions & 6 deletions

File tree

deployer/functions.php

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -155,22 +155,24 @@ function resolveSyncTool(string $legacyBinary, string $phpBinary = 'vendor/bin/s
155155
}
156156

157157
/**
158-
* Whether a resolved sync tool binary is php-sync-tool rather than the legacy tool:
159-
* a path containing a slash, as opposed to a bare PATH command.
158+
* Whether a resolved sync tool binary is php-sync-tool rather than the legacy tool.
159+
* Compared against the known php-sync-tool path, not path-shape - a downstream
160+
* project's legacy binary can itself be configured as an absolute or relative path,
161+
* which would otherwise be misclassified.
160162
*/
161-
function usingPhpSyncTool(string $resolvedBinary): bool
163+
function usingPhpSyncTool(string $resolvedBinary, string $phpBinary = 'vendor/bin/sync-tool'): bool
162164
{
163-
return str_contains($resolvedBinary, '/');
165+
return $resolvedBinary === $phpBinary;
164166
}
165167

166168
/**
167169
* Checks whether a resolved sync tool binary is actually available locally: a path
168-
* (php-sync-tool) via isExecutableLocally(), a bare PATH command (the legacy tool) via
170+
* (containing a slash) via isExecutableLocally(), a bare PATH command via
169171
* commandExistLocally().
170172
*/
171173
function syncToolAvailableLocally(string $binary): bool
172174
{
173-
return usingPhpSyncTool($binary)
175+
return str_contains($binary, '/')
174176
? isExecutableLocally($binary)
175177
: commandExistLocally($binary);
176178
}

0 commit comments

Comments
 (0)