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 536a6cdbd8 feature #17589 [3.1] [WebProfilerBundle] [DX] Feature allow forward and redirection detection in wdt (HeahDude)
This PR was merged into the 3.1-dev branch.

Discussion
----------

[3.1] [WebProfilerBundle] [DX] Feature allow forward and redirection detection in wdt

| Q             | A
| ------------- | ---
| Bug fix?      | no
| New feature?  | yes
| BC breaks?    | no
| Deprecations? | no
| Tests pass?   | yes
| Fixed tickets | #14358, #17501
| License       | MIT
| Doc PR        | ?

This PR allows to :
- track explicit forward from `\Symfony\Bundle\FrameWorkBundle\Controller\Controller` in the web debug toolbar.
- or pass a request attribute `_forwarded` with the current request attributes (an instance of `ParameterBag`) as value to your sub request before handling it.
- see if you've been redirected (require session enabled)

When redirected you will see the name of the route (if any) and a link to the profile of the original request.

![redirect](https://cloud.githubusercontent.com/assets/10107633/12716952/9aacdcba-c8e4-11e5-9a64-d26fe27f1cae.jpg)

In case of forwarding, the name of the controller is a file link and next to it there is a direct link to the profile of the sub request.

![forward](https://cloud.githubusercontent.com/assets/10107633/12716968/ba6b1fbc-c8e4-11e5-85fc-7f71969cb372.jpg)

This works pretty well in __Silex__ too by registering `SessionServiceProvider()` for redirections or by providing this method for forwarding :

```php
class App extends \Silex\Application
//  (php7 bootstrap) $app = new class extends \Silex\Application {
{
    public function forward($controller, array $path = array(), array $query = array()
    {
        if (!$this->booted) {
            throw new LogicException(sprintf('Method %s must be called from a controller.', __METHOD__));
        }

        $this->flush();

        $request = $this['request_stack']->getCurrentRequest();
        $path['_forwarded'] = $request->attributes;
        $path['_controller'] = $controller;
        $subRequest = $request->duplicate($query, null, $path);

        return $this['kernel']->handle($subRequest, HttpKernelInterface::SUB_REQUEST);
    }
}
```

Commits
-------

0a0e8af [WebProfilerBundle] show the http method in wdt if not 'GET'
4f020b5 [FrameworkBundle] Extends the RequestDataCollector
227ac77 [WebProfilerBundle] [FrameworkBundle] profile forward controller action
0a1b284 [WebProfiler] [HttpKernel] profile redirections
2016-03-31 11:32:58 +02:00
.composer [travis] Upgrade phpunit wrapper & hirak/prestissimo 2016-03-23 13:34:50 +01:00
.github Improved the "branch" row of the PR table 2016-03-13 12:02:32 +01:00
src/Symfony feature #17589 [3.1] [WebProfilerBundle] [DX] Feature allow forward and redirection detection in wdt (HeahDude) 2016-03-31 11:32:58 +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 use nowdoc instead of heredoc 2015-12-21 17:05:00 +01:00
.travis.php [Cache] Symfony PSR-6 implementation 2016-01-19 08:02:17 +01:00
.travis.yml [Bridge\PhpUnit] Add "disabled" mode to SYMFONY_DEPRECATIONS_HELPER 2016-03-23 14:47:06 +01:00
appveyor.yml Merge branch '2.7' into 2.8 2016-03-30 12:37:34 +02:00
CHANGELOG-3.0.md Merge branch '3.0' 2016-03-31 10:13:34 +02:00
composer.json Merge branch '3.0' 2016-03-23 14:33:04 +01:00
CONTRIBUTING.md Update contributing docs 2016-02-24 15:36:06 +01:00
CONTRIBUTORS.md update CONTRIBUTORS for 2.3.39 2016-03-13 17:37:49 +01:00
LICENSE Update copyright year 2016-01-01 23:53:47 -03:00
phpunit [2.8] fix mocks 2016-03-27 11:27:49 +02:00
phpunit.xml.dist use the clock mock for progress indicator tests 2016-03-17 10:19:04 +01:00
README.md Merge branch '2.8' 2015-06-04 22:30:47 +02:00
UPGRADE-3.0.md Fix leftover conflict marker in UPGRADE-3.0.md 2016-03-14 22:24:56 +01:00
UPGRADE-3.1.md [FrameworkBundle] Deprecated form types as services 2016-03-30 19:13:54 +02:00
UPGRADE-4.0.md [FrameworkBundle] Deprecated form types as services 2016-03-30 19:13:54 +02:00

README

What is Symfony?

Symfony is a PHP full-stack web framework. It is written with speed and flexibility in mind. It allows developers to build better and easy to maintain websites with PHP.

Symfony can be used to develop all kind of websites, from your personal blog to high traffic ones like Dailymotion or Yahoo! Answers.

Installation

The best way to install Symfony is to use the official Symfony Installer. It allows you to start a new project based on the version you want.

Documentation

The "Quick Tour" tutorial gives you a first feeling of the framework. If, like us, you think that Symfony can help speed up your development and take the quality of your work to the next level, read the official Symfony documentation.

Contributing

Symfony is an open source, community-driven project. If you'd like to contribute, please read the Contributing Code part of the documentation. If you're submitting a pull request, please follow the guidelines in the Submitting a Patch section and use Pull Request Template.

Running Symfony Tests

Information on how to run the Symfony test suite can be found in the Running Symfony Tests section.