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

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

wants to merge 1 commit into from

Conversation

gnugat
Copy link

@gnugat gnugat commented Aug 4, 2013

In XML configuration, the value betweenparameter tags isn't trimmed,
which can lead to unexpected behavior.

See symfony/symfony#8661

@@ -97,6 +97,21 @@ rather than being tied up and hidden with the service definition:
->register('mailer', 'Mailer')
->addArgument('%mailer.transport%');

.. note::
Copy link
Member

Choose a reason for hiding this comment

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

i prefer a caution directive

Copy link
Author

Choose a reason for hiding this comment

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

Done :) .

@wouterj
Copy link
Member

wouterj commented Aug 5, 2013

Whoa, that's quick! 🚀

👍

@wouterj
Copy link
Member

wouterj commented Aug 7, 2013

This should be placed somewhere below, where we talk about constants as parameters

@stof
Copy link
Member

stof commented Aug 7, 2013

@wouterj It is true for all parameters, not only for constants (it can hurt you for class names too for instance)

@gnugat
Copy link
Author

gnugat commented Aug 7, 2013

@wouterj like @stof said it is true for every type of parameters. But maybe I hould change the example to make it clearer?

Perhaps I should add a classname parameter?

@wouterj
Copy link
Member

wouterj commented Aug 7, 2013

Well, make it indeed easier to understand. What about taking the mailer example? Setting mailer.transport to phpmail.

And after that, can you please squash your commits (if you know how to do that)?

@gnugat
Copy link
Author

gnugat commented Aug 8, 2013

Done, I added the exact value of the retrieved parameter, so we can see the line returns and spaces, and I also added a note on constants and class names which can throw exceptions.
The commits have been squashed into one.

trimmed.

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

Choose a reason for hiding this comment

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

you must use double backticks

Copy link
Author

Choose a reason for hiding this comment

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

Done, and squashed :)

In XML configuration, the value between` parameter` tags isn't trimmed,
which can lead to unexpected behavior.

See symfony/symfony#8661
@weaverryan
Copy link
Member

👍 great note Loïc (and a clean PR)! I've patched this into the 2.2 branch at sha: 1b707dd

Thanks!

@weaverryan weaverryan closed this Aug 25, 2013
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants