Commit Graph

1106 Commits

Author SHA1 Message Date
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
Bulat Shakirzyanov
271e757f27 [HttFoundation] extracted FileBag, ServerBag, fixed HeaderBag::add(), updated Request test 2011-01-23 07:40:31 +01:00
Johannes M. Schmitt
507da2a1ab some performance tweaks
This adds lazy loading for firewall configurations. This is useful when you have multiple firewalls, only the firewalls which are actually needed to process the Request are initialized. So, your event dispatcher is not as costly to initialize anymore.

It also implements re-using of RequestMatchers if all matching rules are the same, and exposes the remaining rules which are already implemented by the request matcher (host, ip, methods) in the access-control section
2011-01-21 11:57:43 +01:00
Ryan Weaver
17f9162b89 [Standards] Changing many instances of "boolean" to "Boolean". 2011-01-21 09:53:24 +01:00
Fabien Potencier
24ff22af07 [HttpFoundation] added a directory fallback for when the class is not found in registered namespaces and class prefixes 2011-01-20 10:20:14 +01:00
Jordi Boggiano
afbf6bfdc7 Added missing HTTP status code 418 2011-01-19 07:21:06 +01:00
Dominique Bongiraud
64fb94c725 normalized license messages in PHP files 2011-01-18 08:07:46 +01:00
Johannes M. Schmitt
98b52b607c better support for cookie handling, use native PHP function to set cookies 2011-01-15 20:47:29 +01:00
hhamon
e2dc7f47cb [HttpFoundation] use pathinfo() native function to determine file extension. Change File::move() and UploadedFile::move() methods to accept a second argument allowing to move the file with a new name instead of moving it with its original name. 2011-01-15 15:44:50 +01:00
Bulat Shakirzyanov
d6b57bce33 [HttpFoundation] fixed error casting broken in DomCrawler\Form::getPhpFiles() 2011-01-10 18:57:55 +01:00
Ryan Weaver
09a876beb9 [HttpFoundation] Adding a few internal notes to clarify the process of setting the cache-control to a default. 2011-01-09 20:00:19 +01:00
Ryan Weaver
99a509708b [HttpFoundation] Correcting the PHPDoc for the public $headers property on Response. 2011-01-09 20:00:14 +01:00
Justin Hileman
cfd4e2186f Fix UniversalClassLoader matching collisions.
The current `loadClass()` implementation tries to load a class from the first matching prefix then stops, producing false-negative results. This is especially evident in groups of related libraries, such as Doctrine:

    Doctrine
    Doctrine\Common
    Doctrine\Common\DataFixtures
    Doctrine\DBAL
    Doctrine\DBAL\Migrations

Each of these libraries is submoduled into a different vendor directory. Depending on what order these libraries are added to a UniversalClassLoader instance, classes may or may not actually be loaded. This fix continues searching registered namespaces and prefixes if the first partial match is negative.
2011-01-06 18:05:57 +01:00
Jordi Boggiano
584769dd16 [HttpFoundation] Added removeFlash & clearFlashes methods to the Session 2011-01-05 22:50:03 +01:00
Bernhard Schussek
48af2fc86e [Form][FrameworkBundle][HttpFoundation] The session is now automatically started when a form is CSRF protected 2011-01-03 22:07:04 +01:00
Bernhard Schussek
8513082007 [Form][HttpFoundation] Improved File and UploadedFile class 2011-01-03 22:06:56 +01:00
Fabien Potencier
49a3e52fa8 [HttpFoundation] changed the default name of the session to _SESS as using _SESSION does not seem to work with PHP 5.3.3 (the session starts for each request) 2010-12-31 10:53:18 +01:00
Bulat Shakirzyanov
f8a88e822f [HttpFoundation] added ArraySessionStorage for usage in tests 2010-12-23 08:30:44 +01:00
Jordi Boggiano
3d9b13f240 CS: Unified non-strict equality comparisons, put var on the right side 2010-12-21 08:51:27 +01:00
Jordi Boggiano
4f46235ab0 [HttpFoundation] Send proper charset along with the default text/html header 2010-12-16 10:23:53 +01:00
Jordi Boggiano
583340db7b [HttpFoundation] Added a way to grab the request body as a resource 2010-12-13 07:55:40 +01:00
Jordi Boggiano
9fef10f67d [HttpFoundation] Fixed indenting 2010-12-13 07:53:09 +01:00
jeff
e6d0385778 [HttpFoundation] fixed Request::create() when using HTTPS and getUri()/getPathForUri() when script name should be removed.
Original explanation from pull request:

