Skip to content

Added a note about how to enable http_method_override for caching kernels #5008

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 5 commits into from
Closed
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 17 additions & 0 deletions book/http_cache.rst
Original file line number Diff line number Diff line change
Expand Up @@ -163,6 +163,23 @@ kernel::
The caching kernel will immediately act as a reverse proxy - caching responses
from your application and returning them to the client.

..caution::
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

missing space between .. and caution


By default, the caching kernel ignores the ``framework.http_method_override``
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

caching kernel -> cached kernel

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not sure about this: cached kernel means that the kernel itself is cached. But caching kernel means that is the kernel the one who caches things. I think the second definition is more accurate. But I agree that "caching kernel" doesn't sound great.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What about: "By default, a kernel based the cache ignores the framework.http_method_override" ?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think there is some sort of typo in your last suggestion:

"By default, a kernel based the cache ignores the framework.http_method_override"

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

"a kernel based on the cache ingores [...]"

option, which could lead to errors when using ``PUT``, ``DELETE`` and ``PURGE``
methods in HTTP requests.

Invoke the ``enableHttpMethodParameterOverride()`` method before creating the
``Request`` object in order to take this option into account::

// web/app.php
// ...
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

there should be an empty line between a file comment and any other comment

$kernel = new AppCache($kernel);

Request::enableHttpMethodParameterOverride(); // <-- add this line
$request = Request::createFromGlobals();
// ...

.. tip::

The cache kernel has a special ``getLog()`` method that returns a string
Expand Down
9 changes: 6 additions & 3 deletions reference/configuration/framework.rst
Original file line number Diff line number Diff line change
Expand Up @@ -77,9 +77,12 @@ http_method_override
This determines whether the ``_method`` request parameter is used as the intended
HTTP method on POST requests. If enabled, the
:method:`Request::enableHttpMethodParameterOverride <Symfony\\Component\\HttpFoundation\\Request::enableHttpMethodParameterOverride>`
method gets called automatically. It becomes the service container parameter
named ``kernel.http_method_override``. For more information, see
:doc:`/cookbook/routing/method_parameters`.
method gets called automatically, unless the application uses a caching kernel,
where you need to invoke that method manually (see :ref:`symfony2-reverse-proxy`
for details).
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

to make my life easier, what do you think about removing this from this PR and putting it into my config reference rewrite PR?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I've removed this change ... but please don't forget to add it into your PR. Thanks.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done: b560fab


It becomes the service container parameter named ``kernel.http_method_override``.
For more information, see :doc:`/cookbook/routing/method_parameters`.

ide
~~~
Expand Down