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 ebd5e9286c merged branch flojon/patch-3 (PR #5984)
This PR was merged into the 2.0 branch.

Commits
-------

64b54dc Use better default ports in urlRedirectAction
64216f2 Add tests for urlRedirectAction

Discussion
----------

Default to current port in urlRedirectAction

I was a bit surprised when I used urlRedirectAction from a non-standard port (8000) it redirected me to port 80. I would argue that the default should be to use the current port instead. This is a simple patch to change that. This should only break in the case someone is relying on the current default to redirect from a non-standard port to the standard port, which should be a really rare case...

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

by Tobion at 2012-11-11T20:29:54Z

The idea is right but the implementation not. Seems this patch is not as "simple" as you said.
When you're on HTTPS and want to redirect to $scheme = HTTP, then it still uses the current HTTPS port which is wrong.

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

by flojon at 2012-11-11T20:36:47Z

Ah, I see the problem. So I guess the correct behavior would be to use the current port if staying with the same scheme or go to standard port if switching scheme. Unless the user has specified a port which will always override...

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

by Tobion at 2012-11-11T20:42:18Z

That would be the best solution that is currently possible but not the best solution that should be possible.
Because if you switch scheme but the other scheme does not use the standard port, it still doesn't work.
Ideally the Request class had an option that allows to define the ports symfony should use for HTTP and HTTPS.
This logic is in RequestContext, but it's not used here.

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

by flojon at 2012-11-11T21:32:55Z

Bummer, I forgot to check if the current port is a standard port...

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

by Tobion at 2012-11-11T21:35:13Z

add some tests

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

by flojon at 2012-11-11T23:28:18Z

Added tests and fixed my previous error

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

by flojon at 2012-11-15T18:25:12Z

@Tobion is there anything else I needed for this?

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

by fabpot at 2012-11-19T12:56:04Z

To be consistent with how we manage HTTP ports elsewhere, I'd rather use the values of the `request_listener.http_port` and `request_listener.https_port`:

```php
        if (null === $httpPort) {
            $httpPort = $this->container->getParameter('request_listener.http_port');
        }

        if (null === $httpsPort) {
            $httpsPort = $this->container->getParameter('request_listener.https_port');
        }
```

This is done in the `security.authentication.retry_entry_point` service and for the `router_listener` listener.

The parameter name is probably not the best one, but that could be changed then in master.

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

by flojon at 2012-11-19T13:49:18Z

@fabpot But then you would need to set that parameter manually right? It wouldn't automatically redirect you to the same port, which was what I wanted to achieve...

Could this be the right order of preference:
If a value was specified in the route use that.
Otherwise use the current port
unless switching scheme then use the parameter value

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

by fabpot at 2012-11-19T13:52:17Z

Your order of preference looks good to me.

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

by flojon at 2012-11-19T19:13:19Z

Man this was more involved than I thought... :)
Changed the logic to use the parameters when not using the current port. Also tried clean up the tests a little bit... Enjoy!
2012-11-19 20:59:22 +01:00
src/Symfony merged branch flojon/patch-3 (PR #5984) 2012-11-19 20:59:22 +01:00
tests merged branch sstok/fix_digest_authentication (PR #5874) 2012-11-19 14:04:22 +01:00
.gitignore add composer to gitignore in 2.0 2012-05-10 16:15:45 +03:00
.travis.yml Add 5.3.3 to Travis, now is available. 2012-05-28 15:38:15 +03:00
autoload.php.dist bumped minimal version of Swiftmailer to 4.2.0 2012-06-29 18:02:19 +02:00
CHANGELOG-2.0.md updated CHANGELOG for 2.0.18 2012-10-25 10:56:03 +02:00
composer.json Update monolog compatibility 2012-08-19 09:57:44 +02:00
CONTRIBUTING.md Create CONTRIBUTING.md file for auto-linking in PR's 2012-09-17 14:40:53 -04:00
CONTRIBUTORS.md update CONTRIBUTORS for 2.0.18 2012-10-25 10:56:32 +02:00
LICENSE Updated LICENSE files copyright 2012-02-22 10:10:37 +01:00
phpunit.xml.dist [Security] cleaned up opt-in to benchmark test 2011-03-06 20:06:13 +01:00
README.md point the status icon to 2.0 2011-11-22 20:15:25 +01:00
UPDATE.ja.md updated translation of UPDATE file (Japanese RC5 added) 2011-07-30 02:08:25 +09:00
UPDATE.md UPDATE.md: trivial markdown syntax fix 2011-11-15 10:19:29 -08:00
vendors.php updated vendors for 2.0.18 2012-10-25 10:54:02 +02:00

README

Build Status

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.

Contributing

Symfony2 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.