user3427807
user3427807

Reputation: 31

YAML scalar with double %

I am trying to connect to a database with symfony3 but the problem is when I put the password in parameters.yml, I get this error:

database_password: xx%xxxxx%x

You have requested a non-existent parameter "xxxxx".

I tried with

I always have the same problem

Upvotes: 3

Views: 409

Answers (1)

Gerry
Gerry

Reputation: 6012

You need to escape percentage signs by putting two:

database_password: 'xx%%xxxxx%%x'

See http://symfony.com/doc/current/service_container/parameters.html#parameters-in-configuration-files for more info.

Note: technically the quotes are unnecessary in this example, but if a %-sign appears at the start of the scalar, the scalar must be quoted.

Upvotes: 5

Related Questions