Problem/Motivation
Manager::react()
checks whether the current path is an admin path or not. This happens very early in bootstrap, exactly it can happen during a call to entity_get_info()
, unfortunately sps_drupal()->path_is_admin()
aka path_is_admin()
itself relies on entity_get_info()
.
And calling entity_get_info()
during a call of entity_get_info()
can lead to severe issues - and lead to a totally broken cache of entity_get_info()
.
Proposed resolution
During my tests it showed that just a slight reorganization of the conditions used in Manager::react()
seems to fix the issue. See the attached patch.
If the conditions are reorganized this way sps_drupal()->path_is_admin()
isn't called during entity_get_info()
anymore. At least I couldn't find a scenario in which it would be.
Remaining tasks
Reviews needed.
User interface changes
None.
API changes
None.
Comment | File | Size | Author |
---|---|---|---|
sps-avoid-cache-poisoning-of-entity_get_info.patch | 1.51 KB | das-peter | |
Comments
Comment #1
mcdruidConfirming that we came across a site where this was happening; specifically the cached entity_info was being rebuilt incorrectly after a cache clear which was having several undesirable consequences.
It looks like sps_query_alter was being invoked when the node module was rebuilding the info about node types / bundles, and the result was that the bundle info returned by entity_get_info ended up being totally incorrect.
Applying the patch resolved this particular issue. Not sure whether that's enough for an RTBC, but it's certainly a +1.
Comment #2
mcdruidThis patch has been added to the Lightning Features profile (in #2612412: Add another patch for SPS to avoid cache poisoning of entity_info).
Marking as RTBC.