Issue #3471741 by mstrelan, bbrala, kristiaanvandeneynde: Fix null $cid in CacheCollector classes

(cherry picked from commit 85aa92b0de)
merge-requests/9515/head
catch 2024-09-09 17:29:26 +01:00
parent fdee339524
commit d7c106ed83
2 changed files with 5 additions and 5 deletions

View File

@ -43,7 +43,7 @@ class LibraryDiscoveryCollector extends CacheCollector {
*/
public function __construct(CacheBackendInterface $cache, LockBackendInterface $lock, LibraryDiscoveryParser $discovery_parser, ThemeManagerInterface $theme_manager) {
$this->themeManager = $theme_manager;
parent::__construct(NULL, $cache, $lock, ['library_info']);
parent::__construct('', $cache, $lock, ['library_info']);
$this->discoveryParser = $discovery_parser;
}
@ -52,7 +52,7 @@ class LibraryDiscoveryCollector extends CacheCollector {
* {@inheritdoc}
*/
protected function getCid() {
if (!isset($this->cid)) {
if ($this->cid === '') {
$this->cid = 'library_info:' . $this->themeManager->getActiveTheme()->getName();
}
@ -164,7 +164,7 @@ class LibraryDiscoveryCollector extends CacheCollector {
*/
public function reset() {
parent::reset();
$this->cid = NULL;
$this->cid = '';
}
}

View File

@ -42,7 +42,7 @@ class MenuActiveTrail extends CacheCollector implements MenuActiveTrailInterface
* The lock backend.
*/
public function __construct(MenuLinkManagerInterface $menu_link_manager, RouteMatchInterface $route_match, CacheBackendInterface $cache, LockBackendInterface $lock) {
parent::__construct(NULL, $cache, $lock);
parent::__construct('', $cache, $lock);
$this->menuLinkManager = $menu_link_manager;
$this->routeMatch = $route_match;
}
@ -53,7 +53,7 @@ class MenuActiveTrail extends CacheCollector implements MenuActiveTrailInterface
* @see ::getActiveTrailIds()
*/
protected function getCid() {
if (!isset($this->cid)) {
if ($this->cid === '') {
$route_parameters = $this->routeMatch->getRawParameters()->all();
ksort($route_parameters);
$this->cid = 'active-trail:route:' . $this->routeMatch->getRouteName() . ':route_parameters:' . serialize($route_parameters);