Skip to content

Commit 0065bbb

Browse files
committed
Merge branch 'issue_1707' of github.com:joelclermont/symfony-docs into joelclermont-issue_1707
Conflicts: book/service_container.rst
2 parents 87c0536 + 7b0bfac commit 0065bbb

File tree

1 file changed

+17
-0
lines changed

1 file changed

+17
-0
lines changed

book/service_container.rst

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -227,6 +227,23 @@ The end result is exactly the same as before - the difference is only in
227227
to look for parameters with those names. When the container is built, it
228228
looks up the value of each parameter and uses it in the service definition.
229229

230+
.. note::
231+
232+
The percent sign inside a parameter or argument, as part of the string, must
233+
be escaped with another percent sign:
234+
235+
.. code-block:: xml
236+
237+
<argument type="string">http://symfony.com/?foo=%%s&bar=%%d</argument>
238+
239+
.. caution::
240+
241+
You may receive a
242+
:class:`Symfony\\Component\\DependencyInjection\\Exception\\ScopeWideningInjectionException`
243+
when passing the ``request`` service as an argument. To understand this
244+
problem better and learn how to solve it, refer to the cookbook article
245+
:doc:`/cookbook/service_container/scopes`.
246+
230247
The purpose of parameters is to feed information into services. Of course
231248
there was nothing wrong with defining the service without using any parameters.
232249
Parameters, however, have several advantages:

0 commit comments

Comments
 (0)