{"action":"created","issue":{"url":"https://api.github.com/repos/symfony/symfony/issues/14374","labels_url":"https://api.github.com/repos/symfony/symfony/issues/14374/labels{/name}","comments_url":"https://api.github.com/repos/symfony/symfony/issues/14374/comments","events_url":"https://api.github.com/repos/symfony/symfony/issues/14374/events","html_url":"https://github.com/symfony/symfony/pull/14374","id":68908248,"number":14374,"title":"[FrameworkBundle] Dumped container files not being renamed correctly on cache:clear","user":{"login":"clemherreman","id":272812,"avatar_url":"https://avatars.githubusercontent.com/u/272812?v=3","gravatar_id":"","url":"https://api.github.com/users/clemherreman","html_url":"https://github.com/clemherreman","followers_url":"https://api.github.com/users/clemherreman/followers","following_url":"https://api.github.com/users/clemherreman/following{/other_user}","gists_url":"https://api.github.com/users/clemherreman/gists{/gist_id}","starred_url":"https://api.github.com/users/clemherreman/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/clemherreman/subscriptions","organizations_url":"https://api.github.com/users/clemherreman/orgs","repos_url":"https://api.github.com/users/clemherreman/repos","events_url":"https://api.github.com/users/clemherreman/events{/privacy}","received_events_url":"https://api.github.com/users/clemherreman/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":1,"created_at":"2015-04-16T11:56:41Z","updated_at":"2015-04-19T18:43:03Z","closed_at":null,"pull_request":{"url":"https://api.github.com/repos/symfony/symfony/pulls/14374","html_url":"https://github.com/symfony/symfony/pull/14374","diff_url":"https://github.com/symfony/symfony/pull/14374.diff","patch_url":"https://github.com/symfony/symfony/pull/14374.patch"},"body":"| Q             | A\r\n| ------------- | ---\r\n| Bug fix?      | yes\r\n| New feature?  | no\r\n| BC breaks?    | no\r\n| Deprecations? | no\r\n| Tests pass?   | yes\r\n| Fixed tickets | none\r\n| License       | MIT\r\n| Doc PR        | none\r\n\r\n# Abstract\r\n\r\nWhen you override the `AppKernel::getContainerClass()`, `cache:clear` fails to correctly rename `XX_DevDebugProjectContainer.php` to `XXXDevDebugProjectContainer` when it moves the newly generated cache file, to replace the soon-to-be-deleted ones.\r\n\r\nAside from the confusion introduced when looking at the generated code/files, this also means the cache is not correctly warmed up, and can potentially cause concurrency issues when the service container gets lazily dumped upon the first HTTP requests.\r\n\r\n# Fix\r\n\r\nSo far, the fix I'm suggesting looks more like a workaround. I broadened the `Finder` selector, so that it detects and rename the `XX_DevDebugProjectContainer.php`, along with the other `appDevUrlGenerator` or `appDevUrlMatcher` files. I am however a little concerned by the possible side-effects on this.\r\n\r\n# Reproducing steps\r\n\r\n```\r\n$ symfony new symfony-cache-rename 2.3\r\n$ cd symfony-cache-rename/\r\n```\r\n\r\nAdd the following method to `app/AppKernel.php`\r\n\r\n```php\r\n    protected function getContainerClass()\r\n    {\r\n        return sprintf('Foo' . parent::getContainerClass());\r\n    }\r\n```\r\n\r\n```\r\n$ app/console cache:clear\r\n```\r\n\r\n## Expected \r\n\r\n```\r\napp/cache/dev\r\n|-- FooappDevDebugProjectContainer.php\r\n|-- FooappDevDebugProjectContainer.php.meta\r\n|-- FooappDevDebugProjectContainer.xml\r\n|-- FooappDevDebugProjectContainerCompiler.log\r\n|-- annotations\r\n|-- appDevUrlGenerator.php\r\n|-- appDevUrlGenerator.php.meta\r\n|-- appDevUrlMatcher.php\r\n|-- appDevUrlMatcher.php.meta\r\n|-- assetic\r\n|-- classes.map\r\n|-- doctrine\r\n|-- profiler\r\n|-- sessions\r\n|-- templates.php\r\n`-- twig\r\n\r\n6 directories, 10 files\r\n```\r\n\r\n## Got\r\n\r\n```\r\napp/cache/dev\r\n|-- Fooap_DevDebugProjectContainer.php\r\n|-- Fooap_DevDebugProjectContainer.php.meta\r\n|-- Fooap_DevDebugProjectContainer.xml\r\n|-- Fooap_DevDebugProjectContainerCompiler.log\r\n|-- annotations\r\n|-- appDevUrlGenerator.php\r\n|-- appDevUrlGenerator.php.meta\r\n|-- appDevUrlMatcher.php\r\n|-- appDevUrlMatcher.php.meta\r\n|-- assetic\r\n|-- classes.map\r\n|-- doctrine\r\n|-- profiler\r\n|-- sessions\r\n|-- templates.php\r\n`-- twig\r\n\r\n6 directories, 10 files\r\n```\r\n\r\n# Got after the first HTTP request\r\n\r\n```\r\napp/cache/dev\r\n|-- Fooap_DevDebugProjectContainer.php\r\n|-- Fooap_DevDebugProjectContainer.php.meta\r\n|-- Fooap_DevDebugProjectContainer.xml\r\n|-- Fooap_DevDebugProjectContainerCompiler.log\r\n|-- FooappDevDebugProjectContainer.php\r\n|-- FooappDevDebugProjectContainer.php.meta\r\n|-- FooappDevDebugProjectContainer.xml\r\n|-- FooappDevDebugProjectContainerCompiler.log\r\n|-- annotations\r\n|-- appDevUrlGenerator.php\r\n|-- appDevUrlGenerator.php.meta\r\n|-- appDevUrlMatcher.php\r\n|-- appDevUrlMatcher.php.meta\r\n|-- assetic\r\n|-- classes.map\r\n|-- doctrine\r\n|-- profiler\r\n|-- sessions\r\n|-- templates.php\r\n`-- twig\r\n\r\n6 directories, 14 files\r\n```"},"comment":{"url":"https://api.github.com/repos/symfony/symfony/issues/comments/94304480","html_url":"https://github.com/symfony/symfony/pull/14374#issuecomment-94304480","issue_url":"https://api.github.com/repos/symfony/symfony/issues/14374","id":94304480,"user":{"login":"hacfi","id":428841,"avatar_url":"https://avatars.githubusercontent.com/u/428841?v=3","gravatar_id":"","url":"https://api.github.com/users/hacfi","html_url":"https://github.com/hacfi","followers_url":"https://api.github.com/users/hacfi/followers","following_url":"https://api.github.com/users/hacfi/following{/other_user}","gists_url":"https://api.github.com/users/hacfi/gists{/gist_id}","starred_url":"https://api.github.com/users/hacfi/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/hacfi/subscriptions","organizations_url":"https://api.github.com/users/hacfi/orgs","repos_url":"https://api.github.com/users/hacfi/repos","events_url":"https://api.github.com/users/hacfi/events{/privacy}","received_events_url":"https://api.github.com/users/hacfi/received_events","type":"User","site_admin":false},"created_at":"2015-04-19T18:43:03Z","updated_at":"2015-04-19T18:43:03Z","body":":+1: just had the same issue"}}