I'm Using symfony2 with URL Rewriting to 'hide' index.php.
On form authentication, symfony2 redirect to http://host:port/index.php/login_path instead of http://host:port/login_path. I do understand that, in my case, redirect is set into one of :
FormAuthenticationEntryPoint with getUriForPath()
FormAuthenticationListener with getUriForPath()
Security/Firewal/ExceptionListener with getUri()

This path modify getUri and getUriForPath to :
remove default port from URI
remove script name if not initially present
2010-12-12 14:08:35 +01:00
Fabien Potencier
a7c81577c7 [HttpFoundation] added a way to retrieve raw body from a request 2010-12-12 09:05:03 +01:00
Jordi Boggiano
fb41389999 [HttpFoundation] Fixed Request::create handling of full URIs 2010-12-08 07:52:33 +01:00
Jordi Boggiano
f6bc712028 [HttpFoundation] Always force the request method to full caps 2010-12-08 07:28:18 +01:00
Fabien Potencier
e8672740c7 [HttpFoundation] allowed any HTTP method for a Request 2010-12-08 07:24:37 +01:00
Jordi Boggiano
a832885960 [HttpFoundation] Fixed default netmask to be restricted to one IP 2010-12-06 18:32:39 +01:00
Justin Hileman
112fb5ad99 Fix Request::overrideGlobals $_COOKIE global var reference. 2010-12-06 08:12:40 +01:00
Jordi Boggiano
cc05b09a29 [HttpFoundation] Standardize flash messages api 2010-11-26 14:44:39 +01:00
Fabien Potencier
944d91c1df made some method name changes to have a better coherence throughout the framework
When an object has a "main" many relation with related "things" (objects,
parameters, ...), the method names are normalized:

 * get()
 * set()
 * all()
 * replace()
 * remove()
 * clear()
 * isEmpty()
 * add()
 * register()
 * count()
 * keys()

The classes below follow this method naming convention:

 * BrowserKit\CookieJar -> Cookie
 * BrowserKit\History -> Request
 * Console\Application -> Command
 * Console\Application\Helper\HelperSet -> HelperInterface
 * DependencyInjection\Container -> services
 * DependencyInjection\ContainerBuilder -> services
 * DependencyInjection\ParameterBag\ParameterBag -> parameters
 * DependencyInjection\ParameterBag\FrozenParameterBag -> parameters
 * DomCrawler\Form -> FormField
 * EventDispatcher\Event -> parameters
 * Form\FieldGroup -> Field
 * HttpFoundation\HeaderBag -> headers
 * HttpFoundation\ParameterBag -> parameters
 * HttpFoundation\Session -> attributes
 * HttpKernel\Profiler\Profiler -> DataCollectorInterface
 * Routing\RouteCollection -> Route
 * Security\Authentication\AuthenticationProviderManager -> AuthenticationProviderInterface
 * Templating\Engine -> HelperInterface
 * Translation\MessageCatalogue -> messages

The usage of these methods are only allowed when it is clear that there is a
main relation:

 * a CookieJar has many Cookies;

 * a Container has many services and many parameters (as services is the main
   relation, we use the naming convention for this relation);

 * a Console Input has many arguments and many options. There is no "main"
   relation, and so the naming convention does not apply.

For many relations where the convention does not apply, the following methods
must be used instead (where XXX is the name of the related thing):

 * get()      -> getXXX()
 * set()      -> setXXX()
 * all()      -> getXXXs()
 * replace()  -> setXXXs()
 * remove()   -> removeXXX()
 * clear()    -> clearXXX()
 * isEmpty()  -> isEmptyXXX()
 * add()      -> addXXX()
 * register() -> registerXXX()
 * count()    -> countXXX()
 * keys()
