0

this is my first time working a project with symfony 3.3 i installed it and everything is good , now i want to install FOSuserBundle , i followed all steps in symfony site . the last step is to :Update your database schema ( php bin/console doctrine:schema:update --force ) but i had this exception : Fatal error: Uncaught exception 'Symfony\Component\Yaml\Exception\ParseException' with message 'Indentation problem at line 34 (near " main:").' in C:\wamp64\www\untitled\vendor\symf ony\symfony\src\Symfony\Component\Yaml\Parser.php:591 Stack trace:

0 C:\wamp64\www\untitled\vendor\symfony\symfony\src\Symfony\Component\Yaml\Parser.php(320): Symfony\Component\Yaml\Parser->getNextEmbedBlock()

1 C:\wamp64\www\untitled\vendor\symfony\symfony\src\Symfony\Component\Yaml\Parser.php(450): Symfony\Component\Yaml\Parser->doParse('encoders:\n F...', 2816)

2 C:\wamp64\www\untitled\vendor\symfony\symfony\src\Symfony\Component\Yaml\Parser.php(320): Symfony\Component\Yaml\Parser->parseBlock(7, 'encoders:\n F...', 2816)

3 C:\wamp64\www\untitled\vendor\symfony\symfony\src\Symfony\Component\Yaml\Parser.php(450): Symfony\Component\Yaml\Parser->doParse('security:\n e...', 2816)

4 C:\wamp64\www\untitled\vendor\symfony\symfony\src\Symfony\Component\Yaml\Parser.php(320): Symfony\Component\Yaml\Parser->parseBlock(6, 'security:\n e in C:\wamp64\www\untitled\

vendor\symfony\symfony\src\Symfony\Component\Config\Loader\FileLoader.php on line 179

this is my ..app/config/security.yml

security:

# https://symfony.com/doc/current/security.html#b-configuring-how-users-are-loaded

security: encoders: FOS\UserBundle\Model\UserInterface: bcrypt

   role_hierarchy:
       ROLE_ADMIN:       ROLE_USER
       ROLE_SUPER_ADMIN: ROLE_ADMIN

   providers:
       fos_userbundle:
           id: fos_user.user_provider.username

   firewalls:
       main:
           pattern: ^/
           form_login:
               provider: fos_userbundle
               csrf_provider: security.csrf.token_manager # Use form.csrf_provider instead for Symfony <2.4
           logout:       true
           anonymous:    true

   access_control:
       - { path: ^/login$, role: IS_AUTHENTICATED_ANONYMOUSLY }
       - { path: ^/register, role: IS_AUTHENTICATED_ANONYMOUSLY }
       - { path: ^/resetting, role: IS_AUTHENTICATED_ANONYMOUSLY }
       - { path: ^/admin/, role: ROLE_ADMIN }

    main:
        anonymous: ~
        # activate different ways to authenticate

        # https://symfony.com/doc/current/security.html#a-configuring-how-your-users-will-authenticate
        #http_basic: ~

        # https://symfony.com/doc/current/security/form_login_setup.html
        #form_login: ~

please help me thanks :)

3
  • Post your .../app/config/security.yml Commented Jul 9, 2017 at 17:07
  • i added it in my post Commented Jul 9, 2017 at 17:24
  • if this is a direct copy paste of your security.yml file, then role_hierarchy, providers, firewalls, access_control, main, seem to be only 3 spaces indented instead of 4. Commented Jul 9, 2017 at 23:29

1 Answer 1

0

This is really tough to notice, but...

There is an extra space before the main: that appears after the access_control: block. Remove the space and you should be good to go.

I found this by copying your file into Netbeans IDE. It's pretty good at identifying YAML file errors.

Good luck.

Sign up to request clarification or add additional context in comments.

1 Comment

Same error message? If you continue to get YAML parse errors try creating your project in Netbeans and use it to view your YAML files. Symfony YAML files are quite strict about spaces and such.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.