- Issue created by @leksat
The logic of RefinableCacheableDependencyTrait::addCacheableDependency()
has been updated in
#3232018: Trigger an error when using \Drupal\Core\Cache\RefinableCacheableDependencyTrait::addCacheableDependency with a non CacheableDependencyInterface object →
.
If the passed object is NOT an instance of CacheableDependencyInterface
Previous behavior: max-age
is set to 0
Future behavior: an exception is thrown
In order to get rid of the deprecation notice and preserve the old behavior, one bit of FieldReuseAccessCheck::access()
code was changed from
$access->addCacheableDependency($this->entityFieldManager);
to
if ($this->entityFieldManager instanceof CacheableDependencyInterface) {
$access->addCacheableDependency($this->entityFieldManager);
}
else {
$access->setCacheMaxAge(0);
}
However, it isn't clear if this is correct because the if
condition always resolves to FALSE
because EntityFieldManager
isn't a cacheable dependency.
It seems that either the above code needs to be removed completely, or it should be replaced with $access->setCacheMaxAge(0)
.
- Make a decision
- Update the code
None
None
None
Active
11.0 🔥