2010-11-25 17:30:06 +01:00
Bernhard Schussek
d95d33666d [HttpFoundation] Fixed class Request to convert empty files to NULL 2010-11-23 06:51:17 +01:00
Dominique Bongiraud
73daccd6c3 [HttpFoundation] Fixed coding style, fixed wrong parameter method, added omitted split ip and added upper limit to the netmask ip 2010-11-22 22:28:21 +01:00
ornicar
faf0182be0 [HttpFoundation] Rename HeaderBag::validateCookieName to HeaderBag::validateCookie 2010-11-21 15:24:52 +01:00
Fabien Potencier
b6923dd7b9 changed Cache-Control default value behavior
The PHP native cache limiter feature has been disabled as this is now managed
by the HeaderBag class directly instead (see below.)

The HeaderBag class uses the following rules to define a sensible and
convervative default value for the Response 'Cache-Control' header:

 * If no cache header is defined ('Cache-Control', 'ETag', 'Last-Modified',
   and 'Expires'), 'Cache-Control' is set to 'no-cache';

 * If 'Cache-Control' is empty, its value is set to "private, max-age=0,
   must-revalidate";

 * But if at least one 'Cache-Control' directive is set, and no 'public' or
   'private' directives have been explicitely added, Symfony2 adds the
   'private' directive automatically (except when 's-maxage' is set.)

So, remember to explicitly add the 'public' directive to 'Cache-Control' when
you want shared caches to store your application resources:

    // The Response is private by default
    $response->setEtag($etag);
    $response->setLastModified($date);
    $response->setMaxAge(10);

    // Change the Response to be public
    $response->setPublic();

    // Set cache settings in one call
    $response->setCache(array(
        'etag'          => $etag,
        'last_modified' => $date,
        'max_age'       => 10,
        'public'        => true,
    ));
2010-11-18 17:05:05 +01:00
Jordi Boggiano
e69c5ae860 Coding style fixes 2010-11-18 07:00:03 +01:00
Fabien Potencier
a45baed812 [HttpFoundation] removed optimization for setLocale() as it breaks when locale is not the default and the user wants to switch back to the default locale 2010-11-15 09:50:01 +01:00
Ryan Weaver
58a240baba [HttpFoundation] Allow the SERVER_PORT key of the server ParameterBag in Request to be a string value without confusing Request::getHttpHost().
The idea of a string port is probably semantically wrong, but it actually follows the convention of at least some web servers ($_SERVER['SERVER_PORT'] is actually a string). And since the $port variable is used as a string in getHttpHost(), it's correct to allow the types not to match.
2010-11-15 09:45:59 +01:00
Ryan Weaver
81272b22fa [HttpFoundation] Adding PHPDoc to the Request class and removing two unused variables. 2010-11-13 16:03:57 +01:00
Fabien Potencier
98f3ac65f4 fixed configuration bugs 2010-11-12 20:11:22 +01:00
Fabien Potencier
7257571be4 [HttpFoundation] added missing code for last commit 2010-11-12 19:49:01 +01:00
Fabien Potencier
942104a5ff [HttpFoundation] added a setCache() method to ease setting the HTTP cache headers in one simple call 2010-11-12 19:46:39 +01:00
Fabien Potencier
f669674293 [HttpFoundation] added a missing phpdoc 2010-11-12 19:46:22 +01:00
Fabien Potencier
f6ddeeb36b [HttpFoundation] added Response::setPublic() and changed setPrivate() to not take any argument 2010-11-12 19:45:28 +01:00
Fabien Potencier
51a3d0ba6a refactored session configuration
The configuration names have been changed to avoid confusion (user was
ambiguous)

    Before:
          <app:user default_locale="fr">
              <app:session name="SYMFONY" type="Native" lifetime="3600" />
          </app:user>

    After:
          <app:session default_locale="fr" name="SYMFONY" storage_id="native" lifetime="3600" />
