diff --git a/CHANGELOG-2.1.md b/CHANGELOG-2.1.md index 4cbefd922a..624c348c20 100644 --- a/CHANGELOG-2.1.md +++ b/CHANGELOG-2.1.md @@ -236,6 +236,7 @@ To get the diff between two versions, go to https://github.com/symfony/symfony/c * after login, the user is now redirected to `default_target_path` if `use_referer` is true and the referrer is the `login_path`. * added a way to remove a token from a session + * [BC BREAK] changed `MutableAclInterface::setParentAcl` to accept `null`, review your implementation to reflect this change. ### Serializer diff --git a/src/Symfony/Component/Security/Acl/Domain/Acl.php b/src/Symfony/Component/Security/Acl/Domain/Acl.php index 4a4a2e232b..a890bbec03 100644 --- a/src/Symfony/Component/Security/Acl/Domain/Acl.php +++ b/src/Symfony/Component/Security/Acl/Domain/Acl.php @@ -311,9 +311,9 @@ class Acl implements AuditableAclInterface, NotifyPropertyChanged /** * {@inheritDoc} */ - public function setParentAcl(AclInterface $acl) + public function setParentAcl(AclInterface $acl = null) { - if (null === $acl->getId()) { + if (null !== $acl && null === $acl->getId()) { throw new \InvalidArgumentException('$acl must have an ID.'); } diff --git a/src/Symfony/Component/Security/Acl/Model/MutableAclInterface.php b/src/Symfony/Component/Security/Acl/Model/MutableAclInterface.php index 521d307839..a846a9f161 100644 --- a/src/Symfony/Component/Security/Acl/Model/MutableAclInterface.php +++ b/src/Symfony/Component/Security/Acl/Model/MutableAclInterface.php @@ -114,9 +114,10 @@ interface MutableAclInterface extends AclInterface /** * Sets the parent ACL * - * @param AclInterface $acl + * @param AclInterface|null $acl + * @return void */ - function setParentAcl(AclInterface $acl); + function setParentAcl(AclInterface $acl = null); /** * Updates a class-based ACE diff --git a/tests/Symfony/Tests/Component/Security/Acl/Domain/AclTest.php b/tests/Symfony/Tests/Component/Security/Acl/Domain/AclTest.php index 762ce7693d..90f13fb404 100644 --- a/tests/Symfony/Tests/Component/Security/Acl/Domain/AclTest.php +++ b/tests/Symfony/Tests/Component/Security/Acl/Domain/AclTest.php @@ -250,6 +250,9 @@ class AclTest extends \PHPUnit_Framework_TestCase $this->assertNull($acl->getParentAcl()); $acl->setParentAcl($parentAcl); $this->assertSame($parentAcl, $acl->getParentAcl()); + + $acl->setParentAcl(null); + $this->assertNull($acl->getParentAcl()); } public function testSetIsEntriesInheriting()