Skip to content

Commit 11764bd

Browse files
committed
chore: update main autoloader
Signed-off-by: Daniel Kesselberg <mail@danielkesselberg.de>
1 parent f922cfb commit 11764bd

File tree

6 files changed

+30
-95
lines changed

6 files changed

+30
-95
lines changed

lib/composer/autoload.php

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -14,10 +14,7 @@
1414
echo $err;
1515
}
1616
}
17-
trigger_error(
18-
$err,
19-
E_USER_ERROR
20-
);
17+
throw new RuntimeException($err);
2118
}
2219

2320
require_once __DIR__ . '/composer/autoload_real.php';

lib/composer/composer/InstalledVersions.php

Lines changed: 23 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,11 @@ class InstalledVersions
3232
*/
3333
private static $installed;
3434

35+
/**
36+
* @var bool
37+
*/
38+
private static $installedIsLocalDir;
39+
3540
/**
3641
* @var bool|null
3742
*/
@@ -309,6 +314,12 @@ public static function reload($data)
309314
{
310315
self::$installed = $data;
311316
self::$installedByVendor = array();
317+
318+
// when using reload, we disable the duplicate protection to ensure that self::$installed data is
319+
// always returned, but we cannot know whether it comes from the installed.php in __DIR__ or not,
320+
// so we have to assume it does not, and that may result in duplicate data being returned when listing
321+
// all installed packages for example
322+
self::$installedIsLocalDir = false;
312323
}
313324

314325
/**
@@ -322,19 +333,27 @@ private static function getInstalled()
322333
}
323334

324335
$installed = array();
336+
$copiedLocalDir = false;
325337

326338
if (self::$canGetVendors) {
339+
$selfDir = strtr(__DIR__, '\\', '/');
327340
foreach (ClassLoader::getRegisteredLoaders() as $vendorDir => $loader) {
341+
$vendorDir = strtr($vendorDir, '\\', '/');
328342
if (isset(self::$installedByVendor[$vendorDir])) {
329343
$installed[] = self::$installedByVendor[$vendorDir];
330344
} elseif (is_file($vendorDir.'/composer/installed.php')) {
331345
/** @var array{root: array{name: string, pretty_version: string, version: string, reference: string|null, type: string, install_path: string, aliases: string[], dev: bool}, versions: array<string, array{pretty_version?: string, version?: string, reference?: string|null, type?: string, install_path?: string, aliases?: string[], dev_requirement: bool, replaced?: string[], provided?: string[]}>} $required */
332346
$required = require $vendorDir.'/composer/installed.php';
333-
$installed[] = self::$installedByVendor[$vendorDir] = $required;
334-
if (null === self::$installed && strtr($vendorDir.'/composer', '\\', '/') === strtr(__DIR__, '\\', '/')) {
335-
self::$installed = $installed[count($installed) - 1];
347+
self::$installedByVendor[$vendorDir] = $required;
348+
$installed[] = $required;
349+
if (self::$installed === null && $vendorDir.'/composer' === $selfDir) {
350+
self::$installed = $required;
351+
self::$installedIsLocalDir = true;
336352
}
337353
}
354+
if (self::$installedIsLocalDir && $vendorDir.'/composer' === $selfDir) {
355+
$copiedLocalDir = true;
356+
}
338357
}
339358
}
340359

@@ -350,7 +369,7 @@ private static function getInstalled()
350369
}
351370
}
352371

353-
if (self::$installed !== array()) {
372+
if (self::$installed !== array() && !$copiedLocalDir) {
354373
$installed[] = self::$installed;
355374
}
356375

lib/composer/composer/autoload_psr4.php

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,5 @@
1010
'OC\\' => array($baseDir . '/lib/private'),
1111
'OCP\\' => array($baseDir . '/lib/public'),
1212
'NCU\\' => array($baseDir . '/lib/unstable'),
13-
'Bamarni\\Composer\\Bin\\' => array($vendorDir . '/bamarni/composer-bin-plugin/src'),
1413
'' => array($baseDir . '/lib/private/legacy'),
1514
);

lib/composer/composer/autoload_static.php

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -21,10 +21,6 @@ class ComposerStaticInit749170dad3f5e7f9ca158f5a9f04f6a2
2121
array (
2222
'NCU\\' => 4,
2323
),
24-
'B' =>
25-
array (
26-
'Bamarni\\Composer\\Bin\\' => 21,
27-
),
2824
);
2925

3026
public static $prefixDirsPsr4 = array (
@@ -44,10 +40,6 @@ class ComposerStaticInit749170dad3f5e7f9ca158f5a9f04f6a2
4440
array (
4541
0 => __DIR__ . '/../../..' . '/lib/unstable',
4642
),
47-
'Bamarni\\Composer\\Bin\\' =>
48-
array (
49-
0 => __DIR__ . '/..' . '/bamarni/composer-bin-plugin/src',
50-
),
5143
);
5244