2010-11-10 10:47:03 +01:00
Fabien Potencier
7b02766373 fixed session management
Some explanations on how it works now:

 * The Session is an optional dependency of the Request. If you create the
   Request yourself (which is mandatory now in the front controller) and if
   you don't inject a Session yourself (which is recommended if you want the
   session to be configured via dependency injection), the Symfony2 Kernel
   will associate the Session configured in the Container with the Request
   automatically.

 * When duplicating a request, the session is shared between the parent and
   the child (that's because duplicated requests are sub-requests of the main
   one most of the time.) Notice that when you use ::create(), the behavior is
   the same as for the constructor; no session is attached to the Request.

 * Symfony2 tries hard to not create a session cookie when it is not needed
   but a Session object is always available (the cookie is only created when
   "something" is stored in the session.)

 * Symfony2 only starts a session when:

   * A session already exists in the request ($_COOKIE[session_name()] is
     defined -- this is done by RequestListener);

   * There is something written in the session object (the cookie will be sent
     to the Client).

 * Notice that reading from the session does not start the session anymore (as
   we don't need to start a new session to get the default values, and because
   if a session exists, it has already been started by RequestListener.)
2010-11-09 22:34:48 +01:00
Johannes Schmitt
6aacfa3216 fixes a bug where in most cases cookies with path / were not set properly 2010-11-03 18:33:50 +01:00
Fabien Potencier
dd9b77ed96 [HttpFoundation] added Response::setVary() 2010-10-30 21:02:05 +02:00
jeff
ae888b80f6 [HttpFoundation] removed port number from HOST header
To be consistent with backup values (SERVER_NAME, SERVER_ADDR).
fix a problem with getUriForPath($path) where port number may be present twice.
2010-10-28 15:14:48 +02:00
jeff
a5d4acc54d [HttpFoundation] updated get() signature to get($key, $default = null, $first = true)
This is more consistent with the get() method of ParameterBag
2010-10-28 15:12:48 +02:00
Fabien Potencier
c448429e62 [HttpFoundation] fixed date format for HTTP headers (format must be RFC1123, not RFC2822 -- the difference is that RFC1123 dates always use GMT for the timezone) 2010-10-27 10:56:56 +02:00
Bernhard Schussek
e9fcacdad7 [HttpFoundation] Fixed: File/UploadedFile did not adjust path when moved 2010-10-22 08:30:14 +02:00
Justin Hileman
0ccc9805f5 Fix UniversalClassLoader issues with leading slashes.
This fixes a bug in UniversalClassLoader when attempting to autoload class names with leading slashes:

    $namespacedClass = "\\Foo\\Bar";
    $pearlikeClass   = "\\Foo_Bar";

    $namespaced = new $namespacedClass();
    $pearlike   = new $pearlikeClass();

`UniversalClassLoader::loadClass()` was unable to load PEAR-like classes with leading slashes because it found the slash and assumed that the requested class was namespaced. It was unable to load namespaced classes with leading slashes because it would look them up in the autoloader's registered namespaces, and was unable to match '\Foo' to 'Foo'. One (ugly) workaround for the namespaced classes was to register all namespaces twice:

    $loader->registerNamespaces(array(
        'Foo'  => __DIR__ . '/lib',
        '\Foo' => __DIR__ . '/lib',
    ));

But that's not very pretty, nor does it solve the bug with PEAR-like classes. Stripping the leading slash before trying to autoload allows UniversalClassLoader to load both namespaced and PEAR-like classes.
2010-10-20 14:20:12 +02:00
Fabien Potencier
0fc6b15c17 [HttpFoundation] added a way to clear the session attributes 2010-10-19 13:13:20 +02:00
Fabien Potencier
94347f73c5 [HttpFoundation] added a way to generate a URI based on the current one and a path 2010-10-19 13:13:14 +02:00
Kris Wallsmith
f79e23ffb5 Removed all those spaces after @author that were bothering me so… 2010-10-18 16:55:41 +02:00
Kris Wallsmith
0b1f3145ae Removed unnecessary "public" from interface method signatures. 2010-10-18 16:55:09 +02:00
pborreli
86cc6a11d9 [Component] Fixed some spelling typos 2010-10-17 07:51:50 +02:00
Fabien Potencier
2a9ddee162 [HttpFoundation] added Session::invalidate() 2010-10-12 08:58:12 +02:00
Fabien Potencier
fafcd02684 [HttpFoundation] changed RequestMatcher pattern syntax 2010-10-07 19:12:53 +02:00
Fabien Potencier
caa9d82746 [HttpFoundation] added support for attributes in RequestMatcher 2010-10-05 20:20:28 +02:00
Jordi Boggiano
d28b9ddcda [HttpFoundation] Fix session::remove() not initializing the session 2010-09-30 07:17:44 +02:00
Fabien Potencier
d657adbfa2 removed Symfony\Framework
Things have been moved to Symfony\Component\HttpKernel
and Symfony\Bundle\FrameworkBundle

