8000 bug #9516 [AclProvider] Fix incorrect behavior when partial results r… · symfony/symfony@be0a605 · GitHub
[go: up one dir, main page]

Skip to content

Commit be0a605

Browse files
committed
bug #9516 [AclProvider] Fix incorrect behavior when partial results returned from cache (superdav42)
This PR was merged into the 2.2 branch. Discussion ---------- [AclProvider] Fix incorrect behavior when partial results returned from cache | Q | A | ------------- | --- | Bug fix? | yes | New feature? | no | BC breaks? | no | Deprecations? | no | Tests pass? | yes | Fixed tickets | #9515 | License | MIT | Doc PR | none [AclProvider] Fix incorrect behavior when partial results returned from cache findAcls wasn't throwing the NotAllAclsFoundException with the partial result when some acls were retrieved from the cache. This will fix that behavior. Ideally we would update it to cache items that were not found so it wouldn't have to query the db every time for non existent items, but I'm not sure if that is possible. I'm not sure if the ACL cache is being used very much, I didn't find any docs about it but it seems to work except for this issue. It might be more appropriate to merge the fix in master if no one is relying on it to work in 2.2. Commits ------- edae59c [AclProvider] Fix incorrect behaviour when partial results returned from cache
2 parents 5e034fa + edae59c commit be0a605

File tree

1 file changed

+11
-2
lines changed

1 file changed

+11
-2
lines changed

src/Symfony/Component/Security/Acl/Dbal/AclProvider.php

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -165,8 +165,17 @@ public function findAcls(array $oids, array $sids = array())
165165

166166
// Is it time to load the current batch?
167167
if ((self::MAX_BATCH_SIZE === count($currentBatch) || ($i + 1) === $c) && count($currentBatch) > 0) {
168-
$loadedBatch = $this->lookupObjectIdentities($currentBatch, $sids, $oidLookup);
169-
168+
try {
169+
$loadedBatch = $this->lookupObjectIdentities($currentBatch, $sids, $oidLookup);
170+
} catch (AclNotFoundException $aclNotFoundexception) {
171+
if ($result->count()) {
172+
$partialResultException = new NotAllAclsFoundException('The provider could not find ACLs for all object identities.');
173+
$partialResultException->setPartialResult($result);
174+
throw $partialResultException;
175+
} else {
176+
throw $aclNotFoundexception;
177+
}
178+
}
170179
foreach ($loadedBatch as $loadedOid) {
171180
$loadedAcl = $loadedBatch->offsetGet($loadedOid);
172181

0 commit comments

Comments
 (0)
0