5345
public static $fallbackDirsPsr4 = array (
Lines changed: 3 additions & 66 deletions
Original file line numberDiff line numberDiff line change
@@ -1,68 +1,5 @@
11
{
2-
"packages": [
3-
{
4-
"name": "bamarni/composer-bin-plugin",
5-
"version": "1.8.2",
6-
"version_normalized": "1.8.2.0",
7-
"source": {
8-
"type": "git",
9-
"url": "https://github.com/bamarni/composer-bin-plugin.git",
10-
"reference": "92fd7b1e6e9cdae19b0d57369d8ad31a37b6a880"
11-
},
12-
"dist": {
13-
"type": "zip",
14-
"url": "https://api.github.com/repos/bamarni/composer-bin-plugin/zipball/92fd7b1e6e9cdae19b0d57369d8ad31a37b6a880",
15-
"reference": "92fd7b1e6e9cdae19b0d57369d8ad31a37b6a880",
16-
"shasum": ""
17-
},
18-
"require": {
19-
"composer-plugin-api": "^2.0",
20-
"php": "^7.2.5 || ^8.0"
21-
},
22-
"require-dev": {
23-
"composer/composer": "^2.0",
24-
"ext-json": "*",
25-
"phpstan/extension-installer": "^1.1",
26-
"phpstan/phpstan": "^1.8",
27-
"phpstan/phpstan-phpunit": "^1.1",
28-
"phpunit/phpunit": "^8.5 || ^9.5",
29-
"symfony/console": "^2.8.52 || ^3.4.35 || ^4.4 || ^5.0 || ^6.0",
30-
"symfony/finder": "^2.8.52 || ^3.4.35 || ^4.4 || ^5.0 || ^6.0",
31-
"symfony/process": "^2.8.52 || ^3.4.35 || ^4.4 || ^5.0 || ^6.0"
32-
},
33-
"time": "2022-10-31T08:38:03+00:00",
34-
"type": "composer-plugin",
35-
"extra": {
36-
"class": "Bamarni\\Composer\\Bin\\BamarniBinPlugin"
37-
},
38-
"installation-source": "dist",
39-
"autoload": {
40-
"psr-4": {
41-
"Bamarni\\Composer\\Bin\\": "src"
42-
}
43-
},
44-
"notification-url": "https://packagist.org/downloads/",
45-
"license": [
46-
"MIT"
47-
],
48-
"description": "No conflicts for your bin dependencies",
49-
"keywords": [
50-
"composer",
51-
"conflict",
52-
"dependency",
53-
"executable",
54-
"isolation",
55-
"tool"
56-
],
57-
"support": {
58-
"issues": "https://github.com/bamarni/composer-bin-plugin/issues",
59-
"source": "https://github.com/bamarni/composer-bin-plugin/tree/1.8.2"
60-
},
61-
"install-path": "../bamarni/composer-bin-plugin"
62-
}
63-
],
64-
"dev": true,
65-
"dev-package-names": [
66-
"bamarni/composer-bin-plugin"
67-
]
2+
"packages": [],
3+
"dev": false,
4+
"dev-package-names": []
685
}

lib/composer/composer/installed.php

Lines changed: 3 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -3,30 +3,21 @@
33
'name' => '__root__',
44
'pretty_version' => 'dev-master',
55
'version' => 'dev-master',
6-
'reference' => 'ee76fe192de8656d216b4079a6c50dda3fc9cdb1',
6+
'reference' => 'b7422ba97b7b42a9955a52031a32457ca521d740',
77
'type' => 'library',
88
'install_path' => __DIR__ . '/../../../',
99
'aliases' => array(),
10-
'dev' => true,
10+
'dev' => false,
1111
),
1212
'versions' => array(
1313
'__root__' => array(
1414
'pretty_version' => 'dev-master',
1515
'version' => 'dev-master',
16-
'reference' => 'ee76fe192de8656d216b4079a6c50dda3fc9cdb1',
16+
'reference' => 'b7422ba97b7b42a9955a52031a32457ca521d740',
1717
'type' => 'library',
1818
'install_path' => __DIR__ . '/../../../',
1919
'aliases' => array(),
2020
'dev_requirement' => false,
2121
),
22-
'bamarni/composer-bin-plugin' => array(
23-
'pretty_version' => '1.8.2',
24-
'version' => '1.8.2.0',
25-
'reference' => '92fd7b1e6e9cdae19b0d57369d8ad31a37b6a880',
26-
'type' => 'composer-plugin',
27-
'install_path' => __DIR__ . '/../bamarni/composer-bin-plugin',
28-
'aliases' => array(),
29-
'dev_requirement' => true,
30-
),
3122
),
3223
);

0 commit comments

Comments
 (0)