diff options
author | Fabien Potencier <fabien.potencier@gmail.com> | 2013-04-07 22:25:23 +0200 |
---|---|---|
committer | Fabien Potencier <fabien.potencier@gmail.com> | 2013-04-07 22:25:23 +0200 |
commit | d62296fc75038d884314ed78bbf4fa2e95654017 (patch) | |
tree | e6adfd328aa6ca5fe30e70dc91d3a33ea7fea73e | |
parent | cfa23578e55c43c20a8d823bf9a01ed08bcde1d5 (diff) | |
parent | ca59c1631b4d39f134a0768d820e7ba1c5779d0a (diff) | |
download | symfony-security-d62296fc75038d884314ed78bbf4fa2e95654017.zip symfony-security-d62296fc75038d884314ed78bbf4fa2e95654017.tar.gz symfony-security-d62296fc75038d884314ed78bbf4fa2e95654017.tar.bz2 |
Merge branch '2.2'
* 2.2:
Fix finding ACLs from ObjectIdentity's with different types
[HttpKernel] tweaked previous merge
#7531: [HttpKernel][Config] FileLocator adds NULL as global resource path
Fix autocompletion of command names when namespaces conflict
Fix timeout in Process::stop method
fixed CS
Round stream_select fifth argument up.
Fix Process timeout
[HttpKernel] Remove args from 5.3 stack traces to avoid filling log files, fixes #7259
bumped Symfony version to 2.2.2-DEV
updated VERSION for 2.2.1
updated CHANGELOG for 2.2.1
Fixed phpdoc blocks to show that $uri can be passed as a string or ControllerReference (rather than just as a string)
[HttpFoundation] Fixed copy pasted comment from FlashBag in AttributeBag
[FrameworkBundle] fixed the discovery of the PHPUnit configuration file when using aggregate options like in -vc app/ (closes #7562)
[WebProfilerBundle] removed next pointer class in a template
fix overwriting of request's locale if attribute _locale is missing
Conflicts:
src/Symfony/Component/HttpKernel/Debug/ErrorHandler.php
src/Symfony/Component/HttpKernel/EventListener/LocaleListener.php
src/Symfony/Component/HttpKernel/Kernel.php
-rw-r--r-- | Acl/Dbal/AclProvider.php | 6 | ||||
-rw-r--r-- | Tests/Acl/Dbal/AclProviderTest.php | 17 |
2 files changed, 22 insertions, 1 deletions
diff --git a/Acl/Dbal/AclProvider.php b/Acl/Dbal/AclProvider.php index 6f47231..822a160 100644 --- a/Acl/Dbal/AclProvider.php +++ b/Acl/Dbal/AclProvider.php @@ -263,7 +263,11 @@ SELECTCLAUSE; for ($i = 0; $i < $count; $i++) { if (!isset($types[$batch[$i]->getType()])) { $types[$batch[$i]->getType()] = true; - if ($count > 1) { + + // if there is more than one type we can safely break out of the + // loop, because it is the differentiator factor on whether to + // query for only one or more class types + if (count($types) > 1) { break; } } diff --git a/Tests/Acl/Dbal/AclProviderTest.php b/Tests/Acl/Dbal/AclProviderTest.php index 83771ee..ad58d72 100644 --- a/Tests/Acl/Dbal/AclProviderTest.php +++ b/Tests/Acl/Dbal/AclProviderTest.php @@ -72,6 +72,23 @@ class AclProviderTest extends \PHPUnit_Framework_TestCase $this->assertTrue($oids[1]->equals($acl1->getObjectIdentity())); } + public function testFindAclsWithDifferentTypes() + { + $oids = array(); + $oids[] = new ObjectIdentity('123', 'Bundle\SomeVendor\MyBundle\Entity\SomeEntity'); + $oids[] = new ObjectIdentity('123', 'Bundle\MyBundle\Entity\AnotherEntity'); + + $provider = $this->getProvider(); + + $acls = $provider->findAcls($oids); + $this->assertInstanceOf('SplObjectStorage', $acls); + $this->assertCount(2, $acls); + $this->assertInstanceOf('Symfony\Component\Security\Acl\Domain\Acl', $acl0 = $acls->offsetGet($oids[0])); + $this->assertInstanceOf('Symfony\Component\Security\Acl\Domain\Acl', $acl1 = $acls->offsetGet($oids[1])); + $this->assertTrue($oids[0]->equals($acl0->getObjectIdentity())); + $this->assertTrue($oids[1]->equals($acl1->getObjectIdentity())); + } + public function testFindAclCachesAclInMemory() { $oid = new ObjectIdentity('1', 'foo'); |