Symfony framework.yaml 无效的 YAML - 但事实并非如此?

Symfony framework.yaml invalid YAML - but it's not?

我开始收到此错误...不确定原因或方式?

这里是 framework.yaml:

security:
    # https://symfony.com/doc/current/security.html#where-do-users-come-from-user-providers
    providers:
        ad_ldap:
            ldap:
                service: Symfony\Component\Ldap\Ldap
                base_dn: dc=mydomain,dc=local
                search_dn: 'appuser'
                search_password: "xxx"
                default_roles: ROLE_USER
                uid_key: 'sAMAccountName'
                filter: '({uid_key}={username})'        
        

给我这个错误:

In FileLoader.php line 180: The file "/vagrant/project/config/packages/security.yaml" does not contain valid YAML: Unexpected characters near "rname})' " at line 12 (near "filter: '({uid_key}={us ername})' ") in /vagrant/project/config/packages/security.yaml (which is loaded in resource "/vagrant/project/config/packages/security.yaml").

In YamlFileLoader.php line 693: The file "/vagrant/project/config/packages/security.yaml" does not contain valid YAML: Unexpected characters near "rname})' " at line 12 (near "filter: '({uid_key}={us ername})' ").

In Parser.php line 760: Unexpected characters near "rname})' " at line 12 (near "filter: '({uid_key}={username})' ").

参见:https://symfony.com/doc/current/components/yaml/yaml_format.html#strings

部分:

Strings containing any of the following characters must be quoted. Although you can use double quotes, for these characters it is more convenient to use single quotes, which avoids having to escape any backslash :

    :, {, }, [, ], ,, &, *, #, ?, |, -, <, >, =, !, %, @, `

你能试试把所有的字符串都引用进去吗? (使用单引号)

还有,哪个 Symfony 版本?

该问题是 symfony 的供应商问题,已得到纠正,但在撰写本文时尚未发布。

https://github.com/symfony/symfony/issues/39229