YAML scalar with double%

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

database_password: xx% xxxxx% x

You requested a non-existent parameter "xxxxx".

I tried with

  • database_password: "xx% xxxxx% x"
  • database_password: 'xx% xxxxx% x'
  • database_password: "xx \% xxxxx \% x"

I always have the same problem

+3


source to share


1 answer


You need to avoid the 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 details .

Note: Technically, the quotes are not needed in this example, but if the %

-sign character appears at the beginning of the scalar , then the scalar must be specified.

+5


source







All Articles