diff --git a/lib/internal/Magento/Framework/Interception/PluginList/PluginList.php b/lib/internal/Magento/Framework/Interception/PluginList/PluginList.php index 2f86c8703dea5..3553e29f8a76b 100644 --- a/lib/internal/Magento/Framework/Interception/PluginList/PluginList.php +++ b/lib/internal/Magento/Framework/Interception/PluginList/PluginList.php @@ -217,7 +217,11 @@ protected function _loadScopedData() } $this->_scopePriorityScheme[] = $scope; - $cacheId = implode('|', $this->_scopePriorityScheme) . "|" . $this->_cacheId; + // Sort scopes alphabetically to ensure cache ID is deterministic + // regardless of processing order (fixes mismatch with compile-time generation) + $sortedScheme = array_values($this->_scopePriorityScheme); + sort($sortedScheme); + $cacheId = implode('|', $sortedScheme) . "|" . $this->_cacheId; $configData = $this->configLoader->load($cacheId); if ($configData) { diff --git a/lib/internal/Magento/Framework/Interception/PluginListGenerator.php b/lib/internal/Magento/Framework/Interception/PluginListGenerator.php index 0153ee92a8062..c7d9ccdd1f17c 100644 --- a/lib/internal/Magento/Framework/Interception/PluginListGenerator.php +++ b/lib/internal/Magento/Framework/Interception/PluginListGenerator.php @@ -93,7 +93,11 @@ public function write(array $scopes): void if (false === in_array($scope, $this->scopePriorityScheme, true)) { $this->scopePriorityScheme[] = $scope; } - $cacheId = implode('|', $this->scopePriorityScheme) . "|" . $this->cacheId; + // Sort scopes alphabetically to ensure cache ID is deterministic + // regardless of processing order (fixes mismatch with runtime loading) + $sortedScheme = array_values($this->scopePriorityScheme); + sort($sortedScheme); + $cacheId = implode('|', $sortedScheme) . "|" . $this->cacheId; [ $virtualTypes, $this->scopePriorityScheme,