Commit Graph

1026 Commits

Author SHA1 Message Date
Jordan Alliot
15dd17e9bd Simplified CONTENT_ headers retrieval 2012-03-26 23:58:48 +02:00
Artyom Protaskin
b718960857 HttpFoundation\HeaderBag Little improvement. 2012-03-24 11:17:54 +04:00
Fabien Potencier
a00ae273a6 fixed previous commit 2012-03-24 00:31:38 +01:00
Fabien Potencier
c4dfe931f1 [HttpFoundation] made the host lowercase as per RFC 952/2181 2012-03-23 20:09:44 +01:00
Fabien Potencier
09ab6430c0 merged branch drak/session_flashmessages (PR #3267)
Commits
-------

5ae76f1 [HttpFoundation] Update documentation.
910b5c7 [HttpFoudation] CS, more tests and some optimization.
b0466e8 [HttpFoundation] Refactored BC Session class methods.
84c2e3c [HttpFoundation] Allow flash messages to have multiple messages per type.

Discussion
----------

[2.1][HttpFoundation] Multiple session flash messages

Bug fix: no
Feature addition: yes
Backwards compatibility break: yes, but this already happened in #2583.  BC `Session` methods remain unbroken.
Symfony2 tests pass: yes
Fixes the following tickets: #1863
References the following tickets: #2714, #2753, #2510, #2543, #2853
Todo: -

This PR alters flash messages so that it is possible to store more than one message per flash type using the `add()` method or by passing an array of messages to `set()`.

__NOTES ABOUT BC__

This PR maintains BC behaviour with the `Session` class in that the old Symfony 2.0 methods will continue to work as before.

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

by drak at 2012-02-13T06:28:33Z

I think this is ready for review @fabpot @lsmith77

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

by lsmith77 at 2012-02-14T19:30:39Z

the FlashBag vs. AutoExpireFlashBag behavior and setup difference should probably also be explained in the upgrading log

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

by drak at 2012-02-15T04:43:14Z

@lsmith77 Those differences are explained already in the changelog

 * Added `FlashBag`. Flashes expire when retrieved by `get()` or `all()`.
   This makes the implementation ESI compatible.
 * Added `AutoExpireFlashBag` (default) to replicate Symfony 2.0.x auto expire behaviour of messages auto expiring
   after one page page load.  Messages must be retrived by `get()` or `all()`.

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

by Crell at 2012-02-19T17:35:34Z

Drak asked me to weigh in here with use cases.  Drupal currently has a similar session-stored-messaging system in place that I'd like to be able to replace with Flash messages.  We frequently have multiple messages within a single request, however, so this change is critical to our being able to do so.

For instance, when saving an article in Drupal there is, by default, a "yay, you saved an article!" type message that gets displayed.  If you also have the site configured to send email when a post is updated, you may see a "email notifications sent" message (depending on your access level).  If you have a Solr server setup for search, and you're in debug mode, there will also be a "record ID X added to Solr, it should update in 2 minutes" message.  And if there's a bug somewhere, you'll also get, as an error message rather than notice message, a "Oops, E_NOTICE on line 54" message.

Form validation is another case.  If you have multiple errors in a single form, we prefer to list all of them.  So if you screw up 4 times on a form, you may get 4 different error messages showing what you screwed up so you can fix it in one go instead of several.

Now sure, one could emulate that by building a multi-message layer on top of single-layer messages, but, really, why?  "One is a special case of many", and there are many many cases where you'll want to post multiple messages.  Like, most of Drupal. :-)

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

by lsmith77 at 2012-03-06T20:55:51Z

@fabpot is there any information you still need before merging this? do you want more discussion in which case you might want to take this to the mailing list ..

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

by drak at 2012-03-08T18:54:13Z

Another plus for this PR is that it requires no extra lines of code in templates etc to display the flashes, see https://github.com/symfony/symfony/pull/3267/files#diff-1

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

by drak at 2012-03-15T06:38:21Z

Rebased against current `master`, should be mergeable again..

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

by evillemez at 2012-03-17T03:08:41Z

+1 to this, I have an extended version of HttpFoundation just for this... would love to get rid of it.
2012-03-23 17:58:09 +01:00
Fabien Potencier
30cd43c68a fixed CS 2012-03-23 14:14:07 +01:00
Fabien Potencier
3deccc5ec8 [HttpFoundation] fixed phpdoc 2012-03-23 13:49:00 +01:00
Fabien Potencier
6381dbb8ed merged branch cboden/interfaces (PR #3520)
Commits
-------

bd02554 [HttpFoundation] SPL IteratorAggregate+Countable on *Bags
665fdeb [HttpFoundation] SPL on ParameterBag

Discussion
----------

[HttpFoundation] SPL on ParameterBag

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

Added a couple SPL interfaces to ParameterBag, added shortcuts to working with the parameters.  For example:

```php
<?php
    $post = Request::createFromGlobal()->request;
    echo "There are {count($post)} POST variables\n";

    foreach ($post as $key => $val) {
        echo "{$key}: {$val}\n";
    }
```

Thoughts?

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

by stealth35 at 2012-03-07T13:09:11Z

You already have the `all` method

``` php
<?php
$post = Request::createFromGlobals()->request->all();

echo "There are ", count($post), " POST variables\n";

foreach ($post as $key => $val) {
    echo "{$key}: {$val}\n";
}
```

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

by cboden at 2012-03-07T13:50:22Z

Yes, but when in the context of working with the Request object (or POST ParamegerBag), it's 1 more call and loose variable to set.

ParameterBag is a container, these common SPL interfaces give standard PHP container methods to it.

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

by lsmith77 at 2012-03-07T18:42:41Z

makes sense to me ..

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

by vicb at 2012-03-09T15:45:40Z

Probably makes sense. Could you check if any other `*Bag.php` needs to be updated so that it could ba an atomic merge.

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

by cboden at 2012-03-09T15:48:40Z

Whoops, good catch @vicb.  I made a poor assumption all the *Bags extended ParameterBag, while only some do.  I will post an update shortly.
2012-03-23 13:44:35 +01:00
Fabien Potencier
14a83ce064 merged branch pulzarraider/redis_session_storage (PR #3498)
Commits
-------

c4ee947 Native Redis Session Storage update
665f593 NativeRedisSessionStorage added

Discussion
----------

[HttpFoundation] Native Redis Session Storage

Bug fix: no
Feature addition: yes
Backwards compatibility break: no
Symfony2 tests pass: yes
Fixes the following tickets: -
Todo: -

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

by lstrojny at 2012-03-04T23:15:43Z

Does Symfony (or any of its dependencies) has Redis support in any form whatsoever? If not this might be a good point to decide which clients to support

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

by lsmith77 at 2012-03-04T23:36:11Z

well ideally we just get this cache interface stuff done .. for this use case it would be perfect.

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

by pulzarraider at 2012-03-05T00:35:59Z

There is RedisProfilerStorage available (based on phpredis). I prefer and write code for [phpredis](https://github.com/nicolasff/phpredis).

It's recommended by [official Redis homepage](http://redis.io/clients#PHP). [In this benchmark](http://dev.af83.com/2011/01/01/which-php-library-to-use-with-redis-the-benchmark.html
) is fastest and less memory consumpting.

But if somebody prefer predis (with phpiredis), rediska or something other widely used, there are no limitations to add support of it to Symfony.

My opinion is, that the C extension should be supported at first, because of good performance and native session storage support. Redis is quite young and the process of creating PHP clients is comparable to Memcache.
There were created pure PHP Memcache clients in the past (Google found for example [this](http://www.phpclasses.org/browse/file/20284.html) and [this](http://code.blitzaffe.com/pages/phpclasses/files/memcached_client_52-12)), but they are not being used now. Everyone, who is seriously thinking about performance, is using only the C Redis/Memcache(d)/... extensions.

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

by drak at 2012-03-05T07:40:06Z

+1 on this PR.  Needs a test written though.
I don't think there is any need to wait for #3493 imo.  I'll deal with it if this is merged before #3493.
Are there any PHP ini settings for this for this driver or is everything via the `session.save_path` directive? (A quick look at the C code seems to indicate there are no explicit ini directives).

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

by lstrojny at 2012-03-05T12:14:34Z

@pulzarraider I don’t necessarily disagree with the usage of phpredis, I just wanted to bring up the issues of various clients and people having different preferences about them.

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

by fabpot at 2012-03-05T14:46:22Z

@pulzarraider Can you add some unit tests before I merge?

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

by pulzarraider at 2012-03-11T20:19:57Z

@drak No there are no php.ini settings. Only RedisArray has some, but it's another feature.

@fabpot I've added simple test based on other session storage tests.

I planned to create a RedisSessionStorage, too, but I have no time for it now. This can be added later in another PR as it's independent from NativeRedisSessionStorage.

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

by drak at 2012-03-12T02:21:25Z

The code looks OK to me.

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

by fabpot at 2012-03-15T06:05:27Z

#3493 has been merged now.

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

by pulzarraider at 2012-03-16T23:21:27Z

Code updated.
2012-03-23 13:42:58 +01:00
Tobias Schultze
c3483d0eb9 performance improvement of JsonResponse saving 2 assignments and 1 variable 2012-03-22 22:53:40 +01:00
Toni Uebernickel
4a43453db8 remove callback from constructor and create method 2012-03-21 22:40:39 +01:00
Toni Uebernickel
601b87ca01 add basic validation of callback name 2012-03-20 11:05:22 +01:00
Toni Uebernickel
266f76d963 rename jsonp to callback, defaults to null 2012-03-20 10:10:35 +01:00
Toni Uebernickel
38b79a7023 add data and callback setter to JsonResponse 2012-03-19 19:40:54 +01:00
Toni Uebernickel
678822459b add JSONP support to JsonResponse 2012-03-19 18:29:39 +01:00
Fabien Potencier
05c523a7de removed obsolete phpdoc 2012-03-19 16:13:52 +01:00
Andrej Hudec
f351cdc52c doc fix 2012-03-17 00:59:57 +01:00
Andrej Hudec
c4ee947a83 Native Redis Session Storage update 2012-03-17 00:17:36 +01:00
Andrej Hudec
665f59348b NativeRedisSessionStorage added
- fix and simple unit test added
2012-03-17 00:17:33 +01:00
Chris Boden
bd02554289 [HttpFoundation] SPL IteratorAggregate+Countable on *Bags
Added the IteratorAggregate and Countable SPL Interfaces on all the *Bag classes in HttpFoundation
2012-03-15 16:41:06 -04:00
Fabien Potencier
5631002cd0 merged branch Seldaek/chainableresp (PR #3606)
Commits
-------

3297f75 Fix header override
076bd1e [HttpFoundation] Add create on StreamedResponse

Discussion
----------

Chainable response

Fixed feedback from #3605
2012-03-15 19:10:35 +01:00
Jordi Boggiano
3297f7548f Fix header override 2012-03-15 18:41:23 +01:00
Jordi Boggiano
076bd1e99f [HttpFoundation] Add create on StreamedResponse 2012-03-15 18:40:15 +01:00
Fabien Potencier
0ba5096fe6 fixed CS 2012-03-15 17:42:47 +01:00
Jordi Boggiano
ff13528ad0 [HttpFoundation] Add create method to Json & Redirect responses 2012-03-15 16:28:15 +01:00
Jordi Boggiano
1c86ad78ee [HttpFoundation] Add headers arg to RedirectResponse 2012-03-15 16:27:52 +01:00
Jordi Boggiano
873da434cd [HttpFoundation] Add chainability to the Response class 2012-03-15 16:27:06 +01:00
Fabien Potencier
bbd686a685 merged branch igorw/json-response (PR #3375)
Commits
-------

5fa1c70 [json-response] Add a JsonResponse class for convenient JSON encoding

Discussion
----------

[json-response] Add a JsonResponse class for convenient JSON encoding

Usage example:

    $data = array(user => $user->toArray());
    return new JsonResponse($data);

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

by drak at 2012-02-16T11:51:11Z

@fabpot - maybe we could benefit with a bit more sub-namespacing in this component.  One for Response for example and probably one for Request.

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

by Seldaek at 2012-02-16T15:07:31Z

@drak Please no. Moving the session was already a pain IMO since it was type-hinted in a few places (lack of interface, and interface doesn't include flash stuff still). Creating BC breaks just for fun like that is annoying for interop of bundles. It doesn't matter whether we have 10 or 15 classes in one directory.

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

by drak at 2012-02-17T08:33:46Z

@francodacosta The most optimal place is `__toString()`.

@Saldaek It just looks like the whole namespace is getting more cluttered.  I suggest it because things like Request/Response objects are surely only going to grow over time.  There is always the possibility to make BC for moved and renamed classes so there doesn't have to be any extra complications for making things look cleaner. Anyway, just a thought :-)

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

by stof at 2012-02-17T14:47:40Z

@drak Changing the namespace of a class is a BC break. The request and the response are used in many more places than the Session so it would be a real pain to update this. And the component is tagged with ``@api`` so BC breaks are forbidden without a good reason. The session refactoring was one as it was really an issue in the implementation, but simply renaming the class is not.

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

by fabpot at 2012-03-05T15:03:53Z

I'm -1 for adding this to the core. It does not add much value and why add a special response for JSON and not other formats?

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

by Seldaek at 2012-03-05T18:38:05Z

I think it's useful because it's a class we need in almost every project, and I don't think we're alone. It's super simple but makes me wonder every time why I have to recreate it. I don't want an additional bundle just for 3lines of code. Similarly I would say a JsonpResponse would be great, or maybe just an optional $callback arg to the json response to enable jsonp mode.

I just had someone ask me on irc how to do JSONP so while I think it's obvious and I'm sure you'd think that too, it obviously isn't to newcomers. The Response stuff is hidden behind those render methods & such and people don't realize they can simply subclass. If a few examples were in core it would be both helpful for learning and useful on a day to day basis.

As for other formats, well JSON is typically used nowadays, except when you want more fancy XML APIs, but for that the JMSSerializerBundle + FOSRestBundle are superior and we can't achieve such things in a few lines of code. I could also see a BinaryResponse or DownloadResponse or such that has proper "force-download" headers and accepts any binary stream, but that's another debate.

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

by dragoonis at 2012-03-05T19:43:05Z

I'm +1 for the concept but not commenting on how it should be implemented I'll leave that to other people.

Typically when you want to force a download you have to do ``content-disposition: attachment; filename="filehere.pdf"``
Modifying some response headers and the likes automatically for the user by returning a DownloadResponse object would be very handy..

I'm +1 for @Seldaek's point about examples of sub-classing for specific use cases. It will help with demonstrating how to do custom stuff the right way rather than people coming up with their own contraptions.

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

by stof at 2012-03-05T20:14:39Z

btw, regarding the BinaryResponse, there is a pending PR about it: #2606

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

by simensen at 2012-03-05T21:07:33Z

I'm +1 for providing reference implementations fo custom Response cases. I wanted to find best practices for handling JSONP requests/responses and couldn't find anything at all on the topic. I thought maybe extending Response might be useful but wasn't sure if that could be done safely or should be done at all.

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

by lsmith77 at 2012-03-05T22:28:01Z

@stof i think @drak was suggesting moving the class, but leaving an empty class extending from the new class in the old location to maintain BC

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

by stof at 2012-03-05T23:55:36Z

@lsmith77 This would force Symfony to use the BC class so that it does not break all typehints in existing code

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

by lsmith77 at 2012-03-06T00:22:15Z

BC hacks are never nice .. the goal would just be to eventually have all those classes and more importantly all new ones in a subnamespace. actually it might be easier to just leave all the classes in the old location and create new ones extending from the old ones. anyway .. personally i am also not such a big fan of these specialized responses .. but i guess i see FOSRestBundle as the alternative answer which makes me biased.

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

by Seldaek at 2012-03-06T07:57:36Z

I'm using FOSRestBundle when it's needed, but when you just have a small scale app that needs one or two json responses for specialized stuff it is slightly overkill. And again, newcomers probably won't know about it, and encouraging using it for simple use cases isn't exactly the best learning curve we can provide.

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

by COil at 2012-03-06T23:12:15Z

+1 for this. I have implemented such a function in all my sf1 projects, it will be the same for sf2.

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

by fabpot at 2012-03-15T13:22:27Z

Closing this PR in favor of a cookbook that explains how a developer can override the default Response class (this JSON class being a good example). see symfony/symfony-docs#1159

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

by Seldaek at 2012-03-15T13:25:08Z

Meh. Forcing people to copy paste code from the cookbook in every second project isn't exactly a step forward with regard to ease of use and user-friendliness.

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

by Seldaek at 2012-03-15T13:26:48Z

I mean following this logic, things like the X509 authentication should just be put in cookbooks too because almost nobody needs that. We have tons of code in the framework, I don't get the resistance with adding such a simple class which makes code more expressive.

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

by fabpot at 2012-03-15T13:53:07Z

because X509 authentication is not easy to get it right. Sending a JSON response is as simple as it can get:

    new Response(json_encode($data), 200, array('Content-Type' => 'application/json'));

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

by marijn at 2012-03-15T13:54:25Z

Perhaps we need a `Symfony\Extensions\{Component}` namespace for things that don't necessarily belong in the core but are truly useful...

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

by Seldaek at 2012-03-15T14:03:40Z

I still fail to see why it doesn't belong in core.. There are tons of little helpers here and there, a base controller class made only of proxies, and then this gets turned down because it is simple to do it yourself? Sure it is simple, but it's repetitive and boring too. And while it's simple when you know your way around, some people aren't really sure how to do it.

The whole point of a framework is to avoid repetitive bullshit and be more productive. @fabpot do you have any real arguments against? I can see that you don't see a big use to it, fair enough, but do you see any downside at all?
2012-03-15 15:42:36 +01:00
Fabien Potencier
697befc6e9 [HttpFoundation] updated the list of known mime types based on the Apache HTTPD list (closes #3563) 2012-03-15 14:08:50 +01:00
Miha Vrhovnik
c3dc04a9e8 fixed typos in composer file 2012-03-15 11:15:25 +01:00
Drak
910b5c7f83 [HttpFoudation] CS, more tests and some optimization. 2012-03-15 12:15:54 +05:45
Drak
b0466e8bb4 [HttpFoundation] Refactored BC Session class methods.
If code has not be refactored for the new API's then
you would still be using the API with one message per $name.
2012-03-15 12:14:11 +05:45
Drak
84c2e3caf7 [HttpFoundation] Allow flash messages to have multiple messages per type. 2012-03-15 11:55:52 +05:45
Drak
eb9bf05637 [HttpFoundation] Remove hard coded assumptions and replace with API calls. 2012-03-15 09:51:39 +05:45
Drak
7f33b33aa6 Refactor SessionStorage to NativeSessionStorage.
Native here refers to the fact the session storage interacts with real PHP sessions.
2012-03-14 20:59:57 +05:45
Drak
b12ece0ff7 [HttpFoundation][FrameworkBundle] Separate out mock session storage and stop polluting global namespace.
This makes mock sessions truly mock and not to interfere with global namespace.
Add getters and setters for session name and ID.
2012-03-14 20:32:06 +05:45
Drak
39526df67c [HttpFoundation] Refactor away options property.
It does not make sense to try and store session ini directives since they can be changes outside
of the class as they are part of the global state.

Coding stan
2012-03-14 20:30:05 +05:45
Drak
cb873b250b [HttpFoundation] Add tests and some CS/docblocks. 2012-03-14 20:29:58 +05:45
Drak
2257a3d4d6 [HttpFoundation] Move session handler classes. 2012-03-14 20:15:55 +05:45
Drak
0a064d8aa1 [HttpFoundation] Refactor session handlers. 2012-03-14 20:15:51 +05:45
Drak
23267077ff [HttpFoundation] Split session handler callbacks to separate object. 2012-03-14 20:15:48 +05:45
Drak
bb30a447c5 [HttpFoundation] Prepare to split out session handler callback from session storage. 2012-03-14 20:15:44 +05:45
stealth35
b217897ecb [HttpFoundation] Complete Request::overrideGlobals 2012-03-11 12:02:08 +01:00
Drak
0761b8a107 [HttpFoundation] Restore compliance with RFC2324 2012-03-11 11:04:36 +05:45
Markus Lanthaler
bc62effcf8 [HttpFoundation] Complete HTTP status code translation table (fix #2552)
The HTTP status code translation table was updated to include all HTTP status codes as defined by the IANA Hypertext Transfer Protocol (HTTP) Status Code Registry (http://www.iana.org/assignments/http-status-codes/).
2012-03-10 20:09:53 +08:00
Fabien Potencier
70532ca4a7 merged 2.0 2012-03-08 19:29:37 +01:00
marc.weistroff
f7188598a3 [HttpFoundation] Removes use of parameter in Request::getClientIp function. 2012-03-07 16:11:42 +01:00
Chris Boden
665fdebc8c [HttpFoundation] SPL on ParameterBag
Added some SPL interface goodness to the ParameterBag class
2012-03-06 10:07:49 -05:00
Fabien Potencier
ab75727f43 fixed CS 2012-03-02 21:43:08 +01:00
Fabien Potencier
cda5ffaeeb merged branch Toflar/patch-1 (PR #3408)
Commits
-------

4f8e8ef Improving performance on digit filtering

Discussion
----------

Improving performance on digit filtering

I haven't tested it on a productive system but I think it should be way faster to use filter_var() instead of preg_replace() for several reasons.

This is my first pull request for symfony and I don't know how you do those kind of performance tests but please verify my assumption if you can :-)

Maybe we can also use filter_var() to replace other regular expressions :-)

HTH =)

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

by drak at 2012-02-22T00:35:44Z

@Toflar - nice move +1

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

by drak at 2012-02-22T18:53:40Z

@Toflar - Maybe you can bench the changes using this as a template: https://gist.github.com/1356129

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

by Toflar at 2012-02-23T13:18:18Z

I have already. And it's way faster, otherwise I wouldn't have opened a pull request ;) But obviously it strongly depends on the length of the string and the environment. That's why I was wondering whether you have a general performance tests environment ;) Because the results strongly depend on other factors, there's - in my opinion - no point in exact results. If a general info is sufficient: my tests for the regex resulted in about 7 - 8 microseconds whereas the filter version only took 1.5 - 2 microseconds for the same string.
2012-03-02 21:42:36 +01:00
Fabien Potencier
42923f3044 merged branch mvrhov/session_cookie_merge (PR #3423)
Commits
-------

471b564 auto_start should be false
6e2a7da Support session cookie options with cookie_ prefix
e0fba80 Properly merge session cookie_* parameters

Discussion
----------

Set session.cookie_* parameters properly

Bug fix: yes
Feature addition: no
Backwards compatibility break: yes
Symfony2 tests pass: yes
Fixes the following tickets: /

Cookie parameters in $options are not prefixed with cookie_ the same is true for data returned from session_get_cookie_params.

I've marked this as BC because the options that get dumped into the container have different name. But I don't think anybody was actually changing them or accessing them in their bundles.

P.S. @drak also desires some credits for this PR as I incorporated some lines written by him in one of the iterations.

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

by drak at 2012-02-23T14:24:42Z

@mvrhov - what does this fix exactly? It looks like a different way of doing the same thing but now there is no default value on `cookie_httponly`.

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

by mvrhov at 2012-02-23T15:09:17Z

Like I said in description. $option contains some cookie options and none of them has cookie_ prefix.
And this prefix is needed in two cases:
- to properly merge defaults and override them with what user set
- in a foreach for for proper ini_set

Sorry non native speaker an a bit hard to explain, could you ping me in a couple of hours on IRC if this still doesn't make any sense.

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

by drak at 2012-02-23T15:29:41Z

@mvrhov - I wrote some tests for this particular code and I still don't see what this PR fixes. I'll try to catch you on IRC later on but can't guarantee it.

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

by mvrhov at 2012-02-23T16:02:41Z

added test

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

by drak at 2012-02-24T08:30:51Z

Just for reference for those reading this ticket, `session_set_cookie_params()` alters the runtime ini settings it corresponds to see http://docs.php.net/manual/en/function.session-set-cookie-params.php so we agreed to remove the special handling that was present since it is redundant.

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

by dlsniper at 2012-02-28T22:19:32Z

Hi, Is this patch relevant or not after all?
ping @drak @mvrhov

Thanks :)

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

by drak at 2012-02-29T03:34:22Z

It is relevant.  Maybe I'll do the cleanup this PR by forking it if @mvrhov doesn't have time.

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

by mvrhov at 2012-02-29T05:40:47Z

Fixed the typo and changed the false to ture as reported in comments. I've also rebased. I'll see what I can do about config file change later today. Sorry for the delay, been too busy for the past week.

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

by mvrhov at 2012-02-29T08:49:23Z

I've also done the config part.

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

by mvrhov at 2012-02-29T11:01:14Z

Ok, this should be it.

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

by drak at 2012-03-01T00:59:16Z

@fabpot - looks good from my side.
2012-03-01 11:39:59 +01:00
Drak
09be5cb87c [HttpFoundation] Documentation.
Added blocks, updated links and references and fixed typos.
Note it is not possible to throw exceptions in the write or close methods of a session save handler.
2012-03-01 07:19:15 +05:45
Drak
7f8c293070 [HttpFoudation] Add ability to configure sqlite session storage. 2012-03-01 06:42:02 +05:45
Miha Vrhovnik
471b5648ef auto_start should be false 2012-02-29 15:34:20 +01:00
Miha Vrhovnik
e0fba80057 Properly merge session cookie_* parameters
Prefixed following session options: 'lifetime', 'path', 'domain', 'secure',
 'httponly' because this results in better session driver code
2012-02-29 06:35:26 +01:00
Benjamin Eberlei
dc2d5a0581 [HttpFoundation][Session] Fix bug in PDO Session Storage with SQLSRV making assumptions about parameters with length being OUTPUT not INPUT parameters. 2012-02-27 15:57:52 +01:00
Fabien Potencier
d9959af406 merged branch Seldaek/composer_alias (PR #3457)
Commits
-------

bafcaaf Removed version field
f9d9dc7 Add branch-alias for composer

Discussion
----------

Add branch-alias for composer

This should restore the 2.1-dev version (as an alias of dev-master) so that `2.*` or `2.1.*` constraints work again. I'll adjust packagist soon to also display those aliases.
2012-02-27 10:07:31 +01:00
Jordi Boggiano
bafcaafbe6 Removed version field 2012-02-27 09:59:20 +01:00
Florin Patan
eb58dd1485 Removed useless parameter from Memcached::set() 2012-02-25 17:34:02 +02:00
Jordi Boggiano
f9d9dc7ce9 Add branch-alias for composer 2012-02-25 03:26:20 +01:00
Fabien Potencier
f373085928 merged 2.0 2012-02-22 18:59:56 +01:00
marc.weistroff
89868f7901 Updated LICENSE files copyright 2012-02-22 10:10:37 +01:00
Drak
2871ea062e Update composer for HttpFoundation's PHP 5.4 forward compatibility. 2012-02-22 07:07:18 +05:45
Drak
dd2c4aa61f [HttpFoundation] Documentation. 2012-02-22 07:07:11 +05:45
Drak
e585ca783d [HttpFoundation] Added forward compatibility for \SessionHandlerInterface 2012-02-22 07:07:07 +05:45
Yanick Witschi
4f8e8efe08 Improving performance on digit filtering 2012-02-21 18:08:57 +01:00
Fabien Potencier
74ebd057a1 merged branch tna/session-cache-limiter (PR #3400)
Commits
-------

fb2bb65 [HttpFoundation] Fix session.cache_limiter is not set correctly

Discussion
----------

[HttpFoundation] Fix session.cache_limiter is not set correctly

Bug fix: yes
Feature addition: no
Backwards compatibility break: no
Symfony2 tests pass: yes
Fixes the following tickets: -
Todo: -

Fixes a regression after the session refactoring where extra cache control http headers are sent.

This was previously handled by [calling session_cache_limiter(false) in NativeSessionStorage](https://github.com/symfony/symfony/blob/2.0/src/Symfony/Component/HttpFoundation/SessionStorage/NativeSessionStorage.php#L81)

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

by drak at 2012-02-21T12:23:48Z

@fabpot - this code can be merged imo.
2012-02-21 14:47:46 +01:00
Tobias Naumann
fb2bb65b1e [HttpFoundation] Fix session.cache_limiter is not set correctly 2012-02-19 21:07:38 +01:00
Marcel Beerta
b4c53238b0 Added comma to array initializer, reverted permissions back to 644 2012-02-19 19:31:41 +01:00
Marcel Beerta
3dd851afed Use correct parameters 2012-02-19 13:22:38 +01:00
Marcel Beerta
0e0141805c Fix default if no serverpool is provided 2012-02-19 08:56:31 +01:00
Marcel Beerta
2a65121865 Fix several issues in MemccheSessionStorage which prevented it from being used correctly 2012-02-19 08:46:28 +01:00
Igor Wiedler
5fa1c700d4 [json-response] Add a JsonResponse class for convenient JSON encoding
Usage example:

    $data = array(user => $user->toArray());
    return new JsonResponse($data);
2012-02-16 10:40:19 +01:00
Fabien Potencier
60846105c3 merged branch drak/session_tests (PR #3360)
Commits
-------

d077ede [HttpFoundation] Increase test coverage.
cbb3e69 [HttpFoundation] Increase test coverage.

Discussion
----------

[HttpFoundation] Increase session test coverage.

Bug fix: no
Feature addition: no
Backwards compatibility break: no
Symfony2 tests pass: yes
Fixes the following tickets: -
Todo: -
2012-02-15 11:02:16 +01:00
Drak
d077edebb4 [HttpFoundation] Increase test coverage. 2012-02-14 21:41:27 +05:45
craigmarvelley
8935decd2c Added support for SVG mime type 2012-02-14 11:06:36 +00:00
Drak
137b0026b7 [HttpFoundation] Make SessionHandlerInterface compatible with PHP 5.4's SessionHandlerInterface 2012-02-13 11:48:55 +05:45
Drak
cab1060a76 [HttpFoundation] Add tests for session memcache/d storage drivers. 2012-02-12 20:08:50 +05:45
Fabien Potencier
fc7d0110f7 [HttpFoundation] removed Serializable from SessionInterface
If you need to serialize the session, you need to get the bags and
serialize them instead.
2012-02-12 14:51:23 +01:00
Fabien Potencier
1da8deee4e merged branch drak/session_memcache_tests (PR #3335)
Commits
-------

fe870be [HttpFoundation] Added tests for memcache/d storage drivers.

Discussion
----------

[WIP][2.1][HttpFoundation] Add tests for session memcache/d storage drivers.

__[WIP] pending merge of PR 3333, no review please.__

Bug fix: no
Feature addition: no
Backwards compatibility break: no
__Symfony2 tests pass: no__
Fixes the following tickets: -
Todo: -
2012-02-12 13:08:22 +01:00
Christophe Coevoet
2c767d163b [HttpFoundation] Fixed closeSession for the Memcached storage 2012-02-12 12:08:35 +01:00
Drak
fe870beae3 [HttpFoundation] Added tests for memcache/d storage drivers. 2012-02-12 16:06:54 +05:45
Christophe Coevoet
ec44e6831a [HttpFoundation] Fixed the use of the prefix for the Memcached storage 2012-02-12 04:00:20 +01:00
Christophe Coevoet
8e34f43723 Fixed the phpdoc for the Response class 2012-02-12 02:04:15 +01:00
Christophe Coevoet
5808773b51 [HttpFoundation] Fixed a typo and updated the phpdoc for the session 2012-02-12 01:56:08 +01:00
Christophe Coevoet
0550bef14d Removed methods duplicated from parent class 2012-02-12 01:20:46 +01:00
Fabien Potencier
5efbd9f50e [HttpFoundation] fixed Request::create() when passing arguments as an array (closes #3314) 2012-02-12 00:26:10 +01:00
Fabien Potencier
cb6fdb1f5e [HttpFoundation] removed Session::close() 2012-02-11 15:53:54 +01:00
Drak
c59d880593 Docblocks. 2012-02-11 20:15:36 +05:45
Fabien Potencier
8a01dd5cff renamed getFlashes() to getFlashBag() to avoid clashes 2012-02-11 13:18:56 +01:00
Fabien Potencier
282d3ae1d8 updated CHANGELOG for 2.1 2012-02-11 12:54:27 +01:00
Fabien Potencier
0f6c50ac69 [HttpFoundation] added some method for a better BC 2012-02-11 12:43:38 +01:00
Fabien Potencier
93d81a171c [HttpFoundation] removed configuration for session storages in session.xml as we cannot provide a way to configure them (like before this PR anyway) 2012-02-11 12:21:41 +01:00
Fabien Potencier
74ccf7062a reverted 5b7ef11650 (Simplify session
storage class names now we have a separate namespace for sessions)
2012-02-11 12:04:50 +01:00
Fabien Potencier
04942502a5 removed unused use statements 2012-02-11 11:53:03 +01:00
Fabien Potencier
7878a0a11a [HttpFoundation] renamed pop() to all() and getAll() to all() 2012-02-11 11:53:00 +01:00
Drak
0d2745f750 [HttpFoundation] Remove constants from FlashBagInterface
As requested by fabpot.
Corrected a few mistakes in the documentation.
2012-02-11 11:24:43 +05:45
Drak
dad60efccc [HttpFoundation] Add back get defaults and small clean-up.
Changed read-only method names from get*() to peek*()

Typo
2012-02-11 11:24:39 +05:45
Drak
5b7ef11650 [HttpFoundation] Simplify session storage class names now we have a separate namespace for sessions. 2012-02-11 11:24:35 +05:45
Drak
27530cbb1e [HttpFoundation] Moved session related classes to own sub-namespace. 2012-02-11 11:24:31 +05:45
Drak
468391525a [HttpFoundation] Free bags from session storage and move classes to their own namespaces. 2012-02-11 11:24:26 +05:45
Drak
398acc9e9f [HttpFoundation] Reworked flashes to maintain same behaviour as in Symfony 2.0 2012-02-11 11:24:15 +05:45
Drak
f98f9ae8ff [HttpFoundation] Refactor for DRY code.
Rename ArraySessionStorage to make it clear the session is a mock for testing purposes only.
Has BC class for ArraySessionStorage
Added sanity check when starting the session.
Fixed typos and incorrect php extension test method
session_module_name() also sets session.save_handler, so must use extension_loaded() to check if module exist
or not.
Respect autostart settings.
2012-02-11 11:24:11 +05:45
Drak
9dd4dbed6d Documentation, changelogs and coding standards. 2012-02-11 11:24:07 +05:45
Drak
669bc96c7f [HttpFoundation] Added pure Memcache, Memcached and Null storage drivers. 2012-02-11 11:21:22 +05:45
Drak
e185c8d63b [HttpFoundation] Refactored component for session workflow. 2012-02-11 11:21:18 +05:45
Drak
85b5c43c7a [HttpFoundation] Added drivers for PHP native session save handlers, files, sqlite, memcache and memcached. 2012-02-11 11:21:14 +05:45
Drak
57ef984e95 [HttpFoundation] Added unit and functional testing session storage objects. 2012-02-11 11:21:10 +05:45
Drak
3a263dc088 [HttpFoundation] Introduced session storage base class and interfaces.
Session object now implements SessionInterface to make it more portable.

AbstractSessionStorage and SessionSaveHandlerInterface now makes implementation
of session storage drivers simple and easy to write for both custom save handlers
and native php save handlers and respect the PHP session workflow.
2012-02-11 11:21:06 +05:45
Drak
c9694237d2 [HttpFoundation] Added FlashBagInterface and concrete implementation.
This commit outsources the flash message processing to it's own interface.

Overall flash messages now can have multiple flash types and each type can
store multiple messages.  For convenience there are now four flash types
by default, INFO, NOTICE, WARNING and ERROR.

There are two concrete implementations: one preserving the old behaviour of
flash messages expiring exactly after one page load, regardless of being
displayed or not; and the other where flash messages persist until explicitly
popped.
2012-02-11 11:21:02 +05:45
Drak
39288bcdaa [HttpFoundation] Added AttributesInterface and AttributesBagInterface and concrete implementations.
This commit outsources session attribute storage to it's own class.
There are two concrete implementations, one with structured namespace storage and the other
without.
2012-02-11 11:20:58 +05:45
Victor Berchet
e3cf37fe84 [HttpFoundation] RedirectResponse: add the ability to retrieve the target URL, add unit tests 2012-02-06 19:09:24 +01:00
Jörg Rühl
4bc0c672df [HttpFoundation] fix a small copy and paste error 2012-02-01 17:25:43 +01:00
Fabien Potencier
de1ea6c390 [HttpFoundation] added some info in Request:get() phpdoc 2012-01-24 10:24:25 +01:00
Fabien Potencier
9c3c53a5c1 merged 2.0 2012-01-17 11:23:18 +01:00
Fabien Potencier
733ac9de7a [HttpFoundation] fixed exception message (closes #3123) 2012-01-16 22:09:07 +01:00
Fabien Potencier
5fa0f2d92b merged 2.0 2012-01-16 07:44:08 +01:00
Kris Wallsmith
d67d419f3c [HttpFoundation] added missing trustProxy condition 2012-01-13 11:05:57 -08:00
Kris Wallsmith
fe62401907 optimized string starts with checks
Doing this with strpos() is slightly faster than substr().
2012-01-11 11:33:56 -08:00
Fabien Potencier
b9a14f0411 merged 2.0 2012-01-11 15:47:52 +01:00
Fabien Potencier
7ee2f6da75 fixed some phpdoc 2012-01-11 15:46:50 +01:00
Fabien Potencier
ca8dc87940 merged 2.0 2012-01-09 11:51:30 +01:00
Tobias Schultze
17284937f6 made the assertions in the RequestTest more explicit and improved PHPDoc 2012-01-09 06:33:53 +01:00
Fabien Potencier
8ce034fae0 Revert "merged 2.0"
This reverts commit 7000e944fd, reversing
changes made to 9d9013d662.
2012-01-08 20:43:02 +01:00
Christophe Coevoet
9bc41d00d1 [HttpFoundation] Fixed #3053 2012-01-07 14:27:33 +01:00
Tobias Schultze
daee68a54e fixed typos and unified PHPDoc in the Response class 2012-01-05 23:17:04 +01:00
Fabien Potencier
7000e944fd merged 2.0 2012-01-05 14:54:04 +01:00
Fabien Potencier
208c2e468c removed the version attribute in all composer.json files 2012-01-05 14:51:20 +01:00
Igor Wiedler
83c23ca0be [streaming] Do not set a Transfer-Encoding header of chunked
Apache expects the response to already be in chunked format in that case,
which causes it to not deliver the streamed body.

If no Content-Length is set on the response, web servers will automatically
switch to chunked Transfer-Encoding, and handle the chunking for you.

Nginx does not share the issue that apache has, but will add the Content-
Length header too.
2012-01-02 19:50:39 +01:00
Fabien Potencier
899e252032 merged branch symfony/streaming (PR #2935)
Commits
-------

887c0e9 moved EngineInterface::stream() to a new StreamingEngineInterface to keep BC with 2.0
473741b added the possibility to change a StreamedResponse callback after its creation
8717d44 moved a test in the constructor
e44b8ba made some cosmetic changes
0038d1b [HttpFoundation] added support for streamed responses

Discussion
----------

[HttpFoundation] added support for streamed responses

To stream a Response, use the StreamedResponse class instead of the
standard Response class:

    $response = new StreamedResponse(function () {
        echo 'FOO';
    });

    $response = new StreamedResponse(function () {
        echo 'FOO';
    }, 200, array('Content-Type' => 'text/plain'));

As you can see, a StreamedResponse instance takes a PHP callback instead of
a string for the Response content. It's up to the developer to stream the
response content from the callback with standard PHP functions like echo.
You can also use flush() if needed.

From a controller, do something like this:

    $twig = $this->get('templating');

    return new StreamedResponse(function () use ($templating) {
        $templating->stream('BlogBundle:Annot:streamed.html.twig');
    }, 200, array('Content-Type' => 'text/html'));

If you are using the base controller, you can use the stream() method instead:

    return $this->stream('BlogBundle:Annot:streamed.html.twig');

You can stream an existing file by using the PHP built-in readfile() function:

    new StreamedResponse(function () use ($file) {
        readfile($file);
    }, 200, array('Content-Type' => 'image/png');

Read http://php.net/flush for more information about output buffering in PHP.

Note that you should do your best to move all expensive operations to
be "activated/evaluated/called" during template evaluation.

Templates
---------

If you are using Twig as a template engine, everything should work as
usual, even if are using template inheritance!

However, note that streaming is not supported for PHP templates. Support
is impossible by design (as the layout is rendered after the main content).

Exceptions
----------

Exceptions thrown during rendering will be rendered as usual except that
some content might have been rendered already.

Limitations
-----------

As the getContent() method always returns false for streamed Responses, some
event listeners won't work at all:

* Web debug toolbar is not available for such Responses (but the profiler works fine);
* ESI is not supported.

Also note that streamed responses cannot benefit from HTTP caching for obvious
reasons.

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

by Seldaek at 2011/12/21 06:34:13 -0800

Just an idea: what about exposing flush() to twig? Possibly in a way that it will not call it if the template is not streaming. That way you could always add a flush() after your </head> tag to make sure that goes out as fast as possible, but it wouldn't mess with non-streamed responses. Although it appears flush() doesn't affect output buffers, so I guess it doesn't need anything special.

When you say "ESI is not supported.", that means only the AppCache right? I don't see why this would affect Varnish, but then again as far as I know Varnish will buffer if ESI is used so the benefit of streaming there is non-existent.

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

by cordoval at 2011/12/21 08:04:21 -0800

wonder what the use case is for streaming a response, very interesting.

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

by johnkary at 2011/12/21 08:19:48 -0800

@cordoval Common use cases are present fairly well by this RailsCast video: http://railscasts.com/episodes/266-http-streaming

Essentially it allows faster fetching of web assets (JS, CSS, etc) located in the &lt;head>&lt;/head>, allowing those assets to be fetched as soon as possible before the remainder of the content body is computed and sent to the browser. The end goal is to improve page load speed.

There are other uses cases too like making large body content available quickly to the service consuming it. Think if you were monitoring a live feed of JSON data of newest Twitter comments.

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

by lsmith77 at 2011/12/21 08:54:35 -0800

How does this relate the limitations mentioned in:
http://yehudakatz.com/2010/09/07/automatic-flushing-the-rails-3-1-plan/

Am I right to understand that due to how twig works we are not really streaming the content pieces when we call render(), but instead the entire template with its layout is rendered and only then will we flush? or does it mean that the render call will work its way to the top level layout template and form then on it can send the content until it hits another block, which it then first renders before it continues to send the data?

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

by stof at 2011/12/21 09:02:53 -0800

@lsmith77 this is why the ``stream`` method calls ``display`` in Twig instead of ``render``. ``display`` uses echo to print the output of the template line by line (and blocks are simply method calls in the middle). Look at your compiled templates to see it (the ``doDisplay`` method)
Rendering a template with Twig simply use an output buffer around the rendering.

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

by fabpot at 2011/12/21 09:24:33 -0800

@lsmith77: We don't have the Rails problem thanks to Twig as the order of execution is the right one by default (the layout is executed first); it means that we can have the flush feature without any change to how the core works. As @stof mentioned, we are using `display`, not `render`, so we are streaming your templates for byte one.

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

by fabpot at 2011/12/21 09:36:41 -0800

@Seldaek: yes, I meant ESI with the PHP reverse proxy.

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

by fabpot at 2011/12/21 09:37:34 -0800

@Seldaek: I have `flush()` support for Twig on my todo-list. As you mentioned, It should be trivial to implement.

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

by fzaninotto at 2011/12/21 09:48:18 -0800

How do streaming responses deal with assets that must be called in the head, but are declared in the body?

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

by fabpot at 2011/12/21 09:52:12 -0800

@fzaninotto: What do you mean?

With Twig, your layout is defined with blocks ("holes"). These blocks are overridden by child templates, but evaluated as they are encountered in the layout. So, everything works as expected.

As noted in the commit message, this does not work with PHP templates for the problems mentioned in the Rails post (as the order of execution is not the right one -- the child template is first evaluated and then the layout).

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

by fzaninotto at 2011/12/21 10:07:35 -0800

I was referring to using Assetic. Not sure if this compiles to Twig the same way as javascript and stylesheet blocks placed in the head - and therefore executed in the right way.

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

by fabpot at 2011/12/21 10:34:59 -0800

@Seldaek: I've just added a `flush` tag in Twig 1.5: 1d6dfad4f5

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

by catchamonkey at 2011/12/21 13:29:22 -0800

I'm really happy you've got this into the core, it's a great feature to have! Good work.
2011-12-31 08:12:02 +01:00
Fabien Potencier
cc9eff0bc6 merged 2.0 2011-12-26 21:57:48 +01:00
Ryan Weaver
a9b54dfa4b [HttpFoundation] Adding some additional PHPDoc to ParameterBag 2011-12-26 12:25:02 -06:00
Fabien Potencier
d635be4e20 fixed merge 2011-12-23 09:21:58 +01:00
Fabien Potencier
5b2bc7d7f9 merged 2.0 2011-12-23 08:57:06 +01:00
Fabien Potencier
473741b9db added the possibility to change a StreamedResponse callback after its creation 2011-12-22 07:58:59 +01:00
Kris Wallsmith
1b4aaa2c8e [HttpFoundation] fixed ApacheRequest
Pathinfo was incorrect when using mod_rewrite.
Added better test coverage.
2011-12-21 13:57:56 -08:00
Fabien Potencier
8717d4425e moved a test in the constructor 2011-12-21 18:53:18 +01:00
Fabien Potencier
e44b8ba521 made some cosmetic changes 2011-12-21 18:34:44 +01:00
Marek Kalnik
8235848b5b [HttpFoundation][File] Add flv file default extension 2011-12-21 16:18:42 +01:00
Fabien Potencier
0038d1bac4 [HttpFoundation] added support for streamed responses
To stream a Response, use the StreamedResponse class instead of the
standard Response class:

    $response = new StreamedResponse(function () {
        echo 'FOO';
    });

    $response = new StreamedResponse(function () {
        echo 'FOO';
    }, 200, array('Content-Type' => 'text/plain'));

As you can see, a StreamedResponse instance takes a PHP callback instead of
a string for the Response content. It's up to the developer to stream the
response content from the callback with standard PHP functions like echo.
You can also use flush() if needed.

From a controller, do something like this:

    $twig = $this->get('templating');

    return new StreamedResponse(function () use ($templating) {
        $templating->stream('BlogBundle:Annot:streamed.html.twig');
    }, 200, array('Content-Type' => 'text/html'));

If you are using the base controller, you can use the stream() method instead:

    return $this->stream('BlogBundle:Annot:streamed.html.twig');

You can stream an existing file by using the PHP built-in readfile() function:

    new StreamedResponse(function () use ($file) {
        readfile($file);
    }, 200, array('Content-Type' => 'image/png');

Read http://php.net/flush for more information about output buffering in PHP.

Note that you should do your best to move all expensive operations to
be "activated/evaluated/called" during template evaluation.

Templates
---------

If you are using Twig as a template engine, everything should work as
usual, even if are using template inheritance!

However, note that streaming is not supported for PHP templates. Support
is impossible by design (as the layout is rendered after the main content).

Exceptions
----------

Exceptions thrown during rendering will be rendered as usual except that
some content might have been rendered already.

Limitations
-----------

As the getContent() method always returns false for streamed Responses, some
event listeners won't work at all:

* Web debug toolbar is not available for such Responses (but the profiler works fine);
* ESI is not supported.

Also note that streamed responses cannot benefit from HTTP caching for obvious
reasons.
2011-12-21 14:34:26 +01:00
Fabien Potencier
5d6a7d35b0 merged 2.0 2011-12-18 14:48:17 +01:00
Fabien Potencier
4316595dbb fixed CS 2011-12-18 14:42:59 +01:00
Fabien Potencier
6504d05804 fixed CS 2011-12-18 14:36:25 +01:00
Fabien Potencier
997f354d53 tweaked the README files 2011-12-18 14:22:28 +01:00
Fabien Potencier
0f2caf1106 merged branch lsmith77/component_readmes (PR #2561)
Commits
-------

1e370d7 typo fix
93d8d44 added some more infos about Config
27efd59 added READMEs for the bridges
34fc866 cosmetic tweaks
d6af3f1 fixed README for Console
6a72b8c added basic README files for all components

Discussion
----------

added basic README files for all components and bridges

heavily based on http://fabien.potencier.org/article/49/what-is-symfony2 and the official Symfony2 documentation

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

by jmikola at 2011/11/03 13:36:07 -0700

Great work. For syntax highlighting on the PHP snippets, you could add "php" after the three backticks.

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

by lsmith77 at 2011/11/03 13:41:29 -0700

done

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

by stealth35 at 2011/11/03 13:49:31 -0700

Nice job, but you also need to add `<?php`

ex :

``` php
<?php
use Symfony\Component\DomCrawler\Crawler;

$crawler = new Crawler();
$crawler->addContent('<html><body><p>Hello World!</p></body></html>');

print $crawler->filter('body > p')->text();
```

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

by lsmith77 at 2011/11/03 13:56:57 -0700

done

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

by ericclemmons at 2011/11/03 19:57:57 -0700

@lsmith77 Well done!  This makes consumption of individual components that much easier, *especially* now that `composer.json` files have been added.

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

by lsmith77 at 2011/11/04 01:18:23 -0700

ok .. fixed the issues you mentioned @fabpot

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

by lsmith77 at 2011/11/11 15:00:27 -0800

@fabpot anything else left? seems like an easy merge .. and imho there is considerable benefit for our efforts to spread the word about the components with this PR merged.

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

by drak at 2011/11/11 18:54:13 -0800

You know, it might be a nice idea to put a link to the documentation for each component if there is some at symfony.com

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

by lsmith77 at 2011/11/12 00:59:14 -0800

i did that in some. but i might have missed a few places.
On 12.11.2011, at 03:54, Drak <reply@reply.github.com> wrote:

> You know, it might be a nice idea to put a link to the documentation for each component if there is some at symfony.com
>
> ---
> Reply to this email directly or view it on GitHub:
> https://github.com/symfony/symfony/pull/2561#issuecomment-2715762

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

by breerly at 2011/11/21 10:28:36 -0800

Pretty excited with this.

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

by dbu at 2011/11/24 00:02:50 -0800

is there anything we can help with to make this ready to be merged?

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

by lsmith77 at 2011/12/18 02:39:23 -0800

@fabpot: seriously .. if you are not going to deliver something "better" and don't provide a reason what is wrong with this .. then its beyond frustrating. i obviously do not claim that these README's are perfect (and certainly still no replacement for proper documentation), but I do claim that in their current form they are a radical step forward to potential users of the Symfony2 components.
2011-12-18 12:42:02 +01:00
Fabien Potencier
a6cdddd716 merged 2.0 2011-12-14 19:13:35 +01:00
Fabien Potencier
12ea7568a0 merged branch pulzarraider/explode_optimalisation (PR #2782)
Commits
-------

cd24fb8 change explode's limit parameter based on known variable content
b3cc270 minor optimalisations for explode

Discussion
----------

[FrameworkBundle][CssSelector][HttpFoundation][HttpKernel] [Security][Validator] Minor optimizations for "explode" function

Bug fix: no
Feature addition: no
Backwards compatibility break: no
Symfony2 tests pass: yes
Fixes the following tickets: -
Todo: -

I added limit parameter in some places, where it may be usefull. I did not check the context of what values may have been exploded. So to not break anything, I added +1 to limit parameter.

If you find out that in some places limit (or limit+1) is not important or meaningless, write a comment please and I will fix it.

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

by fabpot at 2011/12/07 06:56:49 -0800

Adding +1 just to be sure to not break anything is clearly something we won't do. What is the benefit of doing that anyway?

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

by pulzarraider at 2011/12/07 13:50:24 -0800

The main idea of making this PR was to notify about some places that may run faster with just adding one parameter to explode function.

If in code is someting like: ```list($a, $b) = explode(':', $s);```
Function ```explode``` will create n-items (depends on ```$s```), but we need in code only the first two items. There is no reason to let ```explode``` create more items in memory that are NEVER used in our code. The limit parameter is there for these situations, so let's use it.

I know that it is microoptimization and may look unimportant, but we are writing a framework - so people expect that code will be as fast as possible without this kind of mistakes.

As I've noticed above, I know that +1 is not ideal solution, but the fastest without debugging the code. I expect that someone (with good knowledge of that code) will look at it and write in comments if variable may contain 1 comma (dot or someting on what is doing the explode) or maybe 2 in some situations or more.

Anyway, +1 will not break anything, because same items are created as it is now, but no unnecessary item is created.

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

by fabpot at 2011/12/07 23:14:59 -0800

I'm +1 for adding the number to avoid problems but I'm -1 on the optimization side of things as it won't optimize anything.

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

by helmer at 2011/12/08 12:46:49 -0800

*.. The main idea of making this PR was to notify about some places that **may** run faster ..*

I am also unsure the optimization is really an optimization, care to benchmark (with meaningful inputs)? As for the limit+1 thing, why would you want to +1 it? The number of ``list`` arguments should always reflect the ``limit`` parameter, no?

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

by pulzarraider at 2011/12/08 23:11:34 -0800

@helmer please try this simple benchmark:

```
<?php

header('Content-Type: text/plain; charset=UTF-8');
define('COUNT', 10000);

$source_string = 'aaaaaaaaaaaaaaaaaaaa:bbbbbbbbbbbbbbbbbbbbb:cccccccccccccccccccccccc:dddddddddddddddddddddd:eeeeeeeeeeeeeeeeeeeeeeeee:fffffffffffffffffffffffffff';

$start = microtime(true);
for ($i = 0; $i < COUNT; $i++) {
    list($a, $b) = explode(':', $source_string);
}
$end = microtime(true)-$start;
echo 'without limit: '.$end."\n";

$start = microtime(true);
for ($i = 0; $i < COUNT; $i++) {
    list($a, $b) = explode(':', $source_string, 2);
}
$end = microtime(true)-$start;
echo 'with limit:    '.$end."\n";
```

My results are:

```
without limit: 0.057228803634644
with limit:    0.028676986694336
```
That is 50% difference (with APC enabled).  Of course the result depends on the length of source string and if it's too short, the difference may be none or very very small. That's why I said, that it **may** run faster and is just a micro optimization.

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

by pulzarraider at 2011/12/08 23:18:12 -0800

@helmer And why +1? It depends on a code:

```
$source_string = 'aaaaaaaaaaaaaaaaaaaa:bbbbbbbbbbbbbbbbbbbbb:cccccccccccccccccccccccc';
list($a, $b) = explode(':', $source_string, 2);
var_dump($a, $b);
```

and

```
$source_string = 'aaaaaaaaaaaaaaaaaaaa:bbbbbbbbbbbbbbbbbbbbb:cccccccccccccccccccccccc';
list($a, $b) = explode(':', $source_string, 3);
var_dump($a, $b);
```
gives different results. That's why the content of the variable must be known.

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

by helmer at 2011/12/09 00:08:28 -0800

@pulzarraider Thanks for the benchmark, seems like a gain enough. Although, we are more likely having a scenario of:
``explode(':', 'a🅱️c')`` vs ``explode(':', 'a🅱️c', 3)`` with a ``COUNT`` of 10, where the difference is not even in microseconds anymore :)

The limit addition alters the behaviour though, ie suddenly you can define a controller [logical name](http://symfony.com/doc/current/book/routing.html#controller-string-syntax) as ´´AcmeBlogBundle:Blog:show:something``, and things go downhill from there on.

All that aside, I'm +1 for setting the limit to the exact number of ``list`` parameters, but certainly not number+1, this is just too wtfy (as you said, this was a safety thing, but I reckon for this PR to be merged it needs to be +0).

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

by drak at 2011/12/09 08:28:58 -0800

Overall `list()` is ugly as it's not very explicit.  Even though it would mean extra lines, it's better to `explode()` then explicitly assign variables:

```
$parts = explode(':', $foo);
$name = $parts[0];
$tel = $parts[1];
```

`list()` is one of those bad relics from the PHP past...

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

by fabpot at 2011/12/11 10:07:47 -0800

@drak: why is `list` not explicit? It is in fact as explicit as the more verbose syntax you propose.

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

by pulzarraider at 2011/12/11 13:08:50 -0800

@drak: I agree with @fabpot. In speech of benchmarks ```list``` is faster then using a helper variable.

@fabpot, @helmer I've changed explode's limit to be correct (without +1) and removed some changes from this PR, where I can't find out what the content of variable may be. Unit tests pass, so I think it's ready for merge.
2011-12-13 17:39:32 +01:00
Fabien Potencier
142cef21bb merged 2.0 2011-12-13 16:12:53 +01:00
Fabien Potencier
e3421a0b1d [DoctrineBridge] fixed some CS 2011-12-13 10:22:12 +01:00
Andrej Hudec
cd24fb86a8 change explode's limit parameter based on known variable content 2011-12-11 21:58:35 +01:00
Andrej Hudec
b3cc270450 minor optimalisations for explode 2011-12-11 21:58:30 +01:00
Bart van den Burg
45bba7b7be Added a hint about a possible cause for why no mime type guesser is be available 2011-12-11 19:59:22 +01:00
Fabien Potencier
4730f4303b merged 2.0 2011-12-08 15:36:57 +01:00
Jordi Boggiano
e06cea9aaa [HttpFoundation] Cookie values should not be restricted 2011-11-23 11:38:46 +01:00
Fabien Potencier
be09e068c0 fixed bad merge 2011-11-23 11:32:47 +01:00
Fabien Potencier
a1d12324f9 merged 2.0 2011-11-23 11:23:27 +01:00
Fabien Potencier
286ce0ea40 merged branch pulzarraider/proxy_ip_fix (PR #2695)
Commits
-------

11b6156 updated unittest
a931e21 get correct client IP from X-forwarded-for header

Discussion
----------

[HttpFoundation] Get correct client IP when using trusted proxy (Varnish)

Bug fix: yes
Feature addition: no
Backwards compatibility break: no
Symfony2 tests pass: yes
Fixes the following tickets: -
Todo: -
Note: This is reopened PR #2686 for 2.0 branch.

If using trusted proxy (Varnish, ...) the client IP must be identified from X-Forwarded-For header. The header has de-facto standard format:

X-Forwarded-For : client1, proxy1, proxy2,

where the value is a comma+space separated list of IP addresses, the left-most being the farthest downstream client, and each successive proxy that passed the request adding the IP address where it received the request from. See: http://en.wikipedia.org/wiki/X-Forwarded-For

Function getClientIp should return only one client IP, not a list of all nonimportant IPs as it's now. Similar example can be seen in Cake framework: http://api.cakephp.org/view_source/request-handler-component/#line-477

There are many ways how to chose the first IP from X-Forwarded-For header. Any other faster and more reliable way is welcome.
2011-11-23 11:22:06 +01:00
Andrej Hudec
a931e21284 get correct client IP from X-forwarded-for header 2011-11-22 22:01:07 +01:00
Fabien Potencier
60f8525ae5 merged branch lsmith77/forward_compat (PR #2526)
Commits
-------

b6bf018 tweaked error handling for the forward compatibility
dd606b5 added note about the purpose of this class
c1426ba added locale handling forward compatibility
10eed30 added MessageDataCollector forward compatibility

Discussion
----------

Forward compat

Bug fix: no
Feature addition: yes
Backwards compatibility break: no
Symfony2 tests pass: yes
Fixes the following tickets: #2522
2011-11-22 19:39:27 +01:00
Joseph Rouff
c89d45ba2a Fix cs 2011-11-17 23:14:19 +01:00
Fabien Potencier
bd708247f0 merged 2.0 2011-11-17 07:00:22 +01:00
Fabien Potencier
d1ae6c7cb6 bumped Symfony version in composer.json files to 2.0.7 2011-11-17 06:58:47 +01:00
jdreesen
67d91f05d4 fixed typo in exception message 2011-11-14 20:16:31 +01:00
Fabien Potencier
1340ea67a6 Merge branch '2.0'
* 2.0:
  [HttpKernel] fixed Content-Length header when using ESI tags (closes #2623)
  [HttpFoundation] added an exception to MimeTypeGuesser::guess() when no guesser are available (closes #2636)
  [Security] fixed HttpUtils::checkRequestPath() to not catch all exceptions (closes #2637)
  [DoctrineBundle] added missing default parameters, needed to setup and use DBAL without ORM
  [Transation] Fix grammar.
  [TwigBundle] Fix trace to not show 'in at line' when file/line are empty.
2011-11-14 14:32:22 +01:00
Fabien Potencier
d67fbe9e48 [HttpFoundation] added an exception to MimeTypeGuesser::guess() when no guesser are available (closes #2636) 2011-11-14 13:21:49 +01:00
Fabien Potencier
2d53751e13 merged branch thomasbibb/master (PR #2559)
Commits
-------

269a5e6 Added the ablity to get a requests ContentType

Discussion
----------

Added getContentType

I've added the ability for Symfony\Component\HttpFoundation\Request to return the ContentType from serverBag this uses the $formats array to determine if the requested ContentType is valid.

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

by ericclemmons at 2011/11/03 20:00:51 -0700

Have you considered squashing a couple of your commits?  They seem doubled up.

Trivial, I know, but it will make each commit stand on its own (instead of appearing as a typo correction)

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

by thomasbibb at 2011/11/04 02:02:36 -0700

done.

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

by ericclemmons at 2011/11/04 07:25:20 -0700

You may need to do a `git push -f origin master`.  Check the commits tab to see the duplicate history:

> https://github.com/symfony/symfony/pull/2559/commits

Wheeeee, rebasing is fun!

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

by thomasbibb at 2011/11/04 12:26:06 -0700

There we got thats better :)

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

by ericclemmons at 2011/11/04 12:55:07 -0700

👍  Now let's see if it gets approved by @fabpot :)

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

by thomasbibb at 2011/11/06 03:39:12 -0800

I've removed the space between the method name and the parenthesis.

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

by thomasbibb at 2011/11/06 04:05:15 -0800

done.

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

by fabpot at 2011/11/06 23:44:22 -0800

Can you added some unit tests?
2011-11-09 22:08:42 +01:00
Fabien Potencier
046cdce578 merged branch drak/docblocks (PR #2546)
Commits
-------

09e1e60 Grammar changes.
b4d0f4b Grammar changes
a0e62f0 Fix typos.
e6627fb Docblocks.

Discussion
----------

[HttpFoundation] Docblocks.

Bug fix: no
Feature addition: no
Backwards compatibility break: no
Symfony2 tests pass: n/a
Fixes the following tickets: -

Added missing docblocks and type hints.  Improves use with IDE and auto-generated API docs.
2011-11-07 16:25:21 +01:00
Thomas Bibb
269a5e67c6 Added the ablity to get a requests ContentType 2011-11-06 14:22:57 +00:00
Drak
09e1e60d31 Grammar changes. 2011-11-04 15:04:48 +05:45
Drak
b4d0f4b4cb Grammar changes 2011-11-04 08:08:11 +05:45
Lukas Kahwe Smith
6a72b8c6b9 added basic README files for all components
heavily inspired by http://fabien.potencier.org/article/49/what-is-symfony2 and the official Symfony2 documentation
2011-11-03 21:11:40 +01:00
Drak
a0e62f0775 Fix typos. 2011-11-03 11:22:03 +05:45
Drak
e6627fb0ff Docblocks. 2011-11-02 21:27:51 +05:45
Fabien Potencier
f8f622b39c bumped Symfony version to 2.0.6-DEV 2011-11-02 14:18:45 +01:00
Fabien Potencier
7f21a5e979 bumped Symfony version in composer.json files to 2.0.5 2011-11-02 12:42:41 +01:00
Fabien Potencier
fd380e37a9 merged 2.0 2011-11-01 20:19:25 +01:00
David Soria Parra
c5e2defe5f Fix ternary operator usage in RequestMatcher::checkIpv6() 2011-11-01 18:50:28 +01:00
Fabien Potencier
8a62e3249f merged 2.0 2011-11-01 12:32:44 +01:00
Fabien Potencier
d7a5351aaa updated composer.json files to contain information about autoloading and target dirs 2011-11-01 12:30:24 +01:00
Lukas Kahwe Smith
b6bf0182e9 tweaked error handling for the forward compatibility 2011-11-01 09:40:05 +01:00
Lukas Kahwe Smith
c1426baee1 added locale handling forward compatibility 2011-10-31 16:15:30 +01:00
Fabien Potencier
d34d50f0b0 fixed CS 2011-10-29 12:05:45 +02:00
Fabien Potencier
ac5b8a4c37 merged 2.0 2011-10-26 14:29:19 +02:00
Fabien Potencier
3043fa0878 [HttpFoundation] fixed PHP 5.4 regression 2011-10-26 14:13:44 +02:00
Fabien Potencier
bc330d4487 merged branch lsmith77/fix_q_handling (PR #2365)
Commits
-------

d3f137b cosmetic tweak
2877883 anything in front of ;q= is part of the mime type, anything after may be ignored

Discussion
----------

[HttpFoundation] fix splitHttpAcceptHeader() parsing of parameters

Bug fix: yes
Feature addition: no
Backwards compatibility break: no
Symfony2 tests pass: yes
Fixes the following tickets: -

anything in front of ;q= is part of the mime type, anything after may be ignored

see http://www.w3.org/Protocols/rfc2616/rfc2616-sec14.html#sec14.1

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

by lsmith77 at 2011/10/09 04:00:12 -0700

i must admit .. i am not 100% that my implemention is correct either .. but i am sure the current one isn't.

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

by lsmith77 at 2011/10/09 07:57:33 -0700

@fabpot: I am also not sure if getFormat() should optionally not support matching parameters, aka anything before ``;q=..``
2011-10-25 17:26:31 +02:00
Fabien Potencier
94e7e54777 merged branch mvrhov/pdo_sessstorage_fix (PR #2382)
Commits
-------

edfa29b session data needs to be encoded because it can contain non binary safe characters e.g null. Fixes #2067

Discussion
----------

session data needs to be encoded because it can contain non binary safe characters e.g null.

Bug fix: yes
Feature addition: no
Backwards compatibility break: yes
Symfony2 tests pass: yes
Fixes the following tickets: #2067

I'm marking this as a compatibility break because session table should be cleared and even if not cleared all currently logged in users will be logged out.

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

by mvrhov at 2011/10/11 12:52:25 -0700

P.S. I know there was a talk about doctrine based session storage but I cannot find this in core. It probably has the same problem.

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

by eventhorizonpl at 2011/10/11 14:34:08 -0700

Thanks for tracking down and fixing this issue!

Best regards,
Michal

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

by stof at 2011/10/11 16:24:18 -0700

@mvrhov The Doctrine based storage is only available in master, not in 2.0
2011-10-25 17:18:16 +02:00
Fabien Potencier
6c2f093b33 [HttpFoundation] removed superfluous query call (closes #2469) 2011-10-25 15:45:14 +02:00
Fabien Potencier
347053c363 Moved most of the logic from ResponseListener to the Response::prepare() method
That allows projects that only use HttpFoundation and not HttpKernel to be able to
enforce the HTTP specification "rules".

$request = Request::createFromGlobals();
$response = new Response();

// do whatever you want with the Respons

// enforce HTTP spec
$response->prepare($request);

$response->send();

Within Symfony2, the prepare method is automatically called by the ResponseListener.
2011-10-18 09:04:20 +02:00
Miha Vrhovnik
edfa29b01b session data needs to be encoded because it can contain non binary safe
characters e.g null. Fixes #2067
2011-10-11 21:42:38 +02:00
Lukas Kahwe Smith
d3f137b9c1 cosmetic tweak 2011-10-09 16:09:22 +02:00
Lukas Kahwe Smith
28778834c7 anything in front of ;q= is part of the mime type, anything after may be ignored
see http://www.w3.org/Protocols/rfc2616/rfc2616-sec14.html#sec14.1
2011-10-09 12:58:45 +02:00
Fabien Potencier
a8faa83708 merged 2.0 2011-10-08 22:58:00 +02:00
Fabien Potencier
74bc699b27 moved management of the locale from the Session class to the Request class
The locale management does not require sessions anymore.

In the Symfony2 spirit, the locale should be part of your URLs. If this is the case
(via the special _locale request attribute), Symfony will store it in the request
(getLocale()).

This feature is now also configurable/replaceable at will as everything is now managed
by the new LocaleListener event listener.

How to upgrade:

The default locale configuration has been moved from session to the main configuration:

Before:

framework:
    session:
        default_locale: en

After:

framework:
    default_locale: en

Whenever you want to get the current locale, call getLocale() on the request (was on the
session before).
2011-10-08 18:34:49 +02:00
Helmer Aaviksoo
c4226bb6dc Removed redundant "@return void"-s 2011-10-07 11:15:35 +03:00
Fabien Potencier
a74ae9d325 [HttpFoundation] made X_REWRITE_URL only available on Windows platforms 2011-10-07 08:20:12 +02:00
Fabien Potencier
245ff6d7a8 updated composer.json for 2.1 2011-09-29 17:40:43 +02:00
Fabien Potencier
f5ab6ec934 Merge branch '2.0'
* 2.0:
  [composer] add missing deps for FrameworkBundle
  [composer] change ext/intl to the new ext-intl syntax
  [composer] fix monolog-bridge composer.json, add more inter-component deps
  [composer] add composer.json
2011-09-29 17:29:32 +02:00
Fabien Potencier
5c760b0d40 merged branch igorw/composer (PR #2275)
Commits
-------

731b28b [composer] add missing deps for FrameworkBundle
9c8f100 [composer] change ext/intl to the new ext-intl syntax
d535afe [composer] fix monolog-bridge composer.json, add more inter-component deps
9ade639 [composer] add composer.json

Discussion
----------

Composer

This PR adds a composer.json file for [composer](https://github.com/composer/composer) ([more info](packagist.org/about-composer)).

For discussion you can also go into #composer-dev on freenode and argue with naderman, seldaek and everzet.

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

by naderman at 2011/09/26 15:51:51 -0700

You haven't entered any keywords, they might come in handy when searching for packages on packagist.

But really this is just a +1 ;-)

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

by stof at 2011/09/26 16:12:21 -0700

See my comments on your previous (non-rebased) commit: f1c0242b5a

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

by igorw at 2011/09/27 00:04:36 -0700

Following dependencies do not have a composer.json yet: Twig, Doctrine (orm, dbal, common), swiftmailer.

Also missing from the standard edition: assetic, twig-extensions, jsm-metadata, SensioFrameworkExtraBundle, JMSSecurityExtraBundle, SensioDistributionBundle, SensioGeneratorBundle, AsseticBundle.

The point is, those can be added later on. Having the components composerized is already a leap forward. Also, doctrine depends on some symfony components, we've got to start somewhere.

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

by Seldaek at 2011/09/27 00:36:41 -0700

Also, just for information, the plan is to have `symfony/framework-bundle` be the "framework", with all dependencies to doctrine etc, though we should really only have strict requirements in there, and then in symfony-standard we ship a composer.json that requires the framework-bundle, doctrine-orm and things like that that are not essential to core. Otherwise people don't have a choice about what they use anymore.

Just a comment btw, the json is invalid, all / should be escaped. However json_decode is nice enough to parse those without complaining, browsers do too, even Crockford's json2.js does, so I'm not sure if we should privilege readability over strictness, since it seems nobody really cares about this escaping.

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

by igorw at 2011/09/27 00:41:39 -0700

So, I've implemented all of @stof's suggestions, except (for reasons stated above):

* doctrine to DoctrineBundle
* swiftmailer to SwiftmailerBundle
* twig to TwigBundle
* doctrine-common to Validator
* FrameworkBundle (what exactly does it depend on?)

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

by stof at 2011/09/27 00:52:31 -0700

@igorw at least HttpKernel, Routing, Templating, EventDispatcher, Doctrine Common (annotations cannot be disabled), Translator, Form (optional), Validator (optional), Console (optional). See the service definitions to see the others

@Seldaek FrameworkBundle does not depend on Doctrine, except for Common

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

by beberlei at 2011/09/27 03:15:34 -0700

What does the symfony/ or ext/ prefix control in composer?

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

by Seldaek at 2011/09/27 03:33:52 -0700

symfony/ is just the (mandatory) vendor namespace. Also ext/ has been renamed to ext- now, so it's not in any vendor, and should avoid potential issues.

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

by beberlei at 2011/09/27 05:07:03 -0700

@Seldaek Mandatory? So every package name is "vendor/package"? I like that because previously i thought package names are not namespaced, and thus clashes could occur between different communities easily.

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

by Seldaek at 2011/09/27 05:16:20 -0700

@beberlei: Mandatory. As of yesterday http://packagist.org/ will tell you you have an invalid package name if there's no slash in it. See 1306d1ca82 (diff-3)
2011-09-29 17:27:38 +02:00
Fabien Potencier
885bb33791 merged 2.0 2011-09-28 16:08:31 +02:00
Fabien Potencier
6eeca8e36d merged branch stealth35/fix_2142 (PR #2290)
Commits
-------

b12ce94 [HttpFoundation] fix #2142 PathInfo parsing/checking

Discussion
----------

[HttpFoundation] fix #2142 PathInfo parsing/checking

Bug fix: yes
Feature addition: no
Backwards compatibility break: no
Symfony2 tests pass: yes
Fixes the following tickets: #2142
2011-09-28 15:02:56 +02:00
stealth35
b12ce94c38 [HttpFoundation] fix #2142 PathInfo parsing/checking
Bug fix: yes
Feature addition: no
Backwards compatibility break: no
Symfony2 tests pass: yes
Fixes the following tickets: #2142
2011-09-28 13:18:44 +02:00
Fabien Potencier
b4028350d2 [HttpFoundation] standardized cookie paths (an empty path is equivalent to /) 2011-09-28 10:49:50 +02:00
Fabien Potencier
1e7e6ba305 [HttpFoundation] removed the possibility for a cookie path to set it to null (as this is equivalent to /) 2011-09-28 10:34:14 +02:00
Fabien Potencier
ffdd6670a6 merged branch Seldaek/clearcookie (PR #1889)
Commits
-------

908a7a3 [HttpFoundation] Fix bug in clearCookie/removeCookie not clearing cookies set with a default '/' path, unless it was explicitly specified

Discussion
----------

[HttpFoundation] Fix bug in clearCookie/removeCookie not clearing cookies

[HttpFoundation] Fix bug in clearCookie/removeCookie not clearing cookies set with a default '/' path, unless it was explicitly specified

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

by Seldaek at 2011/08/02 10:31:44 -0700

The reason is that Cookie::__construct defaults to '/' btw, so if you don't specify it, and then call clearCookie without specifying again, the paths don't match.

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

by Koc at 2011/08/07 00:06:13 -0700

I think that correctrly use base path. Is it possible?

For example we have 2 apps
* site.com/app1/index.php
* site.com/app2/index.php
and app2 will remove cookies of app1

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

by Seldaek at 2011/08/07 02:58:10 -0700

IMO if people want that they should specify the path manually, by default cookies are always set for the entire host and I think it should stay like that.

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

by Koc at 2011/08/07 04:26:47 -0700

It is hard to specify path manually everywhere when set/remove cookies.

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

by Seldaek at 2011/09/27 07:01:43 -0700

@fabpot: ping? You said this was ok, but it was never merged.
2011-09-28 10:32:01 +02:00
Drak
c4a0f799af Updates according to suggestions.
- Simplified logic of tests.
- Added more comments/docblocks.
- Added more convenience.
2011-09-27 20:14:32 +05:45
Drak
6aec7898e3 Added tests. 2011-09-27 15:20:51 +05:45
Drak
d375b6d00e Corrected docblock, quoted types were incorrect. 2011-09-27 13:34:25 +05:45
Igor Wiedler
9ade639bb4 [composer] add composer.json 2011-09-27 00:55:43 +02:00
Drak
54454ba4aa Added generic filtering to ParameterBag.
Adds filtering convenience using PHP's filter_var() e.g.
`$request->get->filter($key, '', false, FITLER_SANITIZE_STRING);`
See http://php.net/manual/en/filter.filters.php for capabilities.
2011-09-26 04:11:55 +05:45
Jordi Boggiano
88ebe0cfc4 Adjust the way of checking for windows 2011-09-17 12:57:47 +02:00
Fabien Potencier
3a4d1a6a22 merged 2.0 branch 2011-09-15 07:39:20 +02:00
Fabien Potencier
27ba003e5e [HttpFoundation] changed the strategy introduced in a5ccda47b4 to fix functional tests and still allow to call save more than once for a Session 2011-09-14 20:54:45 +02:00
Magnus Nordlander
ff99d80a8e Changed the behavior of Session::regenerate to destroy the session when it invalidates it. 2011-09-14 19:52:25 +02:00
Fabien Potencier
c5e0c80a76 [HttpFoundation] made FileBinaryMimeTypeGuesser command configurable 2011-09-14 09:45:15 +02:00
stealth35
aecfd0a891 [HttpFoundation] Support user and password in url 2011-09-12 13:01:04 +02:00
Fabien Potencier
17f115104d merged branch chx/2.0 (PR #2141)
Commits
-------

24b80ae Removed a leftover use.

Discussion
----------

Removed a leftover use.

lsmith told me to put in this request instead.
2011-09-09 14:50:48 +02:00
Karoly Negyesi
24b80aedf3 Removed a leftover use. 2011-09-09 02:13:17 -07:00
Jordan Alliot
ae5230344c [HttpFoundation] Fixed duplicate of request
closes #2133
2011-09-08 12:28:21 +01:00
Jordan Alliot
0bc2a6d67b [HttpFoundation] Added check for disposition value 2011-09-08 10:20:37 +01:00
Fabien Potencier
9685b0015c merged branch brki/mimetype-extension-guesser-refactor (PR #1386)
Commits
-------

34494b3 whitespace fixes
1a86a4a Refactor mime-type to file extension guessing
e7481a3 Decouple mime-type to extension logic from File class

Discussion
----------

[2.1] Decouple mimetype-to-extension logic from File class

This allows guessing the extension from a given mime type
without requiring the existence of a local file.

If a file's meta information (mime-type, etc.) is already available (i.e. it's
been extracted once and stored in some persistent data store), it would be
nice to be able to make a best-guess on the extension based on the known mime-type.

A concrete use case of this is for the symfony-cmf, where a file has been stored
in the jackrabbit data store.  When delivering this file or saving it to disk, we'd like to
use an extension that's created based on the known mime type of the file.

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

by brki at 2011/06/21 04:35:13 -0700

Now implemented similarly to the existing MimeTypeGuesser.

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

by brki at 2011/06/21 07:51:22 -0700

whitespace removed

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

by stof at 2011/09/04 05:04:54 -0700

@fabpot @brki what is the status of this PR ?
2011-09-06 08:57:16 +02:00
Teo
bbb68b7df9 Added RSS HTTP request format 2011-09-05 17:10:26 +03:00
Fabien Potencier
dccd2d560f [HttpFoundation] implemented RFC6266 (Content-Disposition header)
references:

 * http://trac.tools.ietf.org/wg/httpbis/trac/wiki/ContentDispositionProducerAdvice
 * https://github.com/mnot/sweet/blob/master/lib/index.js
 * http://www.mnot.net/blog/2011/09/02/rfc6266_and_content-disposition
2011-09-04 09:35:13 +02:00
Fabien Potencier
e7b2d2d659 merged 2.0 branch 2011-09-04 09:28:37 +02:00
Fabien Potencier
0eae562cb2 converted file_exists calls to either is_file or is_dir where it makes sense 2011-08-29 15:28:26 +02:00
Fabien Potencier
07bdb8ac84 merged branch stloyd/patch-3 (PR #2011)
Commits
-------

020fa51 [RedirectResponse] Added missing `doctype` and `title` tag

Discussion
----------

[RedirectResponse] Added missing `doctype` and `title` tag
2011-08-26 18:08:50 +02:00
Fabien Potencier
2ccee10c51 merged branch stealth35/mime_guesser (PR #1874)
Commits
-------

ea0db2d [HttpFoundation] Remove useless ContentTypeMimeTypeGuesser

Discussion
----------

[2.1] [HttpFoundation] Remove useless ContentTypeMimeTypeGuesser

`mime_content_type` exists just for the compat between the old PHP 5.2
`mime_magic` extension and `file_info` extension

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

by fabpot at 2011/08/19 05:31:25 -0700

I will merge it in 2.1 as some people might rely on it.

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

by stealth35 at 2011/08/19 05:46:02 -0700

ok in the meantime, we can invert the guesser checker :

```php
/**
 * Registers all natively provided mime type guessers
 */
private function __construct()
{
    if (FileBinaryMimeTypeGuesser::isSupported()) {
        $this->register(new FileBinaryMimeTypeGuesser());
    }

    if (FileinfoMimeTypeGuesser::isSupported()) {
        $this->register(new FileinfoMimeTypeGuesser());
    }

    if (ContentTypeMimeTypeGuesser::isSupported()) {
        $this->register(new ContentTypeMimeTypeGuesser());
    }
}
```

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

by stloyd at 2011/08/19 05:48:38 -0700

@stealth35 You should make new PR for change you mentioned above.

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

by stealth35 at 2011/08/19 05:53:12 -0700

@stloyd done PR #1989

EDIT : forget this
2011-08-26 17:49:56 +02:00
Fabien Potencier
a8609e1eab merged branch lsmith77/add_patch_support (PR #1916)
Commits
-------

007e395 do not set a default CONTENT_TYPE for PATCH
fa2c027 Added support for the PATCH method

Discussion
----------

[2.1] [HttpFoundation] Added support for the PATCH method

http://tools.ietf.org/html/rfc2068#section-19.6.1.1
http://tools.ietf.org/html/rfc5789

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

by Seldaek at 2011/08/07 03:23:20 -0700

According to the spec it seems that PATCH requests shouldn't be of application/x-www-form-urlencoded content-type so it shouldn't match the first if, and in the second it's probably wrong to default to application/x-www-form-urlencoded, no?

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

by lsmith77 at 2011/08/07 03:31:48 -0700

Hmm you are right. I assumed the diff would be encoded as ``application/x-www-form-urlencoded`` but there indeed is no indication of that in the spec. But given that the second case would still need some sort of handling for PATCH, just not sure what exactly ``$defaults['CONTENT_TYPE']`` should be set to.

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

by Seldaek at 2011/08/07 03:48:53 -0700

As I understand it, a PATCH request must specify a content-type or it's invalid, so we could just skip the second behavior if no content-type is present.

As your first link says:

    The list of differences is in a format defined by the media type of the entity (e.g.,
    "application/diff") and MUST include sufficient information to allow
    the server to recreate the changes necessary to convert the original
    version of the resource to the desired version.

Sounds like PATCH is highly application specific, and not so standardized, probably because it's not very useful for most purposes.

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

by lsmith77 at 2011/08/07 04:02:43 -0700

Yes, but to me this means that the patch is actually correct aside from the fact that its setting a default Content-Type, which I just corrected (not sure if this use of switch is ok with our coding style). Now if the Content-Type does end up being ``application/x-www-form-urlencoded`` then I would say its correct to decode it.
2011-08-26 17:44:39 +02:00
Fabien Potencier
8f50592f31 [HttpFoundation] changed \LogicException to \InvalidArgumentException 2011-08-26 08:45:12 +02:00
Fabien Potencier
1c7694ff30 [HttpFoundation] added a missing exception 2011-08-25 10:38:08 +02:00
Joseph Bielawski
542cfd62df [ServerBag] Skip unnecessary loop in getHeaders() 2011-08-24 21:56:02 +03:00
Joseph Bielawski
020fa51c54 [RedirectResponse] Added missing doctype and title tag 2011-08-24 05:31:42 +03:00
Fabien Potencier
a5ccda47b4 merged branch martinmayer/session_saving (PR #1937)
Commits
-------

34a1b53 [HttpFoundation] Do not save session in Session::__destroy() when saved already

Discussion
----------

[HttpFoundation] Saving session data in __destroy() has a side effect on functional tests

Having functional test with several non-insulated requests, TestSessionListener invokes session saving at the end of every request. But instance of Session remains in memory until it's collected by garbage collector which saves the same data again in __destroy() method. The problem is that session object can get collected after other requests changed session data (e. g. user logged in) resulting in former data overwriting the latter.
2011-08-19 14:17:33 +02:00
Johannes Schmitt
b6ee1a67a7 fixes a bug when overriding method via the X-HTTP-METHOD-OVERRIDE header 2011-08-18 12:18:12 +02:00
lenar
805a2672d0 Remove Content-Length header adding for now. Fixes #1846. 2011-08-13 17:30:17 +03:00
Martin Mayer
34a1b53168 [HttpFoundation] Do not save session in Session::__destroy() when saved already 2011-08-10 16:34:36 +02:00
Lukas Kahwe Smith
007e3955b8 do not set a default CONTENT_TYPE for PATCH 2011-08-07 13:01:39 +02:00
Lukas Kahwe Smith
fa2c0273ec Added support for the PATCH method
http://tools.ietf.org/html/rfc2068#section-19.6.1.1
http://tools.ietf.org/html/rfc5789
2011-08-07 12:07:28 +02:00
Jordi Boggiano
908a7a35be [HttpFoundation] Fix bug in clearCookie/removeCookie not clearing cookies set with a default '/' path, unless it was explicitly specified 2011-08-02 19:30:11 +02:00
stealth35
ea0db2d6f4 [HttpFoundation] Remove useless ContentTypeMimeTypeGuesser
mime_content_type exists just for the compat between the old PHP 5.2
mime_magic extension and file_info extension
2011-07-31 14:07:00 +02:00
Alexander
cbbdcebff5 [HttpFoundation] Fixed incorrect ServerBag comment 2011-07-28 11:27:56 +02:00
Pascal Borreli
de5374ebac [Various] Typos 2011-07-28 10:28:20 +02:00
Fabien Potencier
8700cd6154 fixed CS 2011-07-27 08:27:46 +02:00
Fabien Potencier
853935fbab [HttpFoundation] made PHP_AUTH_PW optional 2011-07-26 09:32:45 +02:00
Fabien Potencier
aab0bf7e2c merged branch schmittjoh/httpUtilFixes (PR #1739)
Commits
-------

eae6a77 fixed wrong case
d0a175b fixes #1659
f300ede fixes several bugs
a4f05ac added some tests

Discussion
----------

Http util fixes

Fixes several bugs in the http utils.

Please don't add anymore features without sufficient tests. Especially for the Security\Http namespace, regressions are very likely otherwise.

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

by fabpot at 2011/07/19 22:37:26 -0700

Tests do not pass for me:

    There were 2 errors:

    1) Symfony\Bundle\SecurityBundle\Tests\Functional\LocalizedRoutesAsPathTest::testLoginLogoutProcedure with data set #0 ('en')
    InvalidArgumentException: The current node list is empty.

    .../src/Symfony/Component/DomCrawler/Crawler.php:604
    .../src/Symfony/Bundle/SecurityBundle/Tests/Functional/LocalizedRoutesAsPathTest.php:16

    2) Symfony\Bundle\SecurityBundle\Tests\Functional\LocalizedRoutesAsPathTest::testLoginLogoutProcedure with data set #1 ('de')
    InvalidArgumentException: The current node list is empty.

    .../src/Symfony/Component/DomCrawler/Crawler.php:604
    .../src/Symfony/Bundle/SecurityBundle/Tests/Functional/LocalizedRoutesAsPathTest.php:16

    --

    There were 4 failures:

    1) Symfony\Bundle\SecurityBundle\Tests\Functional\LocalizedRoutesAsPathTest::testAccessRestrictedResource with data set #0 ('en')
    Failed asserting that two strings are equal.
    --- Expected
    +++ Actual
    @@ @@
    -http://localhost/en/login
    +http://localhost/login

    .../src/Symfony/Bundle/Securitybundle/Tests/Functional/WebTestCase.php:22
    .../src/Symfony/Bundle/SecurityBundle/Tests/Functional/LocalizedRoutesAsPathTest.php:38

    2) Symfony\Bundle\SecurityBundle\Tests\Functional\LocalizedRoutesAsPathTest::testAccessRestrictedResource with data set #1 ('de')
    Failed asserting that two strings are equal.
    --- Expected
    +++ Actual
    @@ @@
    -http://localhost/de/login
    +http://localhost/login

    .../src/Symfony/Bundle/Securitybundle/Tests/Functional/WebTestCase.php:22
    .../src/Symfony/Bundle/SecurityBundle/Tests/Functional/LocalizedRoutesAsPathTest.php:38

    3) Symfony\Bundle\SecurityBundle\Tests\Functional\LocalizedRoutesAsPathTest::testAccessRestrictedResourceWithForward with data set #0 ('en')
    HTTP/1.0 302 Found
    Cache-Control:  no-cache
    Content-Length: 299
    Content-Type:   text/html; charset=UTF-8
    Date:           Wed, 20 Jul 2011 05:36:27 GMT
    Location:       http://localhost/login
    Set-Cookie: PHPSESSID=11c9c6a7e7620e13bddef223a5ba46d9; path=/; domain=

    <html>
        <head>
            <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
            <meta http-equiv="refresh" content="1;url=http://localhost/login" />
        </head>
        <body>
            Redirecting to <a href="http://localhost/login">http://localhost/login</a>.
        </body>
    </html>
    Failed asserting that <integer:0> matches expected <integer:1>.

    .../src/Symfony/Bundle/SecurityBundle/Tests/Functional/LocalizedRoutesAsPathTest.php:50

    4) Symfony\Bundle\SecurityBundle\Tests\Functional\LocalizedRoutesAsPathTest::testAccessRestrictedResourceWithForward with data set #1 ('de')
    HTTP/1.0 302 Found
    Cache-Control:  no-cache
    Content-Length: 299
    Content-Type:   text/html; charset=UTF-8
    Date:           Wed, 20 Jul 2011 05:36:28 GMT
    Location:       http://localhost/login
    Set-Cookie: PHPSESSID=2bbe63786a088471ade3717917f4ba4f; path=/; domain=

    <html>
        <head>
            <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
            <meta http-equiv="refresh" content="1;url=http://localhost/login" />
        </head>
        <body>
            Redirecting to <a href="http://localhost/login">http://localhost/login</a>.
        </body>
    </html>
    Failed asserting that <integer:0> matches expected <integer:1>.

    .../src/Symfony/Bundle/SecurityBundle/Tests/Functional/LocalizedRoutesAsPathTest.php:50

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

by schmittjoh at 2011/07/19 23:47:29 -0700

I fixed a wrong case, but I couldn't reproduce the other errors (tested on Ubuntu).

My guess is that the temporary directory on your machine couldn't be deleted for some reason, and the test runs with the configuration of some of the previous tests.

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

by fabpot at 2011/07/20 00:28:41 -0700

That does not make any difference for me. For instance, in `LocalizedRoutesAsPathTest::testLoginLogoutProcedure()`, the first request to `'/'.$locale.'/login'` returns the following Response:

    <html>
        <head>
            <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
            <meta http-equiv="refresh" content="1;url=http://localhost/login" />
        </head>
        <body>
            Redirecting to <a href="http://localhost/login">http://localhost/login</a>.
        </body>
    </html>

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

by schmittjoh at 2011/07/20 00:31:34 -0700

That's weird, did you make sure that the temporary directory does not exist?

``rm -Rf /tmp/StandardFormLogin/``

On Wed, Jul 20, 2011 at 9:28 AM, fabpot <
reply@reply.github.com>wrote:

> That does not make any difference for me. For instance, in
> `LocalizedRoutesAsPathTest::testLoginLogoutProcedure()`, the first request
> to `'/'.$locale.'/login'` returns the following Response:
>
>    <html>
>        <head>
>            <meta http-equiv="Content-Type" content="text/html;
> charset=utf-8" />
>            <meta http-equiv="refresh" content="1;url=
> http://localhost/login" />
>        </head>
>        <body>
>            Redirecting to <a href="http://localhost/login">
> http://localhost/login</a>.
>        </body>
>    </html>
>
> --
> Reply to this email directly or view it on GitHub:
> https://github.com/symfony/symfony/pull/1739#issuecomment-1613504
>

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

by fabpot at 2011/07/20 00:33:40 -0700

Yes, I've just checked and the directory does not exist.

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

by schmittjoh at 2011/07/20 00:39:55 -0700

Sorry, I can't reproduce it on Ubuntu and unless someone wants to sponsor me a Mac, there is not much I can do.
2011-07-22 14:45:54 +02:00
Fabien Potencier
7dcbcbe69d [HttpFoundation] tagged public @api 2011-07-20 10:06:02 +02:00
Johannes Schmitt
f300edebe4 fixes several bugs 2011-07-19 16:21:58 +02:00
Fabien Potencier
d6cbbdd26c merged branch meckhardt/create-request-with-empty-path (PR #1736)
Commits
-------

95011ce [HttpFoundation] Fixed creation of requests without a path.

Discussion
----------

[HttpFoundation] Fixed creation of requests without a path.

Providing urls with no path led to php warning that the index 'path' is
not set. This patch initializes 'path' if no path is set.
2011-07-19 11:52:50 +02:00
Martin Eckhardt
95011ce4b7 [HttpFoundation] Fixed creation of requests without a path.
Providing urls with no path led to php warning that the index 'path' is
not set. This patch initializes 'path' if no path is set.
2011-07-19 10:54:21 +02:00
Fabien Potencier
059af7964b merged branch jdreesen/fix-01 (PR #1715)
Commits
-------

3a33c65 Fixed typo

Discussion
----------

Fixed typo

Fixed a small typo in the docblock
2011-07-17 07:49:38 +02:00
Johannes Schmitt
5e80c68fab fixes a naming inconsistency 2011-07-15 18:06:18 +02:00
Johannes Schmitt
3cb4b031b6 Revert "fixed inconsistent naming"
Incomplete, and wrong repo anyway.
2011-07-15 15:55:30 +02:00
Johannes
eaa173b788 fixed inconsistent naming 2011-07-15 06:41:41 -07:00
Francis Besset
71cfb56917 Thrown a \RuntimeException in RequestMatcher::checkIp6() if PHP is compiled with the option "disable-ipv6" 2011-07-15 10:28:46 +02:00
jdreesen
3a33c65bd5 Fixed typo 2011-07-15 04:59:03 +02:00
Fabien Potencier
4004b4411e merged branch francisbesset/httpfoundation_responseheaderbag (PR #1640)
Commits
-------

64e9263 Updated UPDATE.md
7cf891a Renamed variable returned and used self in place of static for constants
f91f4dd Added the possibility to set cookies with the same name for different domains and paths for Symfony\Component\HttpFoundation\ResponseHeaderBag
f08eeb4 Moved managing cookies of HeaderBag in ResponseHeaderBag

Discussion
----------

[HttpFoundation] Cookies management in ResponseHeaderBag

Fixed cookies management in `Symfony\Component\HttpFoundation\HeaderBag` and `Symfony\Component\HttpFoundation\ResponseHeaderBag`
2011-07-13 16:37:40 +02:00
Fabien Potencier
182f9e6508 [HttpFoundation] added population of the Authorization header based on the PHP_AUTH_* data 2011-07-13 14:12:03 +02:00
Francis Besset
7cf891a448 Renamed variable returned and used self in place of static for constants 2011-07-13 14:10:50 +02:00
Francis Besset
f91f4dda13 Added the possibility to set cookies with the same name for different domains and paths for Symfony\Component\HttpFoundation\ResponseHeaderBag
ResponseHeaderBag::hasCookie() and ResponseHeaderBag::getCookie() were removed
2011-07-11 23:03:26 +02:00
Francis Besset
f08eeb4433 Moved managing cookies of HeaderBag in ResponseHeaderBag
By example, a cookie can't be set in a request
2011-07-11 19:50:24 +02:00
Fabien Potencier
fa78e78f5f [HttpFoundation] added some information in a phpdoc 2011-07-11 11:30:24 +02:00
Fabien Potencier
0e4d057984 moved some RFC-tweaking logic in Response to a public method to make it reusable 2011-07-11 11:22:12 +02:00
Fabien Potencier
1a576552f8 [HttpFoundation] fixed unit test for previous merge 2011-07-11 11:02:30 +02:00
Fabien Potencier
de2ab0b506 merged branch lenar/patch-3 (PR #1551)
Commits
-------

f7d0f65 RFC2616 changes
b9a218a [HttpFoundation] set Content-Length header to the length of content

Discussion
----------

[HttpFoundation] set Content-Length header to the length of content

I can't think of why this could be bad but if somebody knows please chime in.

The good thing is that with this change keepalive will work out of the box.

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

by Seldaek at 2011/07/06 05:34:51 -0700

That sounds like a great change. I think it might explain/fix the issues I've encountered with AppCache on my production box. Never had time to look into it, but IIRC I noticed the missing Content-Length, and it seemed to load forever.

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

by fabpot at 2011/07/06 06:46:50 -0700

The `Content-Length` is automatically added by servers like Apache. Moreover, sometimes, you should not add it: http://www.w3.org/Protocols/rfc2616/rfc2616-sec4.html#sec4.4

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

by lenar at 2011/07/06 07:54:45 -0700

It is not added automatically by default. Yes, in case of Apache it is actually added if deflate module is enabled and if that module decides to compress the content (decision based on content-type).

About RFC2616: I will read it and add changes to this PR if applicable.

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

by fabpot at 2011/07/06 08:38:14 -0700

e943fde2ef

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

by Seldaek at 2011/07/06 08:45:22 -0700

@lenar all you have to do is skip setting the Content-Length for `1xx`, `204`, and `304` responses I believe.

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

by Seldaek at 2011/07/06 08:46:54 -0700

But this should maybe be done in sendHeaders() à la `fixContentType`, because you can't be sure about the statusCode before that.

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

by lenar at 2011/07/06 13:55:33 -0700

I propose this based on what I read and understood from RFC2616.

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

by mheleniak at 2011/07/10 03:57:26 -0700

+1
2011-07-11 10:58:31 +02:00
drm
9714cfc4f9 Fixes fatal error when intl module is not installed. 2011-07-10 15:15:04 +02:00
ornicar
6c736c936f Fix RedirectResponse HTML indentation and constructor phpDoc 2011-07-08 18:14:45 -07:00
Fabien Potencier
cce2bc59a8 fixed CS 2011-07-07 11:07:02 +02:00
Fabien Potencier
9b3c2ca3d3 merged branch vicb/uploaded-file/max-size (PR #1574)
Commits
-------

6786e81 [HttpFoundation] code factorization in UploadedFile

Discussion
----------

[HttpFoundation] code factorization in UploadedFile

As both #1542 and #1544 have been merged.
2011-07-07 11:06:29 +02:00
Victor Berchet
6786e81f61 [HttpFoundation] code factorization in UploadedFile 2011-07-07 10:47:10 +02:00
Fabien Potencier
db415db0af [HttpFoundation] tweaked previous merge 2011-07-07 07:41:40 +02:00
Fabien Potencier
c41da9d447 merged branch ktomk/patch-1 (PR #1558)
Commits
-------

db37bbb HTTP 1.1 / RFC 2616 - Make Redirect response HTTP body having a HTML body.

Discussion
----------

[HttpFoundation] Redirect response is missing a HTML body

HTTP 1.1 / RFC 2616 - Make Redirect response HTTP body having a HTML body as "...the entity of the response SHOULD contain a short hypertext note with a hyperlink to the new URI(s)." (unless HEAD request, see response codes 301, 302, 303 and 307).

See [10.3 Redirection 3xx *in* Hypertext Transfer Protocol -- HTTP/1.1 (RFC 2616 Fielding, et al.)](http://www.w3.org/Protocols/rfc2616/rfc2616-sec10.html#sec10.3) and [9.3 Redirection 3xx *in* Hypertext Transfer Protocol -- HTTP/1.0](http://tools.ietf.org/html/rfc1945#section-9.3).

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

by stloyd at 2011/07/06 10:50:50 -0700

As we allow changing protocol version, and by [default](https://github.com/symfony/symfony/blob/master/src/Symfony/Component/HttpFoundation/Response.php#L88) use 1.0 this should have an use also `$this->getProtocolVersion()`.

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

by ktomk at 2011/07/06 10:57:48 -0700

(Updated the original comment and linked the HTTP 1.0 specs in there)

Just have reviewed the RFCs and the processing inside `[HttpFoundation]`.  The response class [identifies the following status codes as redirects](db37bbb189/src/Symfony/Component/HttpFoundation/Response.php (L741)): `201`, `301`, `302`, `303` and `307`. That's quite the same list I compiled above where I did only check for 3xx codes. In HTTP/1.0 (symfony default) the 201 response can contain the new location in it's entity (body) of the response (in contrast, [RFC 1945 is *not* talking about the location header explicitly](http://tools.ietf.org/html/rfc1945#section-9.2); see as well [10.11  Location](http://tools.ietf.org/html/rfc1945#section-10.11), that's [in HTTP/1.1 done](http://www.w3.org/Protocols/rfc2616/rfc2616-sec10.html#sec10.2.2), compare [14.30 Location](http://www.w3.org/Protocols/rfc2616/rfc2616-sec14.html#sec14.30)).

So I would say HTTP 1.0 is properly reflected with the changes as well and the concrete Response object [is already taking care for protocol validity](db37bbb189/src/Symfony/Component/HttpFoundation/RedirectResponse.php (L41)).
2011-07-07 07:37:39 +02:00
Fabien Potencier
bb5075d820 [HttpFoundation] prevented Response headers to be sent twice
This change allows for more flexibility if the developer wants to flush
the Response content early (the drawback being that Response listeners
won't be able to tweak the HTTP headers anymore).

There is another benefit: avoid the infamous
"Fatal error: Exception thrown without a stack frame in Unknown on line 0".

Here is a small scenario when this can happen (thanks dtee for identifying this issue):

* Call flush() in controller to output html early, then throw exception
* ExceptionHandler triggers handle() function and return new Response object to output...
* Because the header is sent (flush() call in Controller), php's E_WARNING error get raised, which gets handled by ErrorHandler->handle() and it throws new ErrorException()
* PHP fatals to prevent Exception loop: "Fatal error: Exception thrown without a stack frame in Unknown on line 0"
2011-07-07 07:34:35 +02:00
lenar
f7d0f651a3 RFC2616 changes 2011-07-06 23:50:37 +03:00
Lenar Lõhmus
b9a218a5c1 [HttpFoundation] set Content-Length header to the length of content 2011-07-06 23:47:40 +03:00
Tom Klingenberg
db37bbb189 HTTP 1.1 / RFC 2616 - Make Redirect response HTTP body having a HTML body. 2011-07-06 09:29:18 -07:00
Fabien Potencier
b9adab9796 merged branch vicb/form/ini-max-size (PR #1542)
Commits
-------

d58ba34 [Validator] Consider the ini directive 'upload_max_filesize' while validating an uploaded file (fixes GH-1441)

Discussion
----------

[Validator] FileValidator support for uploaded files

[Validator] Consider the ini directive 'upload_max_filesize' while validating an uploaded file (fixes GH-1441)

Added validator messages should get translated in all the available languages.
2011-07-06 14:22:15 +02:00
Victor Berchet
d58ba34246 [Validator] Consider the ini directive 'upload_max_filesize' while validating an uploaded file (fixes GH-1441) 2011-07-05 20:05:50 +02:00
Fabien Potencier
932cd10477 made HTTP headers coming from proxies non-trusted by default 2011-07-05 19:49:36 +02:00
Fabien Potencier
9fbffcc650 removed usage of preg_match with the 'e' modifier 2011-07-05 19:49:27 +02:00
Daniel Londero
7dd8dd7699 Fixed @Return comment for getAcceptableContentTypes() method. 2011-07-04 14:34:11 -07:00
Fabien Potencier
311a9bd02b [HttpFoundation] tweaked previous merge 2011-07-04 16:26:19 +02:00
stloyd
756ea8db39 Call session_name() only if user gave an new one. Closes #1418 2011-07-04 14:46:04 +02:00
Fabien Potencier
ea0f327122 merged branch Seldaek/req_time (PR #1432)
Commits
-------

e80ce57 [HttpFoundation] Add REQUEST_TIME by default

Discussion
----------

[HttpFoundation] Add REQUEST_TIME by default

Without this the getting the REQUEST_TIME from the Request in tests is breaking.
2011-06-25 13:26:06 +02:00
Jordi Boggiano
e80ce57935 [HttpFoundation] Add REQUEST_TIME by default 2011-06-25 12:44:24 +02:00
Fabien Potencier
f57e1d3e10 fixed CS 2011-06-23 14:07:53 +02:00
Fabien Potencier
84e87c65cc [HttpFoundation] fixed a bug in previous merge 2011-06-22 15:23:37 +02:00
Fabien Potencier
37521b6fd7 [HttpFoundation] forced Response content to be string 2011-06-22 15:22:06 +02:00
Brian King
34494b36a6 whitespace fixes 2011-06-21 15:43:43 +02:00
Brian King
1a86a4a215 Refactor mime-type to file extension guessing 2011-06-21 13:31:24 +02:00
Jordi Boggiano
7af003b753 [HttpFoundation] Allow stringable objects and numbers in response body + added tests 2011-06-21 13:06:36 +02:00
Jordi Boggiano
8126fb7082 [HttpFoundation] Ensure response body is string, fixes #1378 2011-06-21 11:59:20 +02:00
Brian King
e7481a3f75 Decouple mime-type to extension logic from File class 2011-06-21 11:00:27 +02:00
Jordi Boggiano
f400124037 [HttpFoundation] Small optimization of Session flash handling 2011-06-20 11:06:27 +02:00
Fabien Potencier
1467a9bd9d [HttpFoundation] refactored Session 2011-06-15 16:01:57 +02:00
Fabien Potencier
570db760ae merged branch francisbesset/session_locale (PR #686)
Commits
-------

72c074a [Session] Used \Locale::setDefault() when the locale is setted

Discussion
----------

[Session] Used \Locale::setDefault() when the locale is setted

For `DateType` in form component (by example), `\Locale::getDefault()` is used to displayed the name of months.

If `\Locale` class is not used when the locale is setted in the session, the name of months is not in a good language.
This PR solves this problem.

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

by pborreli at 2011/05/29 09:13:44 -0700

what if user doesn't have intl extension ?

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

by stof at 2011/05/29 09:24:04 -0700

You should wrap the calls to ``\Locale::setDefault`` in a ``class_exist`` check to avoid issue when using the stub implementation (for which calling ``setDefault`` is forbidden).

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

by francisbesset at 2011/05/29 09:26:40 -0700

@pborreli: Symfony have a fake Locale class and this class is used only if the server haven't intl enabled.

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

by stof at 2011/05/29 09:33:16 -0700

@francisbesset Yeah, but ``setDefault`` throw a ``BadMethodCall`` exception.

and so the check has to use ``extension_loaded`` instead of ``class_exists``.

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

by fabpot at 2011/06/13 10:12:15 -0700

Ticket #1121 is related to this PR.

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

by fabpot at 2011/06/15 06:18:28 -0700

I have just tried another implementation where the locale is passed as an argument to the built-in types and some data transformers (via a `LocaleAwareInterface` interface). That works fine as forms are immutable now, but the solution is obviously more "complex" as we need to pass the locale to many different classes. Also, using `Locale::setDefault()` has an advantage over my method: you can change the locale whenever you want within a PHP process (which can be useful even if this is an edge case). Last, but not the least, if make sense to update the PHP Locale to the user locale.

So, to sum up, this patch is probably the best solution (easy and flexible enough).
2011-06-15 15:22:23 +02:00
Fabien Potencier
c7d5fd16e0 fixed CS 2011-06-15 13:46:46 +02:00
Fabien Potencier
5b142d581b fixed CS 2011-06-15 11:35:32 +02:00
Fabien Potencier
e72ff4f43d merged branch umpirsky/request-doc-fix (PR #1328)
Commits
-------

cbd1dfd Minor doc fixes in Request.

Discussion
----------

Minor doc fixes in Request.

Minor fix, contribution warmup :)
2011-06-15 11:33:37 +02:00
Fabien Potencier
c5223bbcd1 merged branch vicb/file (PR #1317)
Commits
-------

9d6357c [HttpFoundation] Document the changes to the File classes
136b80a [HttFoundation] Add File::getExtension() as \SplFileInfo::getExtension() was introduced in PHP 5.3.6
38b3b74 [HttpKernel] Fix and test previous commit
ac0c00c [HttpFoundation] Make File extends \SplFileInfo

Discussion
----------

[HttpFoundation] Make File extends \SplFileInfo

This is a rebased version of [PR 674](https://github.com/symfony/symfony/pull/674).

  * File: The API has changed (now extends \SplFileInfo),
  * File: move() creates the target directory when it does not exist
  * UploadedFile: introduction of getClientXXX() methods (for Size, OriginalName, MimeType)

If this PR does not get merged UploadedFile should at least be fixed: [Client.php](https://github.com/symfony/symfony/blob/master/src/Symfony/Component/HttpKernel/Client.php#L124) relies on a last parameter which is no more defined and which is used to bypass [move_uploaded_file()](https://github.com/symfony/symfony/blob/master/src/Symfony/Component/HttpFoundation/File/UploadedFile.php#L155) in test mode.

If this could be merged, I'll detail the changes in UPDATE.md

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

by fabpot at 2011/06/14 08:20:59 -0700

I'll merge it. Can you update the UPDATE file?

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

by vicb at 2011/06/14 09:24:01 -0700

done
2011-06-15 08:57:16 +02:00
Sasa Stamenkovic
cbd1dfd3bd Minor doc fixes in Request. 2011-06-14 21:44:45 +02:00
Victor Berchet
136b80ae63 [HttFoundation] Add File::getExtension() as \SplFileInfo::getExtension() was introduced in PHP 5.3.6 2011-06-14 18:18:43 +02:00
Fabien Potencier
9b1b9373b8 [HttpFoundation] simplified code 2011-06-14 16:08:07 +02:00
Fabien Potencier
24778553cd [HttpFoundation] simplified code 2011-06-14 16:07:18 +02:00
Fabien Potencier
b763d667f5 merged branch lsmith77/checkIp (PR #1322)
Commits
-------

2f04bdb make checkIp() reuseable

Discussion
----------

[RequestMatcher] make checkIp() reuseable
2011-06-14 15:59:49 +02:00
Lukas Kahwe Smith
2f04bdb3c5 make checkIp() reuseable 2011-06-14 15:31:52 +02:00
Victor Berchet
ac0c00c6e8 [HttpFoundation] Make File extends \SplFileInfo 2011-06-14 10:47:04 +02:00
Fabien Potencier
a12ea12fc1 fixed CS 2011-06-13 18:54:20 +02:00
Fabien Potencier
196350b892 Merge remote branch 'djama/patch-1'
* djama/patch-1:
  call header() with replace=false, to provide the possibility of sending mutiple headers of the same type.
2011-06-13 12:19:40 +02:00
Fabien Potencier
0fc56346f7 Merge remote branch 'AurelC2G/fix-charset'
* AurelC2G/fix-charset:
  [HttpFoundation] Fixed indentation
  [HttpFoundation] Fixed charset always being set to UTF-8
2011-06-13 11:22:46 +02:00
Brikou CARRE
3dff029c37 [Session] added phpdoc about flash messages 2011-06-11 11:44:30 +02:00
Aurélien Fredouelle
6ae2bdeabd [HttpFoundation] Fixed indentation 2011-06-11 10:24:44 +02:00
Aurélien Fredouelle
1e50a553d2 [HttpFoundation] Fixed charset always being set to UTF-8
Fixes #1281
2011-06-11 10:22:26 +02:00
djama
96359fb86d call header() with replace=false, to provide the possibility of sending mutiple headers of the same type. 2011-06-10 09:16:33 -07:00
Fabien Potencier
09ee01501d Merge remote branch 'lmcd/master'
* lmcd/master:
  Added an optimisation for PHP-FPM (FastCGI Process Manager). As soon as a full Response is dispatched to the browser, the HTTP connection is closed, but the script stays alive on FPM servers.
2011-06-10 15:52:35 +02:00
Brikou CARRE
896c294b58 [HttpFoundation] added phpdoc + exception fix 2011-06-10 08:59:49 +02:00
Lee McDermott
7e89a6ad41 Added an optimisation for PHP-FPM (FastCGI Process Manager).
As soon as a full Response is dispatched to the browser, the HTTP connection is closed, but the script stays alive on FPM servers.
2011-06-09 19:11:02 +01:00
Fabien Potencier
852a4c9c6a [Form] removed the file upload temporary storage feature
The current implementation is not ready for inclusion in 2.0. It has several
known problems (security, not possible to disable it, not "cloud-compatible",
...) and it's not a must have feature anyway.

Some references:

 * Security issue in FileType: https://github.com/symfony/symfony/issues/1001
 * Validation fails on file, still stored in TemporaryStorage: https://github.com/symfony/symfony/issues/908
 * Add a size argument & ability to configure TemporaryStorage: https://github.com/symfony/symfony/pull/748

This feature should be reworked and discussed for inclusion in 2.1.
2011-06-09 12:44:36 +02:00
Fabien Potencier
1e8cd6d34d [HttpFoundation] removed the leading . for extensions 2011-06-09 12:42:42 +02:00
Fabien Potencier
1aabc5da64 fixed CS 2011-06-08 12:16:48 +02:00
Fabien Potencier
62e4342a86 fixed CS 2011-06-08 12:12:55 +02:00
Fabien Potencier
0af4743583 [HttpFoundation] fixed Request::getFormat() when the mime-type has some optional parameter (closes #1235) 2011-06-08 11:12:57 +02:00
Fabien Potencier
f16e206cd7 [HttpFoundation] added missing CONTENT_TYPE and CONTENT_LENGTH to the Request headers (these two headers are not prefixes with HTTP_ -- as per the CGI/1.1 spec, closes #1234) 2011-06-08 11:04:41 +02:00
Fabien Potencier
9118fcee14 [HttpFoundation] fixed CS 2011-06-08 10:35:47 +02:00
Fabien Potencier
cb3390e9ae Merge remote branch 'gordonslondon/http-foundation/response'
* gordonslondon/http-foundation/response:
  [HttpFoundation] merge Response::isRedirected() with Response::isRedirect() - Response::isRedirected() has been removed
2011-06-06 18:06:51 +02:00
Fabien Potencier
c561f4f0c0 [Routing] changed HTTP method to always be uppercased (to be consistent with HttpFoundation/Request) 2011-06-04 19:06:39 +02:00
Fabien Potencier
4f7484b946 [HttpFoundation] moved dir creation just before writing to disk 2011-05-30 14:59:02 +02:00
GordonsLondon
ef9dc7c623 [HttpFoundation] merge Response::isRedirected() with Response::isRedirect() - Response::isRedirected() has been removed 2011-05-29 15:34:02 +02:00
Johannes M. Schmitt
88becfe3f8 [HttpFoundation] allow locale in RequestMatcher path 2011-05-28 22:37:43 +02:00
Fabien Potencier
4de930b000 [HttpFoundation] added some phpdoc 2011-05-27 07:55:37 +02:00
Fabien Potencier
c19d6c07d2 [HttpFoundation] simplified code 2011-05-26 15:02:40 +02:00
Joshua Nye
3832a7a33d Added missing space. 2011-05-25 17:22:32 -04:00
Joshua Nye
f019541716 Fixed broken logic in Request::getHttpHost(). It was ignoring HTTP_HOST completely. 2011-05-25 16:02:16 -04:00
Fabien Potencier
68aa0f46a4 Merge remote branch 'jdhoek/master'
* jdhoek/master:
  Add missing {} around @inheritDoc to fix this class in SF beta2.
  Add missing {} around @inheritDoc to fix this class in SF beta2.
2011-05-24 09:53:18 +02:00
jdhoek
67cace5d21 Add missing {} around @inheritDoc to fix this class in SF beta2. 2011-05-24 00:40:39 -07:00
jdhoek
c6172e0f96 Add {} around @inheritDoc annotation to fix this class in SF beta2 2011-05-24 00:29:42 -07:00
Brikou CARRE
9908d51da8 removed docblock for isNoCache 2011-05-23 01:37:10 -07:00
Brikou CARRE
2648ff273e fixed the description of isNoCache method 2011-05-23 09:35:41 +02:00
Brikou CARRE
12bf94c7ff fixed description for isNoCache method 2011-05-23 08:44:08 +02:00
Brikou CARRE
e018e6ce44 added missing method's docblock 2011-05-22 09:13:03 +02:00
Fabien Potencier
b042366353 Merge remote branch 'stfalcon/patch-2'
* stfalcon/patch-2:
  Small refact. Without this I get a php Notice and Warnig if try getFlash() after clearing the session:
2011-05-22 08:08:28 +02:00
Kris Wallsmith
fc5992495f [HttpFoundation] updated session to only save on destruct if started 2011-05-19 11:47:21 -07:00
Kris Wallsmith
ed8ecab7ea [HttpFoundation] fixed locale accessor after session clear 2011-05-19 11:45:12 -07:00
Kris Wallsmith
a538344b3b [HttpFoundation] removed unnecessary method 2011-05-19 11:44:15 -07:00
Fabien Potencier
9714524b39 fixed a unit test and CS 2011-05-19 17:38:16 +02:00
jsor
fd6c254b47 [HttpFoundation] changed checking for deleted cookie to be conform with setcookie() 2011-05-19 17:14:03 +02:00
jsor
fc1a8cac35 [HttpFoundation] allow negative values for cookies expires timestamp 2011-05-19 17:14:02 +02:00
jsor
f9b6c8b74a [HttpFoundation] included cookie headers in string representation 2011-05-19 17:14:01 +02:00
jsor
e6d929aa71 [HttpFoundation] added __toString() method 2011-05-19 17:13:58 +02:00
Miha Vrhovnik
2e286073a4 Removed ability to override method from GET request 2011-05-19 14:08:34 +02:00
Miha Vrhovnik
65ed6f7763 Added support for request method overriding via X-HTTP-Method-Override
This type of override is supported by MS MVC3 and is recommended by Google.
Also added ability to override request method via ?_method= when
request is made via GET.
2011-05-19 09:33:08 +02:00
Fabien Potencier
a965a5ce32 Merge remote branch 'kertz/PdoSessionStorage_mysql'
* kertz/PdoSessionStorage_mysql:
  [PdoSessionStorage] Added insert... on duplicate
2011-05-17 17:55:41 +02:00
Fabien Potencier
e7e5304876 forced all responses to have a Date header (RFC2616 - 14.18) 2011-05-16 08:46:36 +02:00
Fabien Potencier
5a38886b1d [HttpFoundation] fixed Request::getHttpHost() 2011-05-16 08:20:17 +02:00
Fabien Potencier
28f9b4f13e [HttpFoundation] force headers to be sorted in HeaderBag::__toString() 2011-05-15 22:40:14 +02:00
Fabien Potencier
4c7adc2f12 [HttpFoundation] fixed a warning 2011-05-15 19:44:34 +02:00
Fabien Potencier
11fa8d8698 [HttpFoundation] tweaked HeaderBag::__toString() to ease debugging 2011-05-15 12:43:05 +02:00
Fabien Potencier
e81b88c576 [HttpFoundation] added HeaderBag::__toString() 2011-05-15 12:38:12 +02:00
Fabien Potencier
dcb4ef6e23 [HttpFoundation] added Request::__toString() 2011-05-15 12:33:06 +02:00
Amal Raghav
ebc2f01e5b [PdoSessionStorage] Added insert... on duplicate 2011-05-15 15:48:29 +05:30
Fabien Potencier
62d09b8fb2 [HttpFoundation] ensures that path info always starts with a / 2011-05-15 11:28:38 +02:00
Stepan Tanasiychuk
c6206f8faf Small refact. Without this I get a php Notice and Warnig if try getFlash() after clearing the session:
Notice: Undefined index: _flash in /var/www/test/symfony2/vendors/symfony/src/Symfony/Component/HttpFoundation/Session.php on line 231
Warning: array_key_exists() expects parameter 2 to be array, null given in /var/www/test/symfony2/vendors/symfony/src/Symfony/Component/HttpFoundation/Session.php on line 231
2011-05-14 14:23:14 -07:00
Amal Raghav
4fa0c4c3ea some cosmetic changes to PdoSessionStorage
aligned line 210
2011-05-14 23:45:13 +05:30
Chekote
41ed194a98 Fixed content type for urlencoded forms being too specific. For example, this will now function will clients (such as Firefox) that append the charset to the content type header. Uses 0 === strpos() as per @kriswallsmith suggestion. 2011-05-13 19:05:28 -05:00
Chekote
88d94dd59f Fixed reference to $this, when not in object context 2011-05-12 16:21:13 -05:00
Fabien Potencier
0848604ce1 [HttpFoundation] fixed typo 2011-05-12 14:45:39 +02:00
Fabien Potencier
08846af9e2 [HttpFoundation] moved the PUT magic dance in createFromGlobals() 2011-05-12 14:45:38 +02:00
Fabien Potencier
efd1f1358c added support for PUT method 2011-05-12 14:45:38 +02:00
jsor
d39c3be779 [HttpFoundation] replaced LF by CRLF as per the spec 2011-05-12 00:08:05 +02:00
Johannes Schmitt
7a6638ff8f [HttpFoundation] fixed php doc 2011-05-10 20:24:58 +02:00
Johannes Schmitt
411659bc07 [HttpFoundation] added $deep flag to Request::get() 2011-05-10 11:19:22 +02:00
Johannes Schmitt
89f60e04d1 [HttpFoundation] removed getDeep(), added a boolean flag to get() instead 2011-05-10 11:16:25 +02:00
Fabien Potencier
50c1cce014 Merge remote branch 'schmittjoh/security'
* schmittjoh/security:
  [HttpFoundation] added unit test
  [Security][HttpFoundation] splits Request::hasSession() into hasSession(), and hasPreviousSession()
  [SecurityBundle] added some tests
  add provider to configuration
  update DI to handle change in config and another provider
  separate dbal specific acl config
  add provider to configuration
  update DI to handle change in config and another provider
  separate dbal specific acl config
2011-05-09 14:26:36 +02:00
Jordi Boggiano
36aa7b0d70 [HttpFoundation] Remove warnings when session id isn't given 2011-05-06 16:25:44 +02:00
Johannes Schmitt
362b7264d1 [Security][HttpFoundation] splits Request::hasSession() into hasSession(), and hasPreviousSession()
This closes #774, and fixes #772.
2011-05-05 08:38:07 +02:00
Fabien Potencier
36bcfcc5ee Merge remote branch 'bschussek/form'
* bschussek/form:
  [Form] CSRF fields are not included in the children of a FormView anymore if the view is not the root
  [Form] FormView::offsetUnset() is now supported. It was possible anyway using getChildren() and setChildren().
  [Form] Split the option "modifiable" of the "collection" type into "allow_add" and "allow_delete"
  [Form] Added test for last commit by kriswallsmith and improved dealing with original names
  [Form] Fixed variable scope when entering nested form helpers
  [Form] Added tests for blocks/templates in the format _<ID>_(widget|row|label|...)
  [Form] updated listener to check that data is an array
2011-05-04 22:13:33 +02:00
Kris Wallsmith
ae46150bc8 [HttpFoundation] added support for X-Forwarded-Port request header 2011-05-04 09:56:34 -07:00
Bernhard Schussek
bf1dfbbe99 [Form] Added test for last commit by kriswallsmith and improved dealing with original names
The form component should now guarantee to always pass an UploadedFile object to your model. There you can call getOriginalName() to retrieve the original name of the uploaded file. For security reasons, the real file name is a generated hash value.
2011-05-04 17:04:44 +02:00
Fabien Potencier
17aa0ed0ed changed the default httpOnly value for cookie for better security out of the box 2011-05-04 08:44:59 +02:00
Fabien Potencier
c7fddca891 replaced some url..code by rawurl..code 2011-05-03 23:06:55 +02:00
Fabien Potencier
d31c403bae Merge remote branch 'pborreli/tests-fix-typos'
* pborreli/tests-fix-typos:
  Various typos
  [WebProfilerBundle] Fixed typo
  [WebProfilerBundle] Adding unit tests
2011-04-30 21:53:15 +02:00
Pascal Borreli
391744719a Various typos 2011-04-30 19:40:15 +00:00
Victor Berchet
dccac192d6 [HttpFoundation] Sanitize uploaded file original name 2011-04-29 19:27:53 +02:00
Francis Besset
72c074a101 [Session] Used \Locale::setDefault() when the locale is setted 2011-04-28 00:03:32 +02:00
Stepan Tanasiychuk
411997dc59 fix wrong method name 2011-04-27 23:15:27 +03:00
Victor Berchet
d350e01e33 File & UploadedFile tweaks 2011-04-27 09:10:41 +02:00
Fabien Potencier
00bfd10ca9 [HttpFoundation] refactored File management to be safer 2011-04-27 08:50:33 +02:00
Fabien Potencier
b7cd7115d1 [HttpFoundation] removed protected methods that were not used 2011-04-27 08:04:10 +02:00
Fabien Potencier
5bb9da4b6d [HttpFoundation] renamed getDefaultExtension() to guessExtension()
The renamed method now returns null if it cannot guess the extension. It allows
the developper to know whether the extension has been guessed or not.
2011-04-27 08:03:19 +02:00
Fabien Potencier
a26de5ba58 [HttpFoundation] fixed CS 2011-04-27 08:03:15 +02:00
Fabien Potencier
854fbd7f68 [HttpFoundation] use realpath to ensure that there is no .. in file path (to match phpdoc) 2011-04-27 07:58:54 +02:00
Fabien Potencier
aa3ec504ae removed File::getWebPath()
This has been removed for several reasons:

* the framework does not know where the document root is and should not care
* as the document root was static, it was impossible to have several document roots depending on some business rules (see next one)
* sometimes, the document root is not under the web root directory (so the logic of getWebPath() is not always correct)
* the feature was not used anywhere in the core
2011-04-27 06:49:05 +02:00
Victor Berchet
f83e92bf44 Make casting scalar to array consistent 2011-04-26 12:16:35 +02:00
Fabien Potencier
889c422d6e Merge remote branch 'igorw/ipv6'
* igorw/ipv6:
  [HttpFoundation] minor optimization
  minor adjustments suggested by vicb
  [HttpFoundation] IPv6 support for RequestMatcher
  [HttpFoundation] refactor RequestMatcherTest to use dataProvider
  [Validator] use full iPv6 regex
  [Validator] add IPv6 support to UrlValidator
  [HttpFoundation] add IPv6 support to Request
  [HttpFoundation] test Request::create with an IP as host name
  [HttpFoundation] refactor Request::getClientIp test
2011-04-24 22:04:25 +02:00
Fabien Potencier
2f3ddb88ef Merge remote branch 'bschussek/form'
* bschussek/form:
  [Form] Automatically setting "data_class" option if objects are passed at the creation of a form
  [Form] Improved the way passed data is handled in FormFactory
  [Form] Simplified FileType code
  [HttpFoundation] TemporaryStorage automatically creates the directory if it doesn't exist yet
  [Form] Changed FormBuilder::build() to FormBuilder::create(). You hvae to pass the resulting builder to FormBuilder::add() manually now
  [Form] Added FieldTypeValidatorExtension and fixed FQCN of DelegatingValidator
2011-04-24 21:53:24 +02:00
Fabien Potencier
08bf2af455 fixed email 2011-04-24 13:59:46 +02:00
Bernhard Schussek
19073ae655 [HttpFoundation] TemporaryStorage automatically creates the directory if it doesn't exist yet 2011-04-24 12:08:56 +02:00
Pascal Borreli
8c0beea677 [Phpdoc] Cleaning/fixing 2011-04-23 15:18:47 +00:00
Fabien Potencier
50d3c92e22 tweaked TemporaryStorage directory creation 2011-04-23 15:19:30 +02:00
Fabien Potencier
8cc5caf1f3 changed the default directory for the upload temp dir, made the dir mandatory 2011-04-23 15:09:55 +02:00
Fabien Potencier
02c66e658c removed the nestingLevel configuration for file temporary storages 2011-04-23 15:06:07 +02:00
Pascal Borreli
b5769c52d6 Fixed various typo 2011-04-22 23:12:50 +00:00
Igor Wiedler
041a2e9d83 [HttpFoundation] minor optimization 2011-04-22 22:20:12 +02:00
Igor Wiedler
51d12758a0 minor adjustments suggested by vicb 2011-04-22 18:37:20 +02:00
Igor Wiedler
9ae5023a70 [HttpFoundation] IPv6 support for RequestMatcher 2011-04-22 17:37:22 +02:00
Igor Wiedler
82699c5a98 [HttpFoundation] add IPv6 support to Request 2011-04-22 17:07:44 +02:00
Fabien Potencier
417839345f Merge remote branch 'lsmith77/request_format_tweaks'
* lsmith77/request_format_tweaks:
  added text/html to default format mapping
  return "q" from splitHttpAcceptHeader() to enable more complex accept header negotiations
  added support for setting a custom default format in Request::getRequestFormat()
2011-04-22 15:33:01 +02:00
Fabien Potencier
fd05f02b23 [HttpFoundation] added logic to automatically add the charset when not present in the Content-Type for relevant Content-Types 2011-04-22 15:26:38 +02:00
Fabien Potencier
7644e86683 refactored session configuration
* made the options array only for "global" options that are valid for all session storages
 * changed the PDO session storage constructor signature to accept an array of options for DB configuration
 * changed the storage_id to be the full service id, instead of just part of it
 * removed the class parameter for session as it can be changed via the .class parameter (it was the only example in the framework)
 * removed the configuration for the PDO session storage for now
2011-04-22 13:34:57 +02:00
Eriksen Costa
589b0ab4ed Merge branch 'master' into form-frameworkbundle-form-guessers-fix
Conflicts:
	src/Symfony/Bundle/FrameworkBundle/DependencyInjection/Compiler/AddFormGuessersPass.php
	src/Symfony/Component/Form/MoneyField.php
2011-04-21 23:03:40 -03:00
Fabien Potencier
c5497c7c67 [HttpFoundation] fixed a potential security problem in Request 2011-04-21 20:00:27 +02:00
Fabien Potencier
a2ab05e9c2 Merge remote branch 'web-dev/master'
* web-dev/master:
  Added 201 to the possible status codes that indicate a response is a redirect.
2011-04-21 19:51:30 +02:00
Josiah
98e46a23fa Added 201 to the possible status codes that indicate a response is a redirect. 2011-04-21 10:36:25 -07:00
Fabien Potencier
071caeb0c8 Merge remote branch 'merk/file'
* merk/file:
  [HttpFoundation\File] Removed realpath()
2011-04-20 23:13:55 +02:00
Kris Wallsmith
30511d2965 [HttpFoundation] fixed FilesystemSessionStorage 2011-04-20 13:20:21 -07:00
Tim Nagel
03bb3580a6 [HttpFoundation\File] Removed realpath() 2011-04-20 23:52:17 +10:00
Fabien Potencier
d993a9160a [HttpFoundation] fixed getScheme() method 2011-04-20 10:49:08 +02:00
Lukas Kahwe Smith
c2ac8304b0 added text/html to default format mapping 2011-04-17 14:39:07 +02:00
Lukas Kahwe Smith
4c3c6cdabf return "q" from splitHttpAcceptHeader() to enable more complex accept header negotiations 2011-04-17 14:38:33 +02:00
Lukas Kahwe Smith
53c7bcf3aa added support for setting a custom default format in Request::getRequestFormat() 2011-04-17 14:37:35 +02:00
Brikou CARRE
e898445b94 removed empty lines/trailing spaces 2011-04-15 21:12:02 +02:00
hidenorigoto
1e78ec395c [HttpFoundation] fixed wrong method name 2011-04-15 19:04:00 +09:00
Bernhard Schussek
44af72bbf4 Merge remote branch 'symfony/master' into experimental 2011-04-14 15:04:59 +02:00
Fabien Potencier
5316decd8c Merge remote branch 'hhamon/shared_maxage_fix'
* hhamon/shared_maxage_fix:
  [HttpFoundation] force Response to be "public" if setSharedMaxAge() is called.
2011-04-13 23:24:31 +02:00
Fabien Potencier
ea84bb025b fixed session management in functional tests 2011-04-13 23:11:25 +02:00
Fabien Potencier
e2c9fdf2c7 [HttpFoundation] fixed expiration time for Cookie (PHP wants a Unix timestamp) 2011-04-13 20:12:14 +02:00
Fabien Potencier
66c4bc727c [HttpFoundation] renamed Cookie::getExpire() to getExpiresTime() to be consistent with the DomCrawler component 2011-04-13 20:10:39 +02:00
Fabien Potencier
84dde4074a [HttpFoundation] changed default value of Cookie httponly argument to match PHP defaults 2011-04-13 20:07:31 +02:00
hhamon
053d83f557 [HttpFoundation] force Response to be "public" if setSharedMaxAge() is called. 2011-04-13 15:58:48 +02:00
Fabien Potencier
227c87404f Merge remote branch 'Funsational/master'
* Funsational/master:
  Update PDO session storage to check if any rows are updated when doing a session write. If no rows are udpated when performing a session write it generally means that we have created a new session id somewhere and we have not inserted into the database. This is the case for when calling regenerate_session_id() from the native session storage class. It will update the session id then call sessionWrite() to save the session but since the new session id does not exist in the DB, no rows are updated and any new session attributes such as security tokens are lost.
2011-04-13 14:27:16 +02:00
Bernhard Schussek
2a18be1c9f Merge remote branch 'symfony/master' into experimental 2011-04-13 13:53:20 +02:00
Johannes Schmitt
1ed73fb6e6 [HttpFoundation] allow to retrieve paths of arbitrary depths 2011-04-05 10:17:31 +02:00
michaelwilliams
46b711c4a8 Update PDO session storage to check if any rows are updated when doing a session write. If no rows are udpated when performing a session write it generally means that we have created a new session id somewhere and we have not inserted into the database. This is the case for when calling regenerate_session_id() from the native session storage class. It will update the session id then call sessionWrite() to save the session but since the new session id does not exist in the DB, no rows are updated and any new session attributes such as security tokens are lost.
See http://www.php.net/manual/en/function.session-set-save-handler.php#103055 for more details
2011-04-01 18:14:27 -07:00
Bernhard Schussek
bbeddf7789 Merge remote branch 'symfony/master' into experimental 2011-03-31 12:32:20 +02:00
Fabien Potencier
702e6587ad Merge remote branch 'pborreli/windows-fix-mimetype'
* pborreli/windows-fix-mimetype:
  [HttpFoundation][Windows] Fixed filebinary guesser method.
2011-03-30 19:52:56 +02:00
Pascal Borreli
44a6f84855 [HttpFoundation][Windows] Fixed filebinary guesser method. 2011-03-30 17:38:42 +00:00
Fabien Potencier
f77b94074f [HttpFoundation] replaced the option argument of Session by defaultLocale 2011-03-30 17:26:13 +02:00
Bernhard Schussek
55c14680d3 Merge remote branch 'symfony/master' into experimental 2011-03-30 10:31:21 +02:00
Pascal Borreli
dbb18662d7 [HttpFoundation][Windows] Disabled FileBinaryMimeTypeGuesser for Windows OS 2011-03-29 14:32:20 +00:00
Bernhard Schussek
729438fdea Merge branch 'rename-execute' into experimental
Conflicts:
	src/Symfony/Component/Form/FileField.php
	src/Symfony/Component/Form/Resources/config/validation.xml
2011-03-25 01:38:49 +01:00
Fabien Potencier
a6e6cbbb27 [HttpFoundation] removed the hardcoded ^ and $ from the RequestMatcher 2011-03-23 21:27:04 +01:00
Bernhard Schussek
89215d167d Merge remote branch 'symfony/master' into experimental 2011-03-19 13:25:41 +01:00
ornicar
7440db7244 [HttpFoundation] Make sure Request::getLanguages always returns an array 2011-03-19 01:34:54 -07:00
Kris Wallsmith
73db141ce6 [HttpFoundation] stripped tags from native error messages in case html_errors is on 2011-03-18 11:11:42 -07:00
Bernhard Schussek
3f70f89339 Merge remote branch 'symfony/master' into experimental
Conflicts:
	src/Symfony/Bundle/FrameworkBundle/Debug/TraceableEventDispatcher.php
	src/Symfony/Bundle/FrameworkBundle/DependencyInjection/FrameworkExtension.php
	src/Symfony/Component/HttpFoundation/File/UploadedFile.php
2011-03-18 10:39:40 +01:00
Kris Wallsmith
ab3b8ac364 [HttpFoundation] cleaned up comments and coding standards, added better exception messages when filesystem functions throw errors, added "moved" arg to UploadedFile constructor, added FileNotFoundException to UploadedFile per the parent constructor 2011-03-17 16:07:53 -07:00
Fabien Potencier
d5396f64de [HttpFoundation] fixed a small bug on Windows 2011-03-17 12:28:29 +01:00
Bernhard Schussek
f64f55002b Merge remote branch 'symfony/master' into experimental
Conflicts:
	src/Symfony/Component/Security/Http/Firewall/AbstractAuthenticationListener.php
	src/Symfony/Component/Security/Http/Firewall/AbstractPreAuthenticatedListener.php
2011-03-16 16:00:54 +01:00
Kris Wallsmith
a5d8770a54 [HttpFoundation] fixed ApacheRequest, added tests 2011-03-16 06:13:01 -07:00
Bernhard Schussek
0bf566310c Merge branch 'event-manager' into experimental
Conflicts:
	src/Symfony/Component/Form/BirthdayField.php
	src/Symfony/Component/Form/CheckboxField.php
	src/Symfony/Component/Form/ChoiceField.php
	src/Symfony/Component/Form/ChoiceList/TimeZoneChoiceList.php
	src/Symfony/Component/Form/CollectionField.php
	src/Symfony/Component/Form/DateField.php
	src/Symfony/Component/Form/DateTimeField.php
	src/Symfony/Component/Form/EntityChoiceField.php
	src/Symfony/Component/Form/Events.php
	src/Symfony/Component/Form/FieldFactory/FieldFactory.php
	src/Symfony/Component/Form/FieldFactory/FieldFactoryInterface.php
	src/Symfony/Component/Form/FileField.php
	src/Symfony/Component/Form/Filters.php
	src/Symfony/Component/Form/FormContext.php
	src/Symfony/Component/Form/FormContextInterface.php
	src/Symfony/Component/Form/FormFactoryInterface.php
	src/Symfony/Component/Form/HybridField.php
	src/Symfony/Component/Form/IntegerField.php
	src/Symfony/Component/Form/LanguageField.php
	src/Symfony/Component/Form/LocaleField.php
	src/Symfony/Component/Form/MoneyField.php
	src/Symfony/Component/Form/NumberField.php
	src/Symfony/Component/Form/PasswordField.php
	src/Symfony/Component/Form/PercentField.php
	src/Symfony/Component/Form/RepeatedField.php
	src/Symfony/Component/Form/TextField.php
	src/Symfony/Component/Form/TimeField.php
	src/Symfony/Component/Form/ToggleField.php
	src/Symfony/Component/Form/UrlField.php
	src/Symfony/Component/HttpFoundation/File/UploadedFile.php
	tests/Symfony/Tests/Component/Form/FileFieldTest.php
	tests/Symfony/Tests/Component/Form/FormContextTest.php
	tests/Symfony/Tests/Component/Form/HiddenFieldTest.php
2011-03-13 21:04:24 +01:00
Fabien Potencier
bc6ffeef83 [HttpFoundation] fixed flash management 2011-03-11 20:23:17 +01:00
Jordi Boggiano
991b1ed225 [HttpFoundation] UploadedFile::getOriginalName is now overriding getName 2011-03-09 17:26:08 +01:00
Jordi Boggiano
2a5fcdfb1a [HttpFoundation] Minor optimization 2011-03-09 17:25:36 +01:00
Fabien Potencier
8c423edfef replaced symfony-project.org by symfony.com 2011-03-06 12:40:06 +01:00
Fabien Potencier
a137d72351 Merge remote branch 'hhamon/cookie_path_fix'
* hhamon/cookie_path_fix:
  [Security] renamed Cookie::isHttponly() to Cookie::isHttpOnly()
  [HttpKernel] renamed Cookie::isHttponly() to Cookie::isHttpOnly()
  [BrowserKit] renamed Cookie::isHttponly() to Cookie::isHttpOnly()
  [HttpFoundation] fix cookie path default value to / and added some new unit tests to cover the class
2011-03-06 10:44:40 +01:00
Fabien Potencier
487cddcfee Merge remote branch 'DuoSRX/code-coverage'
* DuoSRX/code-coverage:
  [HttpFoundation] Fixed a typo in response->setLastModified()
  [HttpFoundation] Added some more tests on response
  [HttpFoundation] Added some tests on Response
  [HttpFoundation] Replace a duplicated test with a method in Response
  Fixed code coverage generation when resources folder are deeper
2011-03-06 10:44:13 +01:00
Fabien Potencier
51023eea86 [HttpFoundation] fixed CS 2011-03-06 10:39:33 +01:00
Fabien Potencier
c02ebbf2d8 Merge remote branch 'digitalkaoz/httpkernel-datacollector'
* digitalkaoz/httpkernel-datacollector:
  [HttpKernel] added Tests for DataCollectors
  [HttpFoundation] more sophisticated checks for valid expiration
2011-03-06 10:38:55 +01:00
Xavier Perez
19090d3fb7 [HttpFoundation] Fixed a typo in response->setLastModified() 2011-03-06 00:17:54 +01:00
Robert Schönthal
87e1359ebd [HttpFoundation] more sophisticated checks for valid expiration 2011-03-06 00:13:47 +01:00
Xavier Perez
0d56ca5654 [HttpFoundation] Replace a duplicated test with a method in Response 2011-03-05 14:27:35 +01:00
Robert Schönthal
58db452e21 [HttpFoundation] added a check for array keys existence. 2011-03-05 13:30:54 +01:00
Hugo Hamon
ad56bd8e47 [HttpFoundation] fix cookie path default value to / and added some new unit tests to cover the class 2011-03-03 14:50:14 +01:00
Bernhard Schussek
68013f4db2 Merge remote branch 'symfony/master' into experimental 2011-03-02 12:27:30 +01:00
Pascal Borreli
ff44b0ff28 [HttpFoundation] Removed remove recurring test 2011-03-01 18:58:07 +01:00
Fabien Potencier
cdf6851eb3 fixed merge 2011-02-27 21:16:13 +01:00
Christophe Coevoet
92bfbf575c Fixed CS 2011-02-27 20:56:29 +01:00
Pascal Borreli
fc42cc5066 [HttpFoundation] Removed useless else 2011-02-27 18:36:38 +01:00
Pascal Borreli
f7ab114d36 [HttpFoundation] Fixed missing curly brackets 2011-02-27 18:36:37 +01:00
Pascal Borreli
f3b9364eae [HttpFoundation] Fixed typo 2011-02-26 20:02:06 +01:00
Bernhard Schussek
c6e9fd97b6 [Form] Fixed various bugs 2011-02-25 00:09:10 +01:00
Bernhard Schussek
e334c4734e [Form] Registered FormFactory in the DIC 2011-02-24 21:27:44 +01:00
Bernhard Schussek
f2c1976da6 [Form] Refactored FileField to FormFactory and fixed file upload mechanism 2011-02-24 20:47:48 +01:00
Fabien Potencier
f54cedfe5e added LICENSE files for the subtree repositories 2011-02-22 18:58:15 +01:00
Kris Wallsmith
a0bae94f88 [HttpFoundation] updated ResponseHeaderBag to compute Cache-Control whenever any of the headers it considers changes 2011-02-21 19:57:05 -08:00
Fabien Potencier
353177d1d6 replaced Response::createRedirect by a new RedirectResponse class 2011-02-21 18:10:53 +01:00
Fabien Potencier
d94acd85f9 remove response as a service
The Response is not available in the DIC anymore.

When you need to create a response, create an instance of
Symfony\Component\HttpFoundation\Response instead.

As a side effect, the Controller::createResponse() and Controller::redirect()
methods have been removed and can easily be replaced as follows:

  return $this->createResponse('content', 200, array('foo' => 'bar'));
  return new Response('content', 200, array('foo' => 'bar'));

  return $this->redirect($url);
  return Response::createRedirect($url);
2011-02-21 17:36:04 +01:00
Fabien Potencier
bf20238178 fixed a bug in Response content-type auto-detection
Without this patch, if you call __toString() on a Response,
the content-type auto-detection would never be trigerred
as __toString() changes the default content-type.
2011-02-21 16:57:25 +01:00
hhamon
f985da5a9c [HttpFoundation] fix Cache-Control header when forcing the Response to have an Expires header field. The RFC2616 Bis indicates that if the Response has both max-age (or s-maxage) and Expires header field, the Cache-Control maxage wins over Expires. The previous code in ResponseHeaderBag always returned "private, max-age=0, must-revalidate" even if the Expires header field was forced.
This commit breaks functional tests in Symfony\Component\HttpKernel\HttpCache\HttpCacheTest.php. I tried to fix functional tests but I didn\'t manage to. For your information, the "try { } catch" block in the HttpKernel\HttpCache::lookup() method seems strange because I suspect line 274 to never leverage any exception...
2011-02-18 12:34:33 +01:00
Kris Wallsmith
c67a9a9643 [HttpFoundation] cleaned up some constructors 2011-02-15 21:51:44 +01:00
Jordi Boggiano
6311960511 [HttpFoundation] Minor clearCookie optimization 2011-02-14 11:15:22 +01:00
hhamon
c2e4ec44a8 [HttpFoundation] fixed phpdoc 2011-02-12 21:51:10 +01:00
Jeremy Mikola
a72145bf5f [HttpFoundation] Add array type-hint to Session::setAttributes() param 2011-02-10 00:50:07 +01:00
Sven Paulus
5d87d83a10 optimize duplication of Request objects 2011-02-09 06:59:36 +01:00
pborreli
7ad4f99153 [HttpFoundation] File/UploadedFile, MimeTest, Exception full coverage 2011-02-06 21:53:36 +01:00
pborreli
f56a6efbf5 [HttpFoundation] File/File full coverage 2011-02-05 23:24:00 +01:00
Martijn Evers
1e3dc1479c [Testing][HttpKernel] Added possibility to functional test raw body data 2011-02-04 13:07:13 +01:00
Fabien Potencier
2dfac2a881 fixed typo 2011-02-04 12:20:47 +01:00
Fabien Potencier
6ed7dc1e5a made a small optimization 2011-02-04 05:45:07 +01:00
Bernhard Schussek
22c12e2c8f [HttpFoundation] Fixed failing tests introduced in 8dd0c5641a 2011-01-31 15:38:13 +01:00
Fabien Potencier
b52e28243d [HttpFoundation] added ApacheRequest 2011-01-31 08:28:55 +01:00
Fabien Potencier
8dd0c5641a [HttpFoundation] made small optimizations 2011-01-31 08:26:40 +01:00
Victor Berchet
f470c5605e [Request] Fix getting mime type 2011-01-30 20:14:40 +01:00
Fabien Potencier
b1448ecdc7 [HttpFoundation] fixed typo 2011-01-30 20:13:00 +01:00
Fabien Potencier
ee3d03ee8a [HttpFoundation] made Request::create() overridable 2011-01-30 10:53:45 +01:00
Dominique Bongiraud
996c2b0914 [HttpFoundation] Moved licence 2011-01-29 16:12:10 +01:00
Fabien Potencier
98c1056fbf renamed Request::fromGlobals() to Request::createFromGlobals() (for consistency with the existing create() method) 2011-01-27 21:20:08 +01:00
Kris Wallsmith
224e66f77b [HttpFoundation] added static Request::fromGlobals()
The Request constructor no longer uses values from PHP's super globals. If you want a Request populated with these values you must use the new static method Request::fromGlobals().

Your front controllers (i.e. web/app.php, web/app_dev.php ...) will need to be updated:

    // old
    $kernel->handle(new Request())->send();

    // new
    $kernel->handle(Request::fromGlobals())->send();
2011-01-27 21:12:55 +01:00
Fabien Potencier
42f9c556a3 moved the class loader to its own component 2011-01-27 13:04:16 +01:00
Johannes M. Schmitt
6bbfffb981 added path, and domain to clearCookie() in accordance with RFC 2109, and RFC 2965 2011-01-25 15:58:01 +01:00
Bulat Shakirzyanov
14e4b9733d [HttpFoundation] fixed FileBag to handle sub-requests 2011-01-24 18:22:48 +01:00
Johannes Schmitt
6432dea07c adds migrate() to Session
This migrates the session to a new session id while not deleting the
actual session attributes.
2011-01-23 21:52:31 +01:00