Skip to content
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

Dependency on non existent service after update to v2.2.0 #662

Open
Stoakes opened this issue Jul 4, 2018 · 8 comments
Open

Dependency on non existent service after update to v2.2.0 #662

Stoakes opened this issue Jul 4, 2018 · 8 comments
Labels

Comments

@Stoakes
Copy link

Stoakes commented Jul 4, 2018

Hi,

To begin with, thank you for this bundle, which brings me comments on pages with limited efforts.

I recently updated from FosComment 2.1.0 to 2.2.0 on a Symfony 3.4 project.

After the update, I got the error:

In CheckExceptionOnInvalidReferenceBehaviorPass.php line 31:
                                                                               
  The service "fos_comment.command.fix_aces" has a dependency on a non-existent service "security.acl.provider".   

I eventually overcomed it by running composer require symfony/security-acl and adding

# app/config/security.yml
security:
    acl:
        connection: default

Such change on a minor update is quite surprising, especially when used to Symfony lifecycle. Anyway, it might worth it to add a note on the 2.2.0 release page and/or the UPDATE.md to save some time for those who will get into the same issue.

Cheers

@XWB
Copy link
Member

XWB commented Jul 6, 2018

That's a bug. It should not happen.

@XWB XWB added the Bug label Jul 6, 2018
@XWB
Copy link
Member

XWB commented Jul 6, 2018

@Stoakes I'm not fully understanding how the commands can be loaded without having ACL installed:

https://github.com/FriendsOfSymfony/FOSCommentBundle/blob/master/DependencyInjection/FOSCommentExtension.php#L60
https://github.com/FriendsOfSymfony/FOSCommentBundle/blob/master/DependencyInjection/FOSCommentExtension.php#L139

As you can see, we only load commands.xml when ACL is enabled.

@Stoakes
Copy link
Author

Stoakes commented Jul 7, 2018

It might comes from my config which is years old.

If you want to reproduce the issue:

git clone https://github.com/n7consulting/Incipio.git
cd Incipio
git checkout v2.6.0
composer install
# dependencies update will bump Foscomment bundle to 2.2.0 and should raise the error
composer update
# Post install scripts will fail, displaying the error

Fos Comment configuration on this project

@XWB
Copy link
Member

XWB commented Jul 7, 2018

So you are using ACL, but the security.acl.provider service is not available in your project. Interesting. Can you try installing https://github.com/symfony/acl-bundle ?

@87vrvk9k
Copy link

Got same bug, install bundle doesn't work. FML

@Stoakes
Copy link
Author

Stoakes commented Jul 22, 2018

@XWB sorry for the delay,

Installing the acl-bundle doesn't fix the issue (error message doesn't change). However the fix in my first message still works.

So there is a workaround, the question is, is it a previous bug that is now fixed or the other way round ?

Don't know if you had a look to my configuration, but I was not using strict ACL, just role based ACL.

fos_comment:
    acl_roles:
        comment:
            create: ROLE_SUIVEUR
            view: ROLE_SUIVEUR
            edit: ROLE_SUIVEUR
            delete: ROLE_ADMIN
        thread:
            create: ROLE_SUIVEUR
            view: ROLE_SUIVEUR
            edit: ROLE_ADMIN
            delete: ROLE_ADMIN
        vote:
            create: ROLE_ADMIN
            view: ROLE_ADMIN
            edit: ROLE_ADMIN
            delete: ROLE_ADMIN
    acl: true
    service:
        acl:
            thread:  fos_comment.acl.thread.roles
            comment: fos_comment.acl.comment.roles
            vote:    fos_comment.acl.vote.roles
        manager:
            thread:  fos_comment.manager.thread.acl
            comment: fos_comment.manager.comment.acl
            vote:    fos_comment.manager.vote.acl

@XWB
Copy link
Member

XWB commented Jul 22, 2018

@Stoakes The package symfony/security-acl is required if you want to use ACL. Symfony has removed ACL out of the core, so perhaps that's the reason why it cannot be found anymore. Thus the package needs to be installed separately.

@kyeno
Copy link

kyeno commented Apr 17, 2019

As for now, the best approach I've found was to actually downgrade FOSCommentBundle to 2.1.* with "friendsofsymfony/comment-bundle": "2.1.*" in composer.json

That is if you still want role based security AND don't want all the junk in database that enabling acl in security.yml adds in.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

4 participants