1
0
Fork 0

Fix preg match type error in svn version guessing, fixes #11231

pull/11244/head
Jordi Boggiano 2022-12-22 15:28:49 +01:00
parent cbb7c91223
commit cf8ce82aa1
No known key found for this signature in database
GPG Key ID: 7BBD42C429EC80BC
1 changed files with 3 additions and 2 deletions

View File

@ -397,8 +397,8 @@ class VersionGuesser
$urlPattern = '#<url>.*/(' . $trunkPath . '|(' . $branchesPath . '|' . $tagsPath . ')/(.*))</url>#'; $urlPattern = '#<url>.*/(' . $trunkPath . '|(' . $branchesPath . '|' . $tagsPath . ')/(.*))</url>#';
if (Preg::isMatchStrictGroups($urlPattern, $output, $matches)) { if (Preg::isMatch($urlPattern, $output, $matches)) {
if (isset($matches[2]) && ($branchesPath === $matches[2] || $tagsPath === $matches[2])) { if (isset($matches[2], $matches[3]) && ($branchesPath === $matches[2] || $tagsPath === $matches[2])) {
// we are in a branches path // we are in a branches path
$version = $this->versionParser->normalizeBranch($matches[3]); $version = $this->versionParser->normalizeBranch($matches[3]);
$prettyVersion = 'dev-' . $matches[3]; $prettyVersion = 'dev-' . $matches[3];
@ -406,6 +406,7 @@ class VersionGuesser
return ['version' => $version, 'commit' => '', 'pretty_version' => $prettyVersion]; return ['version' => $version, 'commit' => '', 'pretty_version' => $prettyVersion];
} }
assert(is_string($matches[1]));
$prettyVersion = trim($matches[1]); $prettyVersion = trim($matches[1]);
if ($prettyVersion === 'trunk') { if ($prettyVersion === 'trunk') {
$version = 'dev-trunk'; $version = 'dev-trunk';