Merge pull request #10894 from lekoala/patch-43

Ensure cache key only contains valid characters
This commit is contained in:
Guy Sartorelli 2023-08-03 19:15:38 +12:00 committed by GitHub
commit 0e74e355eb
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -44,7 +44,7 @@ class VersionProvider
*/ */
public function getVersion() public function getVersion()
{ {
$key = sprintf('%s-%s', $this->getComposerLockPath(), 'all'); $key = preg_replace("/[^A-Za-z0-9]/", '_', $this->getComposerLockPath() . '_all');
$version = $this->getCachedValue($key); $version = $this->getCachedValue($key);
if ($version) { if ($version) {
return $version; return $version;
@ -80,7 +80,7 @@ class VersionProvider
*/ */
public function getModuleVersion(string $module): string public function getModuleVersion(string $module): string
{ {
$key = sprintf('%s-%s', $this->getComposerLockPath(), $module); $key = preg_replace("/[^A-Za-z0-9]/", '_', $this->getComposerLockPath() . '_' . $module);
$version = $this->getCachedValue($key); $version = $this->getCachedValue($key);
if ($version) { if ($version) {
return $version; return $version;