Thanks to visit codestin.com
Credit goes to github.com

Skip to content

[SecurityBundle] Class name parameter is not yet resolved in AddSecurityVotersPass #23733

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

Closed
pjarmalavicius opened this issue Aug 1, 2017 · 7 comments

Comments

@pjarmalavicius
Copy link
Contributor

Q A
Bug report? yes
Feature request? no
BC Break report? no
RFC? no
Symfony version 3.4

When voter service class is parameter, it is not yet resolved while checking if it implements VoterInterface.
Maybe type of AddSecurityVotersPass should be "optimization"?

@linaori
Copy link
Contributor

linaori commented Aug 3, 2017

The compiler pass itself isn't an optimization pass though. I'm more curious as of why your service definition's class is a parameter reference and not a class name.

@pjarmalavicius
Copy link
Contributor Author

Actually I got this error in in third party bundle. But still if it's possible to define class name as parameter then Compiler pass should handle that.

@linaori
Copy link
Contributor

linaori commented Aug 3, 2017

If this feature is supported, it should probably be done as one of the first things, before all the other compiler passes run.

@chalasr
Copy link
Member

chalasr commented Aug 3, 2017

The right way to solve this would be to resolve the parameter in the pass as we do in

$class = $container->getParameterBag()->resolveValue($definition->getClass());
right?

Same concern as @iltar, not sure if we should add support for this, deprecate it in the passes supporting it already or do nothing at all.

@pjarmalavicius
Copy link
Contributor Author

@iltar I think we can leave AddSecurityVotersPass as it was before and add new compiler pass of type "optimization" for voters validity check. I did PR for that

@linaori
Copy link
Contributor

linaori commented Aug 7, 2017

Just found a case where the class name is resolved inside the pass:

$class = $container->getParameterBag()->resolveValue($definition->getClass());

@pjarmalavicius
Copy link
Contributor Author

pjarmalavicius commented Aug 8, 2017

Yes, it's the same as @chalasr suggests, but if we follow symfony best practices, then I would say that we also should write core to follow it. I mean class name parameters are not recommended and maybe one day it will be deprecated. Having check validity compiler pass doesn't depend on class parameter parsing and it also doesn't change what worked before

chalasr pushed a commit that referenced this issue Aug 21, 2017
…ddSecurityVotersPass (pjarmalavicius)

This PR was squashed before being merged into the 3.4 branch (closes #23862).

Discussion
----------

[SecurityBundle] resolve class name parameter inside AddSecurityVotersPass

| Q             | A
| ------------- | ---
| Branch?       | 3.4
| Bug fix?      | yes
| New feature?  | no
| BC breaks?    | no
| Deprecations? | no
| Tests pass?   | yes
| Fixed tickets | #23733
| License       | MIT

Commits
-------

a86bf52 [SecurityBundle] resolve class name parameter inside AddSecurityVotersPass
@chalasr chalasr closed this as completed Aug 21, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

5 participants