Skip to content

[DIC] Added note on untrimmed parameters (XML) #2876

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 1 commit into from
Closed
Changes from all 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
21 changes: 21 additions & 0 deletions components/dependency_injection/parameters.rst
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,27 @@ rather than being tied up and hidden with the service definition:
->register('mailer', 'Mailer')
->addArgument('%mailer.transport%');

.. caution::

The values between ``parameter`` tags in XML configuration files are not
trimmed.

This means that the following configuration sample will have the value
``\n sendmail\n``:

.. code-block:: xml

<parameter key="mailer.transport">
sendmail
</parameter>

In some cases (for constants or class names), this could throw errors. In
order to prevent this, you must always inline your parameters as follow:

.. code-block:: xml

<parameter key="mailer.transport">sendmail</parameter>

If you were using this elsewhere as well, then you would only need to change
the parameter value in one place if needed.

Expand Down