Commit Graph

11905 Commits

Author SHA1 Message Date
Tobias Schultze
26e56842dc some type fixes 2012-11-12 11:54:32 +01:00
Tobias Schultze
514e27a511 [Routing] fix PhpMatcherDumper that returned numeric-indexed params that are returned besides named placeholders by preg_match 2012-11-12 11:54:32 +01:00
Tobias Schultze
7ed3013a5b switch to array_replace instead of array_merge
we don't need the logic to merge numeric keys, as we don't have them. I could also improve the genrated code by PhpMatcherDumper a little by saving a function call.
2012-11-12 11:54:29 +01:00
Tobias Schultze
94ec653818 removed irrelevant string case in XmlFileLoader
getAttribute() always returns a string
2012-11-12 11:35:46 +01:00
Tobias Schultze
9ffe3de642 synchronize the fixtures in different formats and fix default for numeric requirement 2012-11-12 11:35:46 +01:00
Arnaud Le Blanc
6cd34570d7 fixed CS 2012-11-12 11:35:46 +01:00
Arnaud Le Blanc
8366b8ab27 [Routing] fixed validity check for hostname params in UrlGenerator 2012-11-12 11:35:18 +01:00
Arnaud Le Blanc
a8ce6210b3 [Routing] added support for hostname in the apache matcher dumper 2012-11-12 11:35:18 +01:00
Fabien Potencier
562174a822 [Routing] fixed indentation of dumped collections 2012-11-12 11:14:25 +01:00
Fabien Potencier
1489021552 fixed CS 2012-11-12 11:14:25 +01:00
Fabien Potencier
a270458d40 [Routing] added some more unit tests 2012-11-12 11:14:25 +01:00
Fabien Potencier
153fcf2596 [Routing] added some unit tests for the PHP loader 2012-11-12 11:14:25 +01:00
Fabien Potencier
68da6ad292 [Routing] added support for hostname in the XML loader 2012-11-12 11:14:25 +01:00
Fabien Potencier
3dfca47bcd [Routing] added some unit tests for the YAML loader 2012-11-12 11:14:24 +01:00
Fabien Potencier
92f9c1561b [Routing] changed CompiledRoute signature to be more consistent 2012-11-12 11:14:24 +01:00
Fabien Potencier
d91e5a26a2 [Routing] fixed Route annotation for hostname (should be hostname_pattern instead of hostnamePattern) 2012-11-12 11:14:24 +01:00
Fabien Potencier
62de881ddb [Routing] clarified a variable content 2012-11-12 11:14:24 +01:00
Fabien Potencier
11b4378238 [Routing] added hostname support in UrlMatcher 2012-11-12 11:14:24 +01:00
Fabien Potencier
fc015d5227 [Routing] fixed route generation with a hostname pattern when the hostname is the same as the current one (no need to force the generated URL to be absolute) 2012-11-12 11:14:24 +01:00
Arnaud Le Blanc
462999d2d2 [Routing] display hostname pattern in router:debug output 2012-11-12 11:14:24 +01:00
Arnaud Le Blanc
805806a1e8 [Routing] added hostname matching support to UrlGenerator 2012-11-12 11:14:24 +01:00
Arnaud Le Blanc
7a15e006e6 [Routing] added hostname matching support to AnnotationClassLoader 2012-11-12 11:14:24 +01:00
Arnaud Le Blanc
cab450c94e [Routing] added hostname matching support to YamlFileLoader 2012-11-12 11:14:24 +01:00
Arnaud Le Blanc
85d11af880 [Routing] added hostname matching support to PhpMatcherDumper 2012-11-12 11:14:24 +01:00
Arnaud Le Blanc
402359ba9d [Routing] added hostname matching support to RouteCompiler 2012-11-12 11:14:24 +01:00
Arnaud Le Blanc
add3658001 [Routing] added hostname matching support to Route and RouteCollection 2012-11-12 11:14:24 +01:00
Arnaud Le Blanc
23feb37a98 [Routing] added hostname matching support to CompiledRoute 2012-11-12 11:14:24 +01:00
Fabien Potencier
f4c05e3fe8 merged branch samuelwilliams/formDoc (PR #5928)
This PR was squashed before being merged into the master branch (closes #5928).

Commits
-------

6a033f3 setData method also accepts objects. Doc should reflect this.

Discussion
----------

setData method also accepts objects. Doc should reflect this.

Bug fix: no
Feature addition: no
Backwards compatibility break: no
Symfony2 tests pass: yes
Fixes the following tickets: NA
Todo: None
License of the code: MIT
Documentation PR: None
2012-11-12 10:51:00 +01:00
Sam Williams
6a033f3724 setData method also accepts objects. Doc should reflect this. 2012-11-12 10:50:59 +01:00
Fabien Potencier
d55d3b823d merged branch igorw/protected-fileloader (PR #5981)
This PR was merged into the 2.1 branch.

Commits
-------

c659e78 Make YamlFileLoader and XmlFileLoader file loading extensible

Discussion
----------

Make YamlFileLoader and XmlFileLoader file loading extensible

Bug fix: no
Feature addition: no
Backwards compatibility break: no
Symfony2 tests pass: yes
License of the code: MIT
Documentation PR: not needed

For phpBB we want to use a non-dumped container in the dev env to prevent having to clear the cache all the time. We're creating the container twice because we need some information at compile time which must be fetched from the container. The process is as follows:

Create temp container, get list of installed extensions (think bundles), create a compiler pass with the extensions list, create a new container with that compiler pass, compile it, dump it.

The problem is that we need to load and parse the YAML twice which is really slow. Caching it in the YamlFileLoader should save 50-100ms per page load.

By changing visibility to protected it becomes possible to extend the loader and cache file contents.
2012-11-12 10:50:10 +01:00
Fabien Potencier
8c244e3677 [Routing] updated CHANGELOG 2012-11-12 10:49:09 +01:00
Fabien Potencier
b0994603bb merged branch lyrixx/routing-annot-default-values (PR #5904)
This PR was squashed before being merged into the master branch (closes #5904).

Commits
-------

84adcb1 [2.2][Routing] Added support for default attributes with default values of method params

Discussion
----------

[2.2][Routing] Added support for default attributes with default values of method params

Bug fix: no
Feature addition: yes
Backwards compatibility break: no
Symfony2 tests pass: yes

With this patch, you can configure your default values likes this:

``` php
/**
 * @Route("/hi/{name}", name="hi")
 */
public function hiAction($name = "Bob")
{
    return new Response($name);
}
```

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

by Tobion at 2012-11-03T23:15:32Z

I'm unsure. How does one know if that param defines a default value or a requirement? It's too vague.

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

by lyrixx at 2012-11-03T23:35:27Z

It's only a default value, not a requirement.
It's just a shortcut to avoid  `defaults={"name"="bob"}`

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

by Tobion at 2012-11-03T23:43:51Z

Yes, but its not clear. It could also be a shortcut to `requirements={"name"="bob"}`, which has totally different meaning. So it's not self-explanatory.
-1 for me.

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

by lyrixx at 2012-11-03T23:48:21Z

it is the default php behavior. It's a default value for a variable...

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

by stof at 2012-11-04T00:22:58Z

@Tobion using the default value of the method to set a requirement does not make any sense. I don't see why someone would expect this behavior

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

by fabpot at 2012-11-06T10:12:05Z

@lyrixx Can you add some unit tests?

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

by Tobion at 2012-11-06T10:28:42Z

Oh I misunderstood the PR. I thought this makes the `name` param default to `hi`. `@Route("/hi/{name}", name="hi")`. But it's just the name of the route. Your example was easy to misinterpret as you used `name` everywhere.

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

by fabpot at 2012-11-10T08:33:13Z

@lyrixx Can you finish this PR?

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

by lyrixx at 2012-11-10T13:16:34Z

@fabpot Yes i will as soon as possible.

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

by lyrixx at 2012-11-10T18:34:07Z

I rebase and amend my commit. (I changed doc in commit message to be less confusing)

I will try to add tests.
But for now, `AnnotationClassLoader::load` is not really tested, and `AnnotationClassLoader::addRoute` is absolutely not tested. So I think I should add tests for these methods ? And then add tests for my patch.
I will try tomorrow.

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

by lyrixx at 2012-11-11T18:23:41Z

@fabpot I added new tests. I tried to made very atomic commits.
2012-11-12 10:46:50 +01:00
Grégoire Pineau
84adcb1c3e [2.2][Routing] Added support for default attributes with default values of method params 2012-11-12 10:46:49 +01:00
Fabien Potencier
dcef601ad4 merged branch dlsniper/stopwatch (PR #5966)
This PR was merged into the master branch.

Commits
-------

bdf0334 Fixed the lap method. Added upgrade notes. Some CS fixes

Discussion
----------

Fixed the lap method. Added upgrade notes. Some CS fixes

Bug fix: yes
Feature addition: no
Backwards compatibility break: no
Symfony2 tests pass: yes
Fixes the following tickets: ~
Todo: ~
License of the code: MIT
Documentation PR: ~

This adds some type-hinting to the Stopwatch components.
I've also split the Section class to its own file, I know it's not a must as per coding standards used by Symfony but it complies with most of the other classes in the framework.
I've updated the UPGRADE-2.2.md file as well.

There's a bug fix which I'm not sure it if should have been done in this branch or not.

Let me know if I should make this PR against an older version of the framework.

Thanks.
2012-11-12 10:43:44 +01:00
Fabien Potencier
a0887224bb merged branch arnaud-lb/apache-dumper (PR #5792)
This PR was merged into the master branch.

Commits
-------

c7a8f7a [Routing] fixed possible parameters conflict in apache url matcher

Discussion
----------

[Routing] fixed possible parameters conflict in apache url matcher

Bug fix: yes
Feature addition: no
Backwards compatibility break: no (as long as rewrite rules are generated after upgrading)
Symfony2 tests pass: yes

- This fixes a conflict in route parameters:

  The rewrite rules currently pass route informations through environment variables:

  `_ROUTING_DEFAULT_x`: passes the default value of parameter x
  `_ROUTING__allow_x`: passes the information that method x was allowed for this route
  `_ROUTING_x`: passes the value of parameter x

  The problem is that naming a route parameter `DEFAULT_*` or `_allow_*` would not behave as expected.

  I fixed this by namespacing all environment variables; e.g. parameters are in `_ROUTING_param_*`, defaults in `_ROUTING_default_*`, etc.

- The PR fixes a second issue: sometimes the variables are prefixed with multiple REDIRECT_. This PR handles this case by ignoring them all.

- This also improves performance a little:

  Matching a route with two parameters and two default parameters 100K times: (`$_SERVER` was copied from a real request, so with many non `_ROUTING_` variables)
  master: 6.6s
  this branch: 4.7s

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

by fabpot at 2012-10-27T13:37:24Z

Any news on this PR? Is it mergeable?

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

by arnaud-lb at 2012-10-27T14:50:08Z

There is an issue with default parameter values, I can't find how to fix that in a simple way. Before this PR, default values are never used (if a parameter is an optional not present in the url, the parameter's value is the empty string); after this PR, when a parameter is present and empty (e.g. a requirement like `.*`), its value is set to its default value.

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

by Tobion at 2012-10-29T01:36:08Z

The problem is, it's not consistent with the default php matcher. So one cannot safely exchange it with the apache matcher because it behaves differently under some (special) circumstances.

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

by fabpot at 2012-11-05T08:05:54Z

We need to move forward as I want to merge the hostname support in the routing ASAP to have plenty of time for feedback before the 2.2 release.

Does it sound reasonable to merge this PR as is an open a ticket about the remaining issue (which should not occur that often anyways)?

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

by arnaud-lb at 2012-11-05T09:22:02Z

@fabpot it sounds reasonable to me. Also, I've the hostname support branch is currently rebased so that it can be merged without this one.

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

by Tobion at 2012-11-11T21:50:20Z

Btw, does the ApacheMatcherDumper handle the _scheme requirement? It doesn't look like it. This would be another bug.
Anyway, we can probably merge this PR and open new issues for the remaining bugs.
2012-11-12 10:36:54 +01:00
Fabien Potencier
0876a19b53 merged branch dbu/make-baseurl-configurable (PR #5983)
This PR was merged into the master branch.

Commits
-------

d0e5ef1 [FrameworkBundle] move change note to changelog of FrameworkBundle instead of master UPGRADE-2.2
e77ecc9 [FrameworkBundle] switch to parameter for base url to make it configurable for tests and cli as done for host and scheme in d30943c2e8

Discussion
----------

[FrameworkBundle] switch to parameter for base url

This will make it configurable the same way we have it for host and scheme done for 2.1 in d30943c2e8

Bug fix: no
Feature addition: yes
Backwards compatibility break: no
Symfony2 tests pass: (no new test breakage)
Fixes the following tickets: -
Todo: -
License of the code: MIT
Documentation PR: (none yet. if this is merged, i will happily PR against doc if somebody can point me to the right place)

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

by dbu at 2012-11-11T18:44:33Z

doc will go here once its merged: http://symfony.com/doc/current/cookbook/console/generating_urls.html

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

by dbu at 2012-11-11T20:12:41Z

ok, moved to the FrameworkBundle changelog

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

by Tobion at 2012-11-11T20:34:28Z

unfortunately is naming is so wrong in many places of the Request class and the routing.
`base_url` is just an example. It's not an "URL" at all. It's a path only.

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

by dbu at 2012-11-12T07:47:55Z

@Tobion i saw that, but i chose to be consistent with the method name of RequestContext even if it is a wrong name.
2012-11-12 10:31:26 +01:00
Fabien Potencier
99ee736b2b merged branch vicb/httpkernel/tests (PR #5985)
This PR was merged into the master branch.

Commits
-------

e32ca2b [HttpKernel] Fix Symfony2 full framework tests

Discussion
----------

[HttpKernel] Fix Symfony2 full framework tests

Fix the path when the full framework is used

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

by fabpot at 2012-11-12T09:08:06Z

When is it broken?

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

by vicb at 2012-11-12T09:18:01Z

now, https://travis-ci.org/symfony/symfony/jobs/3159326
2012-11-12 10:30:29 +01:00
Victor Berchet
e32ca2b827 [HttpKernel] Fix Symfony2 full framework tests 2012-11-12 09:34:19 +01:00
David Buchmann
d0e5ef1355 [FrameworkBundle] move change note to changelog of FrameworkBundle instead of master UPGRADE-2.2 2012-11-11 21:12:12 +01:00
Fabien Potencier
b392a47cff merged branch vicb/changelog (PR #5982)
This PR was merged into the master branch.

Commits
-------

2972f31 [HttpKernel] Changlog update - document a BC break

Discussion
----------

[HttpKernel] Changlog update - document a BC break
2012-11-11 20:10:17 +01:00
David Buchmann
e77ecc95de [FrameworkBundle] switch to parameter for base url to make it configurable for tests and cli as done for host and scheme in d30943c2e8 2012-11-11 19:27:43 +01:00
Victor Berchet
2972f3142c [HttpKernel] Changlog update - document a BC break 2012-11-11 18:39:27 +01:00
Igor Wiedler
c659e7858a Make YamlFileLoader and XmlFileLoader file loading extensible
By changing visibility to protected it becomes possible to extend the
loader and cache file contents. phpBB needs this.
2012-11-11 12:59:36 +01:00
Fabien Potencier
b337655feb merged branch vicb/stopwatch (PR #5970)
This PR was squashed before being merged into the master branch (closes #5970).

Commits
-------

d0433b6 [Stopwatch] Get the "real size" used & minor tweaks

Discussion
----------

[Stopwatch] Get the "real size" used & minor tweaks

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

by vicb at 2012-11-11T09:45:50Z

@fabpot @maoueh thanks for your feedback, integrated.
2012-11-11 11:18:42 +01:00
Victor Berchet
d0433b69aa [Stopwatch] Get the "real size" used & minor tweaks 2012-11-11 11:18:42 +01:00
Fabien Potencier
c9f2ae6155 merged branch vicb/httpkernel/changelog (PR #5979)
This PR was merged into the master branch.

Commits
-------

f9e8465 [HttpKernel] Changelog update

Discussion
----------

[HttpKernel] Changelog update
2012-11-11 11:15:48 +01:00
Victor Berchet
f9e8465d1b [HttpKernel] Changelog update 2012-11-11 11:07:37 +01:00
Fabien Potencier
f3c644061a merged branch dlsniper/classloader-composer-tune (PR #5977)
This PR was merged into the master branch.

Commits
-------

02315a0 Removed duplicate line

Discussion
----------

Removed duplicate line

This just removes a duplicate line in ```composer.json``` file.

Thanks.
2012-11-11 09:34:44 +01:00
Florin Patan
02315a0b91 Removed duplicate line 2012-11-11 01:16:13 +02:00
Florin Patan
bdf0334434 Fixed the lap method. Added upgrade notes. Some CS fixes 2012-11-10 22:20:20 +02:00