symfony/symfony — pull request #7791 by henneboele (2013-04-22 09:55:43+00:00)
Title: [Component] [Security] [Acl] [Domain] Role security identity fix

| Q | A
| ------------- | ---
| Bug fix? | yes
| New feature? | no
| BC breaks? | no
| Deprecations? | no
| Tests pass? | yes
| Fixed tickets |
| License | MIT
| Doc PR |

Casting the role property in the constructor is necessary to let the equals function binary comparison work properly while using a custom role entity.

The security identity retrieval strategy getSecurityIdentities function instantiates the role security identity class passing an object. The constructor will assign this object to $this->role in case it's not an instance of Role. Binary safe comparison will fail even though gettype returns "string". The custom role entity requires a __toString magic method in this case.