From dd6ed34d43a91181f857325b3eea5827e5e78b6a Mon Sep 17 00:00:00 2001 From: schrankenstein Date: Fri, 5 May 2017 17:26:43 +0200 Subject: [PATCH] Performance Fix unsetting a non-existing rule doesn't throw an error. In our Project this change improves loading time from 55 sec to 0.5 sec (14412 Resources, 11694 Rules) see also https://github.com/zendframework/zf1/pull/737 --- src/Acl.php | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/src/Acl.php b/src/Acl.php index 2c4af4d..96e34e3 100644 --- a/src/Acl.php +++ b/src/Acl.php @@ -405,11 +405,7 @@ public function removeResource($resource) public function removeResourceAll() { foreach ($this->resources as $resourceId => $resource) { - foreach ($this->rules['byResourceId'] as $resourceIdCurrent => $rules) { - if ($resourceId === $resourceIdCurrent) { - unset($this->rules['byResourceId'][$resourceIdCurrent]); - } - } + unset($this->rules['byResourceId'][$resourceId]); } $this->resources = [];