The kernel configuration namespace was removed and merged
with the main web configuration namespace (kernel:config => web:config,
kernel:test => web:test, and kernel:session => web:session):

Before:
<kernel:config charset="UTF-8" error_handler="null" />

<web:config csrf-secret="xxxxxxxxxx">
    <web:router resource="%kernel.root_dir%/config/routing.xml" />
    <web:validation enabled="true" annotations="true" />
</web:config>

After:
<web:config csrf-secret="xxxxxxxxxx" charset="UTF-8" error-handler="null">
    <web:router resource="%kernel.root_dir%/config/routing.xml" />
    <web:validation enabled="true" annotations="true" />
</web:config>

Renamed classes:

Symfony\{Framework => Bundle\FrameworkBundle}\Cache\Cache
Symfony\{Framework => Bundle\FrameworkBundle}\Client
Symfony\{Framework => Bundle\FrameworkBundle}\Debug\EventDispatcher
Symfony\{Framework => Bundle\FrameworkBundle}\Debug\EventDispatcherTraceableInterface
Symfony\{Framework => Bundle\FrameworkBundle}\EventDispatcher
Symfony\{Framework => Component\HttpFoundation}\UniversalClassLoader
Symfony\{Framework => Component\HttpKernel}\Bundle\Bundle
Symfony\{Framework => Component\HttpKernel}\Bundle\BundleInterface
Symfony\{Framework => Component\HttpKernel}\ClassCollectionLoader
Symfony\{Framework => Component\HttpKernel}\Debug\ErrorException
Symfony\{Framework => Component\HttpKernel}\Debug\ErrorHandler
Symfony\{Bundle\FrameworkBundle => Component\HttpKernel}\Debug\ExceptionListener
Symfony\{Framework => Component\HttpKernel}\Kernel
2010-09-17 12:58:24 +02:00
Antoine Hérault
7bd76610ca [HttpFoundation] fixed request files handling 2010-09-10 12:34:28 +02:00
Fabien Potencier
a141c98917 [HttpFoundation] moved File Component into the HttpFoundation one 2010-09-09 17:01:48 +02:00
Kris Wallsmith
1443d4a0ba [HttpFoundation] updated getQueryString() to work in more scenarios 2010-09-06 08:48:11 +02:00
Fabien Potencier
4f337615e3 [HttpFoundation] added request matcher 2010-09-02 13:39:49 +02:00
Fabien Potencier
15cd2643c0 [HttpFoundation] added Request::getClientIp() 2010-09-01 13:56:20 +02:00
Fabien Potencier
3e24cef256 [HttpFoundation] fixed Request::hasSession() 2010-09-01 11:18:07 +02:00
ornicar
9588860716 [HttpFoundation] fixed locale accessors in Session class 2010-08-30 07:12:05 +02:00
Fabien Potencier
ed33ce4d5f [HttpFoundation] fixed typo 2010-08-29 20:28:33 +02:00
Fabien Potencier
92f4b92cbb [HttpFoundation] fixed Session serialization 2010-08-27 09:07:47 +02:00
Fabien Potencier
086708003a [HttpFoundation] added a keys() method to *Bag classes 2010-08-26 10:56:46 +02:00
Fabien Potencier
ec8500bd64 [FrameworkBundle] added support for previous exceptions in the exception pages 2010-08-24 14:01:57 +02:00
Fabien Potencier
1277568997 [HttpFoundation] fixed Session 2010-08-22 15:31:51 +02:00
Fabien Potencier
2746bcc84c [HttpFoundation] added automatic session start() when changing something in the session, renamed accessor methods, added remove()/has() methods 2010-08-20 23:21:39 +02:00
Fabien Potencier
bf82cf42dd renamed Symfony\Components to Symfony\Component 2010-08-20 23:09:55 +02:00