[FrameworkBundle] fixed cahe:clear command's warmup
[FrameworkBundle] changed temp kernel name in cache:clear
[FrameworkBundle] removed BC break
merged branch jfsimon/issue-6203 (PR #7360)

This PR was merged into the 2.1 branch.

Commits
-------

f2ef6bc [FrameworkBundle] removed BC break
cc3a40e [FrameworkBundle] changed temp kernel name in cache:clear
7d87ecd [FrameworkBundle] fixed cahe:clear command's warmup

Discussion
----------

[FrameworkBundle] fixes cahe:clear command's warmup

Solution taken is to replace the last char of the cache directory name to create a temporary cache directory, this way the temporary cache path has the same length than the real one. I tested this on several projects, in dev and prod environments.

| Q             | A
| ------------- | ---
| Bug fix?      | yes
| New feature?  | no
| BC breaks?    | yes
| Deprecations? | no
| Tests pass?   | yes
| Fixed tickets | #6203

---------------------------------------------------------------------------

by jfsimon at 2013-03-13T12:32:25Z

@toloco @gergelypolonkai @ghost-x47 @stewe it would be great if you could test this patch on your projects and report result!

---------------------------------------------------------------------------

by toloco at 2013-03-13T12:41:47Z

Im sorry but have the same...

Notice: unserialize(): Error at offset 155 of 174227 bytes in /home/tolopalmer/Projects/shareandcoach/app/bootstrap.php.cache line 915

---------------------------------------------------------------------------

by jfsimon at 2013-03-13T12:45:04Z

@toloco could you paste the backtrace in a gist? and maybe the concerned file?

---------------------------------------------------------------------------

by stof at 2013-03-13T13:11:47Z

@jfsimon You probably have the same issue with the name of the temporary kernel class

---------------------------------------------------------------------------

by jfsimon at 2013-03-13T13:36:13Z

@stof if you're right, it's a nightmare. It must be possible to write a parser/fixer for serialized objects, don't you think?

---------------------------------------------------------------------------

by toloco at 2013-03-13T14:22:56Z

Here you are the gist with the stack and the bootstrap.php.cache file

https://gist.github.com/toloco/5152581

---------------------------------------------------------------------------

by mpdude at 2013-03-13T20:08:08Z

@jfsimon Writing such a parser is painting yourself in the corner.

Use a temp kernel class name of the same length as a quick fix.

#7230 could bring a solution because we might be able to inject a different ConfigCache factory during the command that intercepts and substitutes Resources before they get written into the meta file. Not sure if that PR has a chance of being picked though.

---------------------------------------------------------------------------

by toloco at 2013-03-14T08:19:58Z

So guys? we are blocked with this problem, can I help you? I can provide more stacks if it's needed

---------------------------------------------------------------------------

by mpdude at 2013-03-14T10:05:05Z

@toloco Could you please post the /home/tolopalmer/Projects/shareandcoach/app/cache/dev/appDevUrlMatcher.php.meta file? That's the one that is broken.

---------------------------------------------------------------------------

by jfsimon at 2013-03-14T10:15:20Z

@mpdude you can find its content in the gist https://gist.github.com/toloco/5152581 (1st file, 6th line)

---------------------------------------------------------------------------

by mpdude at 2013-03-14T10:24:55Z

@toloco That file should contain a serialized set of Resources, it's not in the Gist.

---------------------------------------------------------------------------

by jfsimon at 2013-03-14T10:33:12Z

@mpdude it's more visible in the raw file: ttps://gist.github.com/toloco/5152581/raw/48a1a823b5c8e6ba03936a52e8dc0d0ff1888f8a/Error+

---------------------------------------------------------------------------

by jfsimon at 2013-03-14T10:33:27Z

sorry: https://gist.github.com/toloco/5152581/raw/48a1a823b5c8e6ba03936a52e8dc0d0ff1888f8a/Error+

---------------------------------------------------------------------------

by toloco at 2013-03-14T10:37:09Z

https://gist.github.com/toloco/5160317 here you are the appDevUrlMatcher.php and meta

---------------------------------------------------------------------------

by jfsimon at 2013-03-14T10:51:46Z

@toloco I applied @mpdude's solution (have a temp kernel class name of the same length than the real one).
Could you test it to see if it fixes your problem?

---------------------------------------------------------------------------

by mpdude at 2013-03-14T10:58:46Z

@jfsimon Thanks!
@toloco If Jean-François' fix does not work, please make sure that the .meta file you posted was the broken one? I was able to unserialize it without problems.

---------------------------------------------------------------------------

by toloco at 2013-03-14T11:02:09Z

Man!!!! you are the fucking boss it works!!

---------------------------------------------------------------------------

by mpdude at 2013-03-14T11:04:30Z

@jfsimon you just made someone happy.

---------------------------------------------------------------------------

by jfsimon at 2013-03-14T11:12:39Z

@toloco @mpdude \o/