contao / core-bundle

[READ-ONLY] Contao Core Bundle
GNU Lesser General Public License v3.0
122 stars 57 forks source link

Incompatible with symfony 3.2 (http_cache) #643

Closed agoat closed 7 years ago

agoat commented 7 years ago

The http_cache causes an error when symfony 3.2 is installed (within contao 4.3).

After setting the server cache timeout on the page settings (other than zero), there will be no output when the page is cached. So the first call is rendered but the second has no output. After the timeout when the page is revalidated following error is printed:

Fatal error: Cannot declare class Symfony\Component\HttpFoundation\ResponseHeaderBag, because the name is already in use in /cms/contao4-clean/var/cache/prod/classes.php on line 4491

After the page cache is cleared the next call is rendered and the same is happening as written above.

leofeyer commented 7 years ago

@contao/developers /cc

ausi commented 7 years ago

@agoat could you please try if removing the line

$kernel->loadClassCache();

from the web/app.php file fixes the issue?

agoat commented 7 years ago

@ausi When this line is removed the pages are loaded corretly.

But this is like the cache is deactivated, am I right?

ausi commented 7 years ago

I don’t think so, at least if you use PHP 7. This will be removed in a future version of Symfony, see symfony/symfony-standard#1030.

Nevertheless, we should investigate why loadClassCache() causes the issue.

discordier commented 7 years ago

symfony/symfony#20753 appears to be the same problem while menioning another class name.

Toflar commented 7 years ago

Imho we should kill loadClassCache() completely. SF still loads it when running a PHP version lower than PHP7 but to be honest, if you want to optimize for performance, switching to PHP7 is the first thing to do. I don't see why we should even bother about performance stuff in other PHP versions.

leofeyer commented 7 years ago

Ok, so let's remove this entirely. In version 4.3.1 or in 4.4.0?

aschempp commented 7 years ago

4.3.1 is fine with me, it's not a change anyone would notice, I already removed it from my applications.

discordier commented 7 years ago

So did I.

agoat commented 7 years ago

I didn´t understand what $kernel->loadClassCache(); was doing, but I also removed it and everything is fine.

discordier commented 7 years ago

It is a speedup attempt which preloads classes which are needed in most requests. This is however obsolete in PHP7.0 and marginal in PHP 5.6 - therefore it is save to remove it.

leofeyer commented 7 years ago

Fixed in the following commits: