-
-
Notifications
You must be signed in to change notification settings - Fork 9.6k
Enforce UTF-8 charset for core controllers #13715
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 our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
👍 |
Maybe a few assertions added ProfilerControllerTest could help prevent breaking the fix |
You can use the syntax Response::create() to chain the setCharset. |
Thanks for the great suggestions, @nicolas-grekas and @GromNaN! I've now updated the PR to use |
@@ -39,6 +39,7 @@ public function testOnlyClearOwnOutputBuffers() | |||
$request->headers->set('X-Php-Ob-Level', 1); | |||
|
|||
$controller = new ExceptionController($twig, false); | |||
$controller->showAction($request, $flatten); | |||
$response = $controller->showAction($request, $flatten); | |||
$this->assertEquals('UTF-8', $response->getCharset(), 'Request charset is explicitely set to UTF-8'); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
typo: explicitely
-> explicitly
Fixed the typos |
Thank you @wouterj. |
This PR was merged into the 2.3 branch. Discussion ---------- Enforce UTF-8 charset for core controllers | Q | A | ------------- | --- | Bug fix? | yes | New feature? | no | BC breaks? | no | Deprecations? | no | Tests pass? | yes | Fixed tickets | #7532 | License | MIT | Doc PR | - See #7617 and #7532 for the context of this PR. Commits ------- 3032014 Enforce UTF-8 charset for core controllers
This PR was merged into the 2.3 branch. Discussion ---------- [Bundle] Fix charset config | Q | A | ------------- | --- | Bug fix? | yes | New feature? | no | BC breaks? | no | Deprecations? | no | Tests pass? | yes | Fixed tickets | #13715, #7617, #7532 | License | MIT | Doc PR | - This reverts #13715 and resurrects #7532, which was fine. Commits ------- ef41059 [WebProfilerBundle] Set debug+charset on the ExceptionHandler fallback cbd0525 used HTML5 meta charset tag and removed hardcoded ones 6ca7fc9 Revert "bug #13715 Enforce UTF-8 charset for core controllers (WouterJ)"
* 2.3: [HttpFoundation] MongoDbSessionHandler::read() now checks for valid session age [WebProfilerBundle] Set debug+charset on the ExceptionHandler fallback used HTML5 meta charset tag and removed hardcoded ones Revert "bug #13715 Enforce UTF-8 charset for core controllers (WouterJ)" Conflicts: src/Symfony/Bundle/TwigBundle/Controller/ExceptionController.php src/Symfony/Bundle/WebProfilerBundle/Controller/ProfilerController.php src/Symfony/Component/HttpFoundation/Session/Storage/Handler/MongoDbSessionHandler.php src/Symfony/Component/HttpFoundation/Tests/Session/Storage/Handler/MongoDbSessionHandlerTest.php
* 2.6: [HttpFoundation] MongoDbSessionHandler::read() now checks for valid session age Changed visibility of setUp() and tearDown to protected [WebProfilerBundle] Set debug+charset on the ExceptionHandler fallback Added default button class used HTML5 meta charset tag and removed hardcoded ones Revert "bug #13715 Enforce UTF-8 charset for core controllers (WouterJ)" fixed XSS in the exception handler Php Inspections (EA Extended) - static code analysis includes: [2.3] Remove most refs uses Test with local components instead of waiting for the subtree-splitter when possible Conflicts: .travis.yml
* 2.7: Changed visibility of setUp() and tearDown to protected Changed visibility of setUp() and tearDown to protected [2.7] Fix travis file [HttpFoundation] MongoDbSessionHandler::read() now checks for valid session age [Debug] reintroduce charset param to ExceptionHandler Changed visibility of setUp() and tearDown to protected [WebProfilerBundle] Set debug+charset on t 8000 he ExceptionHandler fallback [Debug] deprecate ExceptionHandler::utf8Htmlize Added default button class used HTML5 meta charset tag and removed hardcoded ones Revert "bug #13715 Enforce UTF-8 charset for core controllers (WouterJ)" fixed XSS in the exception handler Php Inspections (EA Extended) - static code analysis includes: [2.3] Remove most refs uses [FrameworkBundle] Read config/validation/*.(xml|yml) files Test with local components instead of waiting for the subtree-splitter when possible Conflicts: src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/Compiler/LegacyTemplatingAssetHelperPassTest.php src/Symfony/Bundle/TwigBundle/Tests/Extension/LegacyAssetsExtensionTest.php src/Symfony/Bundle/TwigBundle/Tests/TokenParser/LegacyRenderTokenParserTest.php src/Symfony/Component/ClassLoader/Tests/LegacyUniversalClassLoaderTest.php src/Symfony/Component/Console/Helper/ProgressHelper.php src/Symfony/Component/Console/Tests/Helper/LegacyDialogHelperTest.php src/Symfony/Component/Console/Tests/Helper/LegacyProgressHelperTest.php src/Symfony/Component/Debug/ExceptionHandler.php src/Symfony/Component/HttpFoundation/Tests/Session/Storage/Handler/MongoDbSessionHandlerTest.php src/Symfony/Component/Routing/Tests/Matcher/Dumper/LegacyApacheMatcherDumperTest.php src/Symfony/Component/Templating/Tests/Helper/LegacyAssetsHelperTest.php
This PR was merged into the 2.3 branch. Discussion ---------- [Bundle] Fix charset config | Q | A | ------------- | --- | Bug fix? | yes | New feature? | no | BC breaks? | no | Deprecations? | no | Tests pass? | yes | Fixed tickets | symfony#13715, symfony#7617, symfony#7532 | License | MIT | Doc PR | - This reverts symfony#13715 and resurrects symfony#7532, which was fine. Commits ------- ef41059 [WebProfilerBundle] Set debug+charset on the ExceptionHandler fallback cbd0525 used HTML5 meta charset tag and removed hardcoded ones 6ca7fc9 Revert "bug symfony#13715 Enforce UTF-8 charset for core controllers (WouterJ)"
* 2.3: [HttpFoundation] MongoDbSessionHandler::read() now checks for valid session age [WebProfilerBundle] Set debug+charset on the ExceptionHandler fallback used HTML5 meta charset tag and removed hardcoded ones Revert "bug symfony#13715 Enforce UTF-8 charset for core controllers (WouterJ)" Conflicts: src/Symfony/Bundle/TwigBundle/Controller/ExceptionController.php src/Symfony/Bundle/WebProfilerBundle/Controller/ProfilerController.php src/Symfony/Component/HttpFoundation/Session/Storage/Handler/MongoDbSessionHandler.php src/Symfony/Component/HttpFoundation/Tests/Session/Storage/Handler/MongoDbSessionHandlerTest.php
* 2.6: [HttpFoundation] MongoDbSessionHandler::read() now checks for valid session age Changed visibility of setUp() and tearDown to protected [WebProfilerBundle] Set debug+charset on the ExceptionHandler fallback Added default button class used HTML5 meta charset tag and removed hardcoded ones Revert "bug symfony#13715 Enforce UTF-8 charset for core controllers (WouterJ)" fixed XSS in the exception handler Php Inspections (EA Extended) - static code analysis includes: [2.3] Remove most refs uses Test with local components instead of waiting for the subtree-splitter when possible Conflicts: .travis.yml
* 2.7: Changed visibility of setUp() and tearDown to protected Changed visibility of setUp() and tearDown to protected [2.7] Fix travis file [HttpFoundation] MongoDbSessionHandler::read() now checks for valid session age [Debug] reintroduce charset param to ExceptionHandler Changed visibility of setUp() and tearDown to protected [WebProfilerBundle] Set debug+charset on the ExceptionHandler fallback [Debug] deprecate ExceptionHandler::utf8Htmlize Added default button class used HTML5 meta charset tag and removed hardcoded ones Revert "bug symfony#13715 Enforce UTF-8 charset for core controllers (WouterJ)" fixed XSS in the exception handler Php Inspections (EA Extended) - static code analysis includes: [2.3] Remove most refs uses [FrameworkBundle] Read config/validation/*.(xml|yml) files Test with local components instead of waiting for the subtree-splitter when possible Conflicts: src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/Compiler/LegacyTemplatingAssetHelperPassTest.php src/Symfony/Bundle/TwigBundle/Tests/Extension/LegacyAssetsExtensionTest.php src/Symfony/Bundle/TwigBundle/Tests/TokenParser/LegacyRenderTokenParserTest.php src/Symfony/Component/ClassLoader/Tests/LegacyUniversalClassLoaderTest.php src/Symfony/Component/Console/Helper/ProgressHelper.php src/Symfony/Component/Console/Tests/Helper/LegacyDialogHelperTest.php src/Symfony/Component/Console/Tests/Helper/LegacyProgressHelperTest.php src/Symfony/Component/Debug/ExceptionHandler.php src/Symfony/Component/HttpFoundation/Tests/Session/Storage/Handler/MongoDbSessionHandlerTest.php src/Symfony/Component/Routing/Tests/Matcher/Dumper/LegacyApacheMatcherDumperTest.php src/Symfony/Component/Templating/Tests/Helper/LegacyAssetsHelperTest.php
* 2.6: [HttpFoundation] MongoDbSessionHandler::read() now checks for valid session age Changed visibility of setUp() and tearDown to protected [WebProfilerBundle] Set debug+charset on the ExceptionHandler fallback Added default button class used HTML5 meta charset tag and removed hardcoded ones Revert "bug symfony#13715 Enforce UTF-8 charset for core controllers (WouterJ)" fixed XSS in the exception handler Php Inspections (EA Extended) - static code analysis includes: [2.3] Remove most refs uses Test with local components instead of waiting for the subtree-splitter when possible Conflicts: .travis.yml
* 2.7: Changed visibility of setUp() and tearDown to protected Changed visibility of setUp() and tearDown to protected [2.7] Fix travis file [HttpFoundation] MongoDbSessionHandler::read() now checks for valid session age [Debug] reintroduce charset param to ExceptionHandler Changed visibility of setUp() and tearDown to protected [WebProfilerBundle] Set debug+charset on the ExceptionHandler fallback [Debug] deprecate ExceptionHandler::utf8Htmlize Added default button class used HTML5 meta charset tag and removed hardcoded ones Revert "bug symfony#13715 Enforce UTF-8 charset for core controllers (WouterJ)" fixed XSS in the exception handler Php Inspections (EA Extended) - static code analysis includes: [2.3] Remove most refs uses [FrameworkBundle] Read config/validation/*.(xml|yml) files Test with local components instead of waiting for the subtree-splitter when possible Conflicts: src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/Compiler/LegacyTemplatingAssetHelperPassTest.php src/Symfony/Bundle/TwigBundle/Tests/Extension/LegacyAssetsExtensionTest.php src/Symfony/Bundle/TwigBundle/Tests/TokenParser/LegacyRenderTokenParserTest.php src/Symfony/Component/ClassLoader/Tests/LegacyUniversalClassLoaderTest.php src/Symfony/Component/Console/Helper/ProgressHelper.php src/Symfony/Component/Console/Tests/Helper/LegacyDialogHelperTest.php src/Symfony/Component/Console/Tests/Helper/LegacyProgressHelperTest.php src/Symfony/Component/Debug/ExceptionHandler.php src/Symfony/Component/HttpFoundation/Tests/Session/Storage/Handler/MongoDbSessionHandlerTest.php src/Symfony/Component/Routing/Tests/Matcher/Dumper/LegacyApacheMatcherDumperTest.php src/Symfony/Component/Templating/Tests/Helper/LegacyAssetsHelperTest.php
See #7617 and #7532 for the context of this PR.