Commit Graph

8097 Commits

Author SHA1 Message Date
Fabien Potencier
2a33fbdd16 merged branch tystr/sanitize_queries_fix (PR #3032)
Commits
-------

261325d Cast $query['params'] to array to ensure it is a valid argument for the foreach.

Discussion
----------

[DoctrineBridge] Account for $query['params'] being null in DoctrineDataCollector's sanitizeQueries method

I was getting this error because inside the sanitizeQueries method of DoctrineDataCollector, there's no handling for $query['params'] being null.

ErrorException: Warning: Invalid argument supplied for foreach() in .../vendor/symfony/src/Symfony/Bridge/Doctrine/DataCollector/DoctrineDataCollector.php line 91
2012-01-05 14:36:06 +01:00
Fabien Potencier
9d9013d662 merged branch franmomu/patch-1 (PR #3033)
Commits
-------

0ed3497 [FrameworkBundle][translations] Updated Catalan translation

Discussion
----------

[FrameworkBundle][translations] Updated Catalan translation

Added some translations

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

by stof at 2012/01/04 19:14:29 -0800

Can you send the trans-unit 41 to the 2.0 branch as it is already part of the 2.0 release (ids 42 and above are new for 2.1)

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

by franmomu at 2012/01/05 00:53:49 -0800

Of course, I didn't realize
2012-01-05 14:29:56 +01:00
Fabien Potencier
7572cfa95a merged 2.0 2012-01-05 14:29:25 +01:00
Fabien Potencier
cd07c9150a merged branch franmomu/2.0 (PR #3038)
Commits
-------

d0c54e1 [FrameworkBundle][translations] Updated Catalan translation

Discussion
----------

[FrameworkBundle][translations] Updated Catalan translation

Updated Catalan translation
2012-01-05 14:28:36 +01:00
Fran Moreno
d0c54e1856 [FrameworkBundle][translations] Updated Catalan translation 2012-01-05 10:07:52 +01:00
franmomu
0ed3497eca [FrameworkBundle][translations] Updated Catalan translation 2012-01-05 02:42:39 +01:00
Tyler Stroud
261325d33c Cast $query['params'] to array to ensure it is a valid argument for the foreach.
This prevents errors if $query['params'] is null
2012-01-04 12:23:42 -08:00
Fabien Potencier
54a8b58785 merged branch stealth35/fix_2630 (PR #3023)
Commits
-------

f4890c2 [Translation] Po/MoFileLoader parse plurization rules

Discussion
----------

[Translation] Po/MoFileLoader parse plurization rules

Bug fix: yes
Feature addition: no
Backwards compatibility break: no
Symfony2 tests pass: [![Build Status](https://secure.travis-ci.org/stealth35/symfony.png?branch=fix_2630)](http://travis-ci.org/stealth35/symfony)Fixes the following tickets: #2630
Todo: Not happy with the pluralize style

```
msgid "foo"
msgid_plural "foos"
msgstr[0] "bar"
msgstr[1] "bars"
```
to

```
array (
    'foo' => 'bar',
    'foos' => '{0} bar|{1} bars'
)
```
2012-01-04 19:14:40 +01:00
Fabien Potencier
870ab2d11e updated vendors 2012-01-04 14:49:58 +01:00
stealth35
f4890c24f9 [Translation] Po/MoFileLoader parse plurization rules 2012-01-03 18:44:44 +01:00
Fabien Potencier
42fe9fc35f updated CHANGELOG for 2.1 2012-01-03 11:18:20 +01:00
Fabien Potencier
99f65ecb82 merged branch igorw/streaming (PR #3017)
Commits
-------

7ae9348 [streaming] Document and test that Transfer-Encoding is absent
83c23ca [streaming] Do not set a Transfer-Encoding header of chunked

Discussion
----------

[HttpFoundation] Do not set a Transfer-Encoding header of chunked for streaming responses

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

This is an adjustment to the streaming introduced in #2935.

Apache expects the response to already be in chunked format when the Transfer-Encoding header is set to chunked, which causes it to not deliver the streamed body.

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

I have tested this with Apache 2.2.2 and nginx 1.0.5. Testing with other webservers is appreciated.
2012-01-02 22:10:00 +01:00
Igor Wiedler
7ae93483f9 [streaming] Document and test that Transfer-Encoding is absent 2012-01-02 20:21:31 +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
5f959e3e6f merged branch henrikbjorn/security-extension-check-path (PR #3005)
Commits
-------

c37c145 [SecurityBundle] Only throw exception if check_path looks like an url

Discussion
----------

[SecurityBundle] Only throw exception if check_path looks like an url

fixes #2954 and enables the usage of route names like you can in all other paths
2012-01-02 19:16:50 +01:00
Fabien Potencier
dcf209a4aa [DoctrineBundle] removed the bundle (migrated to the Doctrine organization) 2012-01-02 18:07:52 +01:00
Fabien Potencier
d3ab39d3b6 merged branch rouffj/propel-extension (PR #3011)
Commits
-------

20f96bd Fix CS
2f47cca [Propel1] Add a PropelExtension

Discussion
----------

[Propel1] Add a PropelExtension

The propel extension allow to use propel specific type (ModelType) outside of
Symfony2.

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

by rouffj at 2012/01/01 15:36:10 -0800

@Stof Fixed :).

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

by willdurand at 2012/01/02 07:38:22 -0800

👍
2012-01-02 17:51:14 +01:00
Fabien Potencier
ce6399e254 [TwigBridge] added a way to specify a default domain for a Twig template (via the 'trans_default_domain' tag)
Note that the tag only influences the current templates. It has no effect on included files to avoid unwanted side-effects.
2012-01-02 17:48:19 +01:00
Fabien Potencier
6a052fb788 [TwigBridge] removed obsolete file 2012-01-02 17:48:16 +01:00
Fabien Potencier
2a5758f082 [TwigBridge] allow the domain translation to be null when calling the trans and transchoice filters (to allow passing a locale without hardcoding the messages domain) 2012-01-02 17:10:27 +01:00
Fabien Potencier
7424e62d67 [TwigBridge] moved the default value for the translation domain to the Node compilation (allows to know when a domain has been provided by the user) 2012-01-02 17:09:43 +01:00
Fabien Potencier
c73e034229 [TwigBridge] added missing transchoice filters whe extracting translations from templates 2012-01-02 17:08:10 +01:00
Fabien Potencier
789d5ad20f [FrameworkBundle] allowed attributes of the render() method to be arrays 2012-01-02 16:31:32 +01:00
Fabien Potencier
cadf3d4243 [HttpKernel] fixed doubled results for the file profiler (closes #2915) 2012-01-02 12:10:17 +01:00
Fabien Potencier
254e49b47c [FrameworkBundle] removed the possibility to pass a non-scalar attributes when calling render() to make the call works with or without a reverse proxy (closes #2941) 2012-01-02 11:47:41 +01:00
Fabien Potencier
4e1499dd74 merged branch maastermedia/patch-1 (PR #3010)
Commits
-------

fae7157 slovenian validators translations correction

Discussion
----------

slovenian validators translations correction
2012-01-02 09:23:26 +01:00
Joseph Rouff
20f96bd49d Fix CS 2012-01-02 00:34:34 +01:00
Joseph Rouff
2f47ccab9c [Propel1] Add a PropelExtension
The propel extension allow to use propel specific type (ModelType) outside of
Symfony2.
2012-01-02 00:25:31 +01:00
Peter Kokot
fae715798a slovenian validators translations correction 2012-01-01 20:48:21 +01:00
Fabien Potencier
1e2d1a3406 [WebProfilerBundle] fixed some bugs 2011-12-31 16:35:58 +01:00
Fabien Potencier
66a18f3239 [BrowserKit] first attempt at fixing CookieJar (closes #2209) 2011-12-31 16:32:51 +01:00
Fabien Potencier
b46114a0f6 [WebProfilerBundle] moved the computation of the Router panel at runtime 2011-12-31 15:53:13 +01:00
Fabien Potencier
3d5ecc0478 [HttpKernel] added the path info in the request data collector 2011-12-31 15:51:33 +01:00
Fabien Potencier
e462f7b668 [Templating] simplified PhpEngine as it cannot implements the streaming interface 2011-12-31 14:50:33 +01:00
Fabien Potencier
6c6d91ed74 fixed typo 2011-12-31 10:50:19 +01:00
Fabien Potencier
716d002ef5 merged branch jmikola/MongoDbProfilerStorageTest (PR #3008)
Commits
-------

3ef0594 [HttpKernel] Fix missing $method argument in MongoDbProfilerStorageTest

Discussion
----------

[HttpKernel] Fix missing $method argument in MongoDbProfilerStorageTest

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

This test case fixes failures related to a signature change for ProfilerStorageInterface::find(). See: 1aef4e806b and 5f2226807c.

This was easily missed as the test case is skipped unless a MongoDB server is running.
2011-12-31 10:23:48 +01:00
Jeremy Mikola
3ef0594e74 [HttpKernel] Fix missing $method argument in MongoDbProfilerStorageTest
This test case fixes failures related to a signature change for ProfilerStorageInterface::find(). See: 1aef4e806b and 5f2226807c.
2011-12-31 03:10:55 -05: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
887c0e9c04 moved EngineInterface::stream() to a new StreamingEngineInterface to keep BC with 2.0 2011-12-31 08:11:20 +01:00
Henrik Bjørnskov
c37c14528e [SecurityBundle] Only throw exception if check_path looks like an url 2011-12-30 20:00:08 +01:00
Fabien Potencier
d12f5b202c [Routing] removed trailing slash support for routes that are not available for GET/HEAD methods (as the redirection will always occurs with a GET/HEAD request, closes #2626) 2011-12-30 19:30:23 +01:00
Fabien Potencier
7b00662df3 [Routing] fixed wrong namespaces in tests 2011-12-30 19:13:17 +01:00
Fabien Potencier
eef8a3c513 [FrameworkBundle] changed the implementation of Controller::getUser() to be similar to the one from GlobalVariables::getUser() 2011-12-30 16:15:28 +01:00
Fabien Potencier
a78437bba9 Revert "merged branch kriswallsmith/security/demeter-fix (PR #2816)"
This reverts commit 76ba2bc7ac, reversing
changes made to 4730f4303b.
2011-12-30 16:05:26 +01:00
Fabien Potencier
466a8b8f48 Merge branch '2.0'
* 2.0:
  [Tests] Skip segfaulting form test
  Rename test file
  [BrowserKit] added missing @return PHPDoc for the Client::submit() method.
  also test PHP 5.3.2, since this is the official lowest supported PHP version
2011-12-30 15:44:05 +01:00
Fabien Potencier
362d31d002 merged branch stloyd/skip_test (PR #3004)
Commits
-------

4c44023 [Tests] Skip segfaulting form test

Discussion
----------

[Tests] Skip segfaulting form test when using PHP <= 5.3.2

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

http://travis-ci.org/#!/stloyd/symfony/jobs/461563
2011-12-30 15:43:40 +01:00
Joseph Bielawski
4c44023e8b [Tests] Skip segfaulting form test 2011-12-30 15:36:55 +01:00
Fabien Potencier
8c4af20482 merged branch lsmith77/travis_test_5_3_2 (PR #2958)
Commits
-------

dfbed9f also test PHP 5.3.2, since this is the official lowest supported PHP version

Discussion
----------

[WIP] test with PHP 5.3.2 on travis

Bug fix: no
Feature addition: no
Backwards compatibility break: no
Symfony2 tests pass: ![Build Status](https://secure.travis-ci.org/lsmith77/symfony.png?branch=travis_test_5_3_2)
Fixes the following tickets: -

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

by lsmith77 at 2011/12/25 16:29:20 -0800

Enable testing against PHP 5.3.2, not sure why its segfaulting PHPUnit. Will check with @loicfrering whats going on there.

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

by lsmith77 at 2011/12/25 17:31:04 -0800

the issue may be inside the ClassLoader .. so we might need to increase the minimal version. but this needs to be confirmed independently.
2011-12-30 14:08:00 +01:00
Fabien Potencier
094b326bf2 merged branch hhamon/browser_kit_phpdoc (PR #2991)
Commits
-------

885fa02 [BrowserKit] added missing @return PHPDoc for the Client::submit() method.

Discussion
----------

[BrowserKit] added missing @return PHPDoc for the Client::submit() method
2011-12-30 14:07:36 +01:00
Fabien Potencier
b150fe1fdd merged branch odolbeau/2.0 (PR #2993)
Commits
-------

0d3e709 Rename test file

Discussion
----------

Just rename MessageCatalogTest in MessageCatalogueTest

This time, in the correct branch...

(see: https://github.com/symfony/symfony/pull/2987)
2011-12-30 14:02:35 +01:00