1
0
Fork 0

Fix usage of InstalledVersions when loaded from composer/composer installed as a dependency and runtime Composer is v1, fixes #9937

pull/9959/head
Jordi Boggiano 2021-06-05 17:11:23 +02:00
parent 7a7e0cc031
commit e087a4ab5e
No known key found for this signature in database
GPG Key ID: 7BBD42C429EC80BC
1 changed files with 14 additions and 2 deletions

View File

@ -249,7 +249,13 @@ class InstalledVersions
@trigger_error('getRawData only returns the first dataset loaded, which may not be what you expect. Use getAllRawData() instead which returns all datasets for all autoloaders present in the process.', E_USER_DEPRECATED);
if (null === self::$installed) {
self::$installed = include __DIR__ . '/installed.php';
// only require the installed.php file if this file is loaded from its dumped location,
// and not from its source location in the composer/composer package, see https://github.com/composer/composer/issues/9937
if (substr(__DIR__, -8, 1) !== 'C') {
self::$installed = include __DIR__ . '/installed.php';
} else {
self::$installed = array();
}
}
return self::$installed;
@ -316,7 +322,13 @@ class InstalledVersions
}
if (null === self::$installed) {
self::$installed = require __DIR__ . '/installed.php';
// only require the installed.php file if this file is loaded from its dumped location,
// and not from its source location in the composer/composer package, see https://github.com/composer/composer/issues/9937
if (substr(__DIR__, -8, 1) !== 'C') {
self::$installed = require __DIR__ . '/installed.php';
} else {
self::$installed = array();
}
}
$installed[] = self::$installed;