Development

#2786 (Cache ignores the layout set in module/view.yml)

You must first sign up to be able to contribute.

Ticket #2786 (reopened defect)

Opened 6 months ago

Last modified 4 weeks ago

Cache ignores the layout set in module/view.yml

Reported by: Andrejs.Verza Assigned to: fabien
Priority: major Milestone:
Component: cache Version: 1.0.10
Keywords: layout Cc:
Qualification: Unreviewed

Description

I believe I've found a very weird bug with symfony's cache system. I have the following application configuration files:

(App) apps/frontend/config/settings.yml:

all:
  cache: on

(App) apps/frontend/config/cache.yml:

default:
  enabled:     on
  with_layout: false
  lifetime:    86400

(App) apps/frontend/config/view.yml:

default:
  has_layout:     on
  layout:         layout_111

(Module) apps/frontend/modules/some_module/config/view.yml:

all:
  has_layout:     on
  layout:         layout_21

Please note that I have told the framework to use layout_111 by default, at the application level. At the module level the layout setting gets replaced. This works perfectly, as it should, while cache is not used. Having the cache turned on, the following scenario happens:

1. Drop all cache (by physically deleting /cache/).

2. Open a page with layout_21 -> the page shows correctly, all components and partials come with blue cache boxes (as they get loaded for the first time).

3. Press F5 (refresh) -> Page reloads quickly (because of cache), every cache box is of yellow color (cached version), but the layout is the default one, specified for the whole application. Module level layout specification get ignored here.

I suppose this to be quite serious.

Change History

01/14/08 01:07:40 changed by Andrejs.Verza

Found it! The key criteria for this bug to happen is forwarding.

Suppose we have module_a/action_a (decorated with layout_a).
Suppose we have module_b/action_b (decorated with layout_b).

Now we do the forwarding:

public function executeActionA()
{
  $this->forward('module_b', 'action_b');
}

I am pretty sure symfony saves the cache of module_b/action_b and signs it as for module_a/action_a. Next time the page is loaded, symfony sees there is a cache for it (actual page cached is module_b/action_b), so it uses the cache. Here it gets confused using wrong decorator layout of (module_a/action_a), because it is what we actually see in the address bar of the browser.

06/23/08 07:11:25 changed by dwhittle

  • status changed from new to closed.
  • resolution set to fixed.

I believe this is fixed in 1.1.

06/23/08 09:24:04 changed by fabien

  • status changed from closed to reopened.
  • resolution deleted.