This repository has been archived on 2023-08-20. You can view files and clone it, but cannot push or open issues or pull requests.
Go to file
Fabien Potencier 98ee8ab800 bug #26675 [HttpKernel] DumpDataCollector: do not flush when a dumper is provided (ogizanagi)
This PR was merged into the 2.7 branch.

Discussion
----------

[HttpKernel] DumpDataCollector: do not flush when a dumper is provided

| Q             | A
| ------------- | ---
| Branch?       | 2.7 <!-- see below -->
| Bug fix?      | yes
| New feature?  | no <!-- don't forget to update src/**/CHANGELOG.md files -->
| BC breaks?    | no     <!-- see https://symfony.com/bc -->
| Deprecations? | no <!-- don't forget to update UPGRADE-*.md and src/**/CHANGELOG.md files -->
| Tests pass?   | yes    <!-- please add some, will be required by reviewers -->
| Fixed tickets | 3db14045d4/src/Symfony/Component/HttpKernel/DataCollector/DumpDataCollector.php (L208-L209)   <!-- #-prefixed issue number(s), if any -->
| License       | MIT
| Doc PR        | N/A

This explains [the workaround I initially used](3db14045d4/src/Symfony/Component/HttpKernel/DataCollector/DumpDataCollector.php (L208-L209)) in the server dumper PR original code.

I might be wrong on the intent, but as soon as a dumper is provided (e.g by setting  `debug.dump_destination: php://stderr`), I think there is no need to set the `DumpDataCollector::$isCollected` flag to `false` as we explicitly ask for the dump to be output directly somewhere. So ne need to output again on `__destruct`.

Spotted by running tests on the `symfony/demo` with the server dumper enabled: dumps were output twice. Once on the server, once at the end of the tests.

But this can be easily seen as well by using `debug.dump_destination: php://stderr` on `test` env:

```diff
diff --git a/src/Controller/BlogController.php b/src/Controller/BlogController.php
index e3e30aa..bf9744e 100644
--- a/src/Controller/BlogController.php
+++ b/src/Controller/BlogController.php
@@ -50,6 +50,7 @@ class BlogController extends AbstractController
      */
     public function index(int $page, string $_format, PostRepository $posts): Response
     {
+        dump(get_class($posts));
         $latestPosts = $posts->findLatest($page);

         // Every template name also has two extensions that specify the format and
```

### Before

```sh
vendor/bin/simple-phpunit --filter=BlogControllerTest::testIndex
PHPUnit 6.5.7 by Sebastian Bergmann and contributors.

Testing Project Test Suite
BlogController.php on line 53:
"App\Repository\PostRepository"
.                                                                   1 / 1 (100%)

Time: 3.34 seconds, Memory: 44.25MB

OK (1 test, 1 assertion)
BlogController.php on line 53:
"App\Repository\PostRepository"
```

### After

```sh
vendor/bin/simple-phpunit --filter=BlogControllerTest::testIndex
PHPUnit 6.5.7 by Sebastian Bergmann and contributors.

Testing Project Test Suite
BlogController.php on line 53:
"App\Repository\PostRepository"
.                                                                   1 / 1 (100%)

Time: 731 ms, Memory: 28.00MB

OK (1 test, 1 assertion)
```

Commits
-------

11a0392516 [HttpKernel] DumpDataCollector: do not flush when a dumper is provided
2018-03-30 09:47:09 +02:00
.composer Drop hirak/prestissimo 2016-05-12 07:44:15 -05:00
.github add hint in Github pull request template 2018-03-18 17:01:38 +01:00
src/Symfony bug #26675 [HttpKernel] DumpDataCollector: do not flush when a dumper is provided (ogizanagi) 2018-03-30 09:47:09 +02:00
.editorconfig Add EditorConfig File 2012-06-16 14:08:15 +02:00
.gitignore Add appveyor.yml for C.I. on Windows 2015-08-25 23:41:37 +02:00
.php_cs.dist minor #25653 PHP CS Fixer: clean up repo and adjust config (keradus) 2018-01-03 18:10:39 +01:00
.travis.yml [travis] cache in ~/php-ext/ 2018-02-22 13:59:51 +01:00
CHANGELOG-2.2.md Merge branch '2.2' into 2.3 2013-12-03 15:51:26 +01:00
CHANGELOG-2.3.md updated CHANGELOG for 2.3.42 2016-05-30 10:40:50 +02:00
CHANGELOG-2.4.md updated CHANGELOG for 2.4.9 2014-09-03 11:50:09 +02:00
CHANGELOG-2.5.md updated CHANGELOG for 2.5.10 2015-02-02 10:26:02 +01:00
CHANGELOG-2.6.md updated CHANGELOG for 2.6.10 2015-07-13 11:34:21 +02:00
CHANGELOG-2.7.md updated CHANGELOG for 2.7.43 2018-03-05 10:31:53 -08:00
CONTRIBUTING.md Mention the community review guide 2016-12-18 22:02:35 +01:00
CONTRIBUTORS.md update CONTRIBUTORS for 2.7.43 2018-03-05 10:31:59 -08:00
LICENSE fixed years in copyright 2018-01-03 08:23:28 +01:00
README.md Fix minor typo in the main README.md 2017-04-27 20:23:38 +02:00
UPGRADE-2.1.md Remove aligned '=>' and '=' 2014-10-26 08:30:58 +01:00
UPGRADE-2.2.md Clean up 2018-01-02 16:37:23 +01:00
UPGRADE-2.3.md [Doc] Use Markdown syntax highlighting 2014-10-01 07:38:33 +02:00
UPGRADE-2.4.md Updated UPGRADE-2.4.md 2015-06-08 16:44:57 +02:00
UPGRADE-2.5.md Clean up 2018-01-02 16:37:23 +01:00
UPGRADE-2.6.md Fix grammar 2014-12-30 09:24:50 +01:00
UPGRADE-2.7.md Clean up 2018-01-02 16:37:23 +01:00
UPGRADE-3.0.md Clean up 2018-01-02 16:37:23 +01:00
appveyor.yml [appveyor] Workaround GitHub disabling of low versions of TLS 2018-02-26 16:04:10 +01:00
composer.json Revert "bug #25851 [Validator] Conflict with egulias/email-validator 2.0 (emodric)" 2018-01-20 13:12:25 +01:00
link Update Repository Symlink Helper 2018-02-11 12:15:02 +01:00
phpunit Force phpunit-bridge update (bis) 2017-11-22 10:25:38 +01:00
phpunit.xml.dist fail when detecting risky tests 2017-04-12 09:39:27 +02:00

README.md

Symfony is a PHP framework for web applications and a set of reusable PHP components. Symfony is used by thousands of web applications (including BlaBlaCar.com and Spotify.com) and most of the popular PHP projects (including Drupal and Magento).

Installation

Documentation

Community

Contributing

Symfony is an Open Source, community-driven project with thousands of contributors. Join them contributing code or contributing documentation.

Security Issues

If you discover a security vulnerability within Symfony, please follow our disclosure procedure.

About Us

Symfony development is sponsored by SensioLabs, led by the Symfony Core Team and supported by Symfony contributors.