Skip to content

Commit 160968c

Browse files
committed
Fixed fallback behavior in getPhpFastCacheVersion method
1 parent f6e448f commit 160968c

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

lib/Phpfastcache/Api.php

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -69,12 +69,15 @@ public static function getPhpFastCacheVersion($fallbackOnChangelog = true, $cach
6969
}
7070

7171
if(\function_exists('shell_exec')){
72-
$stdout = shell_exec('git describe --abbrev=0 --tags');
72+
$command = 'git -C "' . __DIR__ . '" describe --abbrev=0 --tags';
73+
$stdout = shell_exec($command);
7374
if(\is_string($stdout)){
7475
$version = \trim($stdout);
7576
return $version;
7677
}
77-
throw new PhpfastcacheLogicException('The git command used to retrieve the PhpFastCache version has failed.');
78+
if(!$fallbackOnChangelog){
79+
throw new PhpfastcacheLogicException('The git command used to retrieve the PhpFastCache version has failed.');
80+
}
7881
}
7982

8083
if(!$fallbackOnChangelog){

0 commit comments

Comments
 (0)