diff --git a/modules/system/classes/PluginManager.php b/modules/system/classes/PluginManager.php index a613302385..3581bae167 100644 --- a/modules/system/classes/PluginManager.php +++ b/modules/system/classes/PluginManager.php @@ -181,7 +181,12 @@ public function loadPlugin(string $namespace, string $path): ?PluginBase $replaces = $pluginObj->getReplaces(); if ($replaces) { foreach ($replaces as $replace) { - $this->replacementMap[strtolower($replace)] = $lowerClassId; + $lowerReplace = strtolower($replace); + $this->replacementMap[$lowerReplace] = $lowerClassId; + + if (!isset($this->normalizedMap[$lowerReplace])) { + $this->normalizedMap[$lowerReplace] = $replace; + } } } @@ -745,6 +750,11 @@ protected function detectPluginReplacements(): void protected function registerPluginReplacements(): void { foreach ($this->replacementMap as $target => $replacement) { + list($target, $replacement) = array_map( + fn($plugin) => $this->normalizeIdentifier($plugin), + [$target, $replacement] + ); + // Alias the replaced plugin to the replacing plugin $this->aliasPluginAs($replacement, $target);