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 798cf5272b merged branch helmer/target_path (PR #2228)
Commits
-------

022a9a7 [Security] Make saving target_path extendible

Discussion
----------

[Security] Make saving target_path extendible

The problem lies in how Security component handles ``target_path`` - the latest request URI is always stored. This can lead to problems in following scenarios:
a) The response type of the request is not HTML (think JSON, XML ..)
b) The URI matches a route that does not listen to HTTP GET

I opened a [PR](https://github.com/symfony/symfony/pull/604) months ago, to partly solve scenario A, which did not make it. Now I am proposing a different solution - user can extend ``ExceptionListener`` and override the logic behind setting the ``target_path`` to match his precise needs.

In my simplified scenario, I would be using:

```
protected function setTargetPath(Request $request)
{
    if ($request->isXmlHttpRequest() || 'GET' !== $request->getMethod()) {
        return;
    }

    $request->getSession()->set('_security.target_path', $request->getUri());
}
```

@Seldaek, @schmittjoh, @lsmith77, thoughts?

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

by Seldaek at 2011/09/21 02:37:02 -0700

Seems like a better solution for flexibility's sake. Would be quite awesome if you could add a cookbook entry to symfony/symfony-docs about this, otherwise I'm afraid we'll have to explain it over and over again :)

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

by helmer at 2011/09/21 03:38:57 -0700

[Cookbook](b22c5e666e) entry done. Perhaps though I rushed ahead ..

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

by Seldaek at 2011/09/21 03:52:01 -0700

Thanks. You can already do a pull request against symfony-docs, just reference this pull request in it so it's not merged before this is merged.
2011-09-22 18:43:18 +02:00
src/Symfony merged branch helmer/target_path (PR #2228) 2011-09-22 18:43:18 +02:00
tests merged 2.0 2011-09-21 20:14:11 +02:00
.gitignore Added vendor directory to .gitignore 2010-06-24 10:44:28 +02:00
autoload.php.dist fixed autoloader when tests are run on a machine without intl installed 2011-07-20 14:27:10 +02:00
CHANGELOG-2.0.md updated CHANGELOG for 2.0.1 2011-08-26 08:46:45 +02:00
CHANGELOG-2.1.md updated CHANGELOG for 2.1 2011-09-22 09:44:58 +02:00
check_cs fixed root search path to include only './src' and './tests' 2011-06-08 18:11:05 +02:00
CONTRIBUTORS.md update CONTRIBUTORS for 2.0.1 2011-08-26 08:45:12 +02:00
LICENSE added the LICENSE file for the YAML component 2011-02-18 11:52:11 +01:00
phpunit.xml.dist [Security] cleaned up opt-in to benchmark test 2011-03-06 20:06:13 +01:00
README.md updated the README file 2011-05-24 17:27:37 +02:00
UPDATE.ja.md updated translation of UPDATE file (Japanese RC5 added) 2011-07-30 02:08:25 +09:00
UPDATE.md updated UPDATE file 2011-07-22 17:45:02 +02:00
vendors.php bumped versions of Twig and Swiftmailer 2011-09-13 17:09:09 +02:00

README

What is Symfony2?

Symfony2 is a PHP 5.3 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.

Requirements

Symfony2 is only supported on PHP 5.3.2 and up.

Installation

The best way to install Symfony2 is to download the Symfony Standard Edition available at http://symfony.com/download.

Documentation

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