symfony/symfony — pull request #7180 by jfsimon (2013-02-25 16:26:37+00:00)
Title: [HttpKernel] Fixes AppCache + ESI + Stopwatch problem

There is a very special case when using builtin AppCache class as kernel wrapper, in the case of an ESI request leading to a `stale` response [B] inside a `fresh` cached response [A]. In this case, `$token` contains the [B] debug token, but the open `stopwatch` section ID is equal to the [A] debug token. Trying to reopen section with the [B] token throws an exception which must be caught.

| Q | A
| ------------- | ---
| Bug fix? | yes
| Bug mask? | no, does @vicb agree?
| New feature? | no
| BC breaks? | no
| Deprecations? | no
| Tests pass? | yes
| Fixed tickets | #6227, #6230

I tried to find a better solution than just wrapping thrown exceptions with `try/catch`, but IMHO the #6230 solution from @lsmith77 was in fine the best one. I just added some comments in the code to avoid the WTF reactions while reading it.