Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

[HttpKernel] enabling cache-reloading when cache file is rebuilt#20065

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Closed
stampycode wants to merge4 commits intosymfony:masterfromstampycode:master

Conversation

@stampycode
Copy link

@stampycodestampycode commentedSep 27, 2016
edited
Loading

QA
Branch?"master"
Bug fix?yes
New feature?no
BC breaks?no
Deprecations?no
Tests pass?all, and disabled one test which is misleading. (
publicfunctiontestCacheIsNotWarmedWhenTemplatingIsDisabled()
)
Fixed tickets#20024
LicenseMIT
Doc PRnone

Allows the cache file to be deleted, rebuilt & reloaded between Container builds in WebTestCase scenario, to enable testing of multiple configurations of the same application through WebTestCase.

Will only reload the cache file when in debug mode and the cache class file is deleted.

This allows the cache file to be deleted and thus rebuilt between Container builds in WebTestCase scenario, to enable testing of multiple configurations of the same application through WebTestCase.
@stampycode
Copy link
Author

In fact, the CacheWarming test that fails here is misleading; In master, the two test cases,testCacheIsProperlyWarmedWhenTemplatingIsAvailable andtestCacheIsNotWarmedWhenTemplatingIsDisabled fail when the tests are reversed. This shows that the cache pre-warming always takes place if the class hasn't previously been loaded withrequire_once...@tucksaun

This PR effectively re-generates classes that are 'not fresh' while ditching the logic behindrequire_once to tell us whether a class has been loaded before, regardless of whether we have a newer version of the class we want to load instead.

This makes for a much more powerful testing suite, being able to test a Container with a config that changes between test cases.

stampy added3 commitsSeptember 28, 2016 10:27
This test fails if run before the previous test, so is actually dependent on the current execution history.
…che fileWhen generating multiple versions of the same container class, each new class name is suffixed with an incrementing version number, as you can't re-use class names.So when we load the class file, the class itself may have a different name than the file name suggests - so after we load the class file, we have to find the class name.
@stampycode
Copy link
Author

@fabpot@jakzal@nicolas-grekas - can someone please nudgefabbot.io ?

@tucksaun
Copy link
Contributor

thanks for reporting this@stampycode !
this should be fixed with#20103

fabpot added a commit that referenced this pull requestSep 30, 2016
…ucksaun)This PR was merged into the 2.7 branch.Discussion----------[TwigBundle] Fix CacheWarmingTest are order dependent| Q             | A| ------------- | ---| Branch?       | 2.7| Bug fix?      | yes| New feature?  | no| BC breaks?    | no| Deprecations? | no| Tests pass?   | yes| Fixed tickets | -| License       | MIT| Doc PR        | -Fix issue reported in#20065Commits-------fcd6ec2 [TwigBundle] Fix CacheWarmingTest are order dependent
@fabpotfabpot closed thisSep 30, 2016
fabpot added a commit that referenced this pull requestSep 30, 2016
…rmer introduced in 2.8 (tucksaun)This PR was merged into the 2.8 branch.Discussion----------[TwigBundle] Adjust CacheWarmingTest for TemplateCacheWarmer introduced in 2.8| Q             | A| ------------- | ---| Branch?       | 2.8| Bug fix?      | yes| New feature?  | no| BC breaks?    | no| Deprecations? | no| Tests pass?   | yes| Fixed tickets | -| License       | MIT| Doc PR        | -With#20103, issue reported in#20065 is fixed, however it will now break in 2.8+ as another cache warmer has been introduced with#16271.Commits-------360ca48 [TwigBundle] Adjust CacheWarmingTest for TemplateCacheWarmer introduced in 2.8
@stampycode
Copy link
Author

stampycode commentedSep 30, 2016
edited
Loading

@fabpot,@tucksaun - finding the bug in theCacheWarmingTest was only a side-effect of this ticket - the purpose of which was to merge my PR - is this now being rejected with no reason?

@jakzal
Copy link
Contributor

@stampycode problem with this PR in my view is that it introduces quite a lot of code (that could potentially break other people's code) for what I see as an edge case.

@stampycode
Copy link
Author

@jakzal Surely any change to the Kernel could potentially break other people's code if other people are toying with the Kernel?
Currently what happens, if the cache files are deleted between tests, is the cached files are re-generated and then NOT USED, because therequire_once statement blocks the same file being re-loaded, and php disallows the same class from being declared twice.

In my mind this PR is fixing a bug - you can put debug statements in the parameters.php file and see that the file is being reloaded, but there is no indication that the cache file is not being reloaded when the file is re-generated.

It's not a core deliverable of Symfony to silently block the re-loading of that cache file in a single execution, such as during PHPUnit tests.

It may break people's code if they are depending on this bug existing, but that doesn't sound like a good argument to not fix it.

And this would make PHPUnit and WebTestCase much more powerful.

@jakzal
Copy link
Contributor

Loading the kernel class that changes during the request is not a supported use case (this doesn't happen in real life). I think this PR is a wrong solution to the problem since it introduces code in a production class that would only be there for tests.

Sign up for freeto join this conversation on GitHub. Already have an account?Sign in to comment

Reviewers

No reviews

Assignees

No one assigned

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

5 participants

@stampycode@tucksaun@jakzal@fabpot@carsonbot

[8]ページ先頭

©2009-2025 Movatter.jp