8000 YML error escaping @ as initial value's char · Issue #4889 · symfony/symfony · GitHub
[go: up one dir, main page]

Skip to content

YML error escaping @ as initial value's char #4889

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
vittore opened this issue Jul 13, 2012 · 4 comments
Closed

YML error escaping @ as initial value's char #4889

vittore opened this issue Jul 13, 2012 · 4 comments

Comments

@vittore
Copy link
vittore commented Jul 13, 2012

If char '@' is first character of a yml value escaping fail.

Example:

parameters:
    ad_ldap:
       account_suffix: mydomain.com
       base_dn: "@DC=mydomain.com"
       domain_controllers: 
          - 100.100.176.123
       real_primarygroup: true

I thinks it's related to #173

@fabpot
Copy link
Member
fabpot commented Jul 13, 2012

I've just tried and here is what I have with Symfony master:

Array
(
    [parameters] => Array
        (
            [ad_ldap] => Array
                (
                    [account_suffix] => mydomain.com
                    [base_dn] => @DC=mydomain.com
                    [domain_controllers] => Array
                        (
                            [0] => 100.100.176.123
                        )

                    [real_primarygroup] => 1
                )

        )

)

which looks good to me.

@vittore
Copy link
Author
vittore commented Jul 13, 2012

In sf 2.0.16 i get:

InvalidArgumentException: You cannot dump a container with parameters that contain references to other services (reference to service "dc=mydomain.com" found in "/ad_ldap/base_dn").
in vendor/symfony/src/Symfony/Component/DependencyInjection/Dumper/PhpDumper.php line 817
at PhpDumper->exportParameters() in vendor/symfony/src/Symfony/Component/DependencyInjection/Dumper/PhpDumper.php line 811
at PhpDumper->exportParameters() in vendor/symfony/src/Symfony/Component/DependencyInjection/Dumper/PhpDumper.php line 730
at PhpDumper->addDefaultParametersMethod() in vendor/symfony/src/Symfony/Component/DependencyInjection/Dumper/PhpDumper.php line 94
at PhpDumper->dump() in app/bootstrap.php.cache line 881
at Kernel->dumpContainer() in app/bootstrap.php.cache line 784
at Kernel->initializeContainer() in app/bootstrap.php.cache line 517
at Kernel->boot() in app/bootstrap.php.cache line 548
at Kernel->handle() in web/app_dev.php line 26

@tPl0ch
Copy link
tPl0ch commented Mar 7, 2013

I get a different error with current Symfony 2.2.0:

app/config/arameters.yml

parameters:
    database_driver:   pdo_mysql
    database_host:     127.0.0.1
    database_port:     ~
    database_name:     symfony2
    database_user:     symfonyuser
    database_password: symfonypass

    mailer_transport:  smtp
    mailer_host:       mail.example.com
    mailer_user:       user
    mailer_password:   "@S3cUr3!!Pa$s"

    locale:            de
    secret:            ThisIsWowTokenMoFo

error message:

InvalidTypeException: Invalid type for path "swiftmailer.password". Expected scalar, but got object.
in /vagrant/projects/myproject/vendor/symfony/symfony/src/Symfony/Component/Config/Definition/ScalarNode.php line 37
at ScalarNode->validateType(object(Reference)) in /vagrant/projects/myproject/vendor/symfony/symfony/src/Symfony/Component/Config/Definition/BaseNode.php line 265
at BaseNode->normalize(object(Reference)) in /vagrant/projects/myproject/vendor/symfony/symfony/src/Symfony/Component/Config/Definition/ArrayNode.php line 308
at ArrayNode->normalizeValue(array('transport' => 'smtp', 'host' => 'mail.example.com', 'username' => 'user', 'password' => object(Reference), 'spool' => array('type' => 'memory'))) in /vagrant/projects/myproject/vendor/symfony/symfony/src/Symfony/Component/Config/Definition/BaseNode.php line 268
at BaseNode->normalize(array('transport' => 'smtp', 'host' => 'mail.example.com', 'username' => 'user', 'password' => object(Reference), 'spool' => array('type' => 'memory'))) in /vagrant/projects/myproject/vendor/symfony/symfony/src/Symfony/Component/Config/Definition/Processor.php line 33
at Processor->process(object(ArrayNode), array(array('transport' => 'smtp', 'host' => 'mail.example.com', 'username' => 'user', 'password' => object(Reference), 'spool' => array('type' => 'memory')))) in /vagrant/projects/myproject/vendor/symfony/symfony/src/Symfony/Component/Config/Definition/Processor.php line 50
at Processor->processConfiguration(object(Configuration), array(array('transport' => 'smtp', 'host' => 'mail.example.com', 'username' => 'user', 'password' => object(Reference), 'spool' => array('type' => 'memory')))) in /vagrant/projects/myproject/vendor/symfony/symfony/src/Symfony/Component/DependencyInjection/Extension/Extension.php line 107
at Extension->processConfiguration(object(Configuration), array(array('transport' => 'smtp', 'host' => 'mail.example.com', 'username' => 'user', 'password' => object(Reference), 'spool' => array('type' => 'memory')))) in /vagrant/projects/myproject/vendor/symfony/swiftmailer-bundle/Symfony/Bundle/SwiftmailerBundle/DependencyInjection/SwiftmailerExtension.php line 47
at SwiftmailerExtension->load(array(array('transport' => 'smtp', 'host' => 'mail.example.com', 'username' => 'user', 'password' => object(Reference), 'spool' => array('type' => 'memory'))), object(ContainerBuilder)) in /vagrant/projects/myproject/vendor/symfony/symfony/src/Symfony/Component/DependencyInjection/Compiler/MergeExtensionConfigurationPass.php line 50
at MergeExtensionConfigurationPass->process(object(ContainerBuilder)) in /vagrant/projects/myproject/vendor/symfony/symfony/src/Symfony/Component/HttpKernel/DependencyInjection/MergeExtensionConfigurationPass.php line 39
at MergeExtensionConfigurationPass->process(object(ContainerBuilder)) in /vagrant/projects/myproject/vendor/symfony/symfony/src/Symfony/Component/DependencyInjection/Compiler/Compiler.php line 119
at Compiler->compile(object(ContainerBuilder)) in /vagrant/projects/myproject/vendor/symfony/symfony/src/Symfony/Component/DependencyInjection/ContainerBuilder.php line 553
at ContainerBuilder->compile() in /vagrant/projects/myproject/app/bootstrap.php.cache line 657
at Kernel->buildContainer() in /vagrant/projects/myproject/app/bootstrap.php.cache line 593
at Kernel->initializeContainer() in /vagrant/projects/myproject/app/bootstrap.php.cache line 378
at Kernel->boot() in /vagrant/projects/myproject/app/bootstrap.php.cache line 409
at Kernel->handle(object(Request)) in /vagrant/projects/myproject/web/app_dev.php line 26

fabpot added a commit that referenced this issue Mar 23, 2013
This PR was submitted for the master branch but it was merged into the 2.1 branch instead (closes #7357).

Discussion
----------

[DependencyInjection] Added @@ escaping strategy for YamlFileLoader and YamlDumper

Added the possibility to to use ```@@``` as an escaping strategy for
parameters that should be treated as strings but start with ```@```
(i.e. safe mailer passwords).

This PR is deprecating #7307, since as a new feature it has to be compared against the master branch.

| Q | A |
| ------ | ------ |
|  Bug fix?  |  yes  |
|  New feature?  |  yes  |
|  BC breaks?  |  no  |
|  Deprecations?  |  no  |
|  Tests pass?  |  yes  |
|  Fixed tickets  |  #4889  |

Commits
-------

8cdf387 [DependencyInjection] Added '@@' escaping strategy for YamlFileLoader and YamlDumper
@wouterj
Copy link
Member
wouterj commented Mar 24, 2013

@fabpot this should get closed as #7357 is merged.

@fabpot fabpot closed this as completed Mar 24, 2013
77web pushed a commit to 77web/symfony-docs that referenced this issue Nov 23, 2013
This PR deprecates symfony#2286

| Q             | A
| ------------- | ---
| Doc fix?      | no
| New docs?     | yes symfony/symfony#7357
| Applies to    | 2.1
| Fixed tickets | symfony/symfony#4889
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants
0