diff options
author | Fabien Potencier <fabien.potencier@gmail.com> | 2015-03-07 08:40:15 +0100 |
---|---|---|
committer | Fabien Potencier <fabien.potencier@gmail.com> | 2015-03-07 08:40:15 +0100 |
commit | b883dbdf074f070aaf67e7f6da5bb9af807f7cbd (patch) | |
tree | af4b57fc3cdcb12555d723f22d9f8a0ed4ae92f6 | |
parent | b4d7bfbd51e8ce9b7cc91aac2dccfa1b3fd731a9 (diff) | |
parent | 9c2566542e03e280f62b019264becf6b74891bdc (diff) | |
download | symfony-security-b883dbdf074f070aaf67e7f6da5bb9af807f7cbd.zip symfony-security-b883dbdf074f070aaf67e7f6da5bb9af807f7cbd.tar.gz symfony-security-b883dbdf074f070aaf67e7f6da5bb9af807f7cbd.tar.bz2 |
Merge branch '2.3' into 2.6
* 2.3:
replaced the last remaining is_integer() call
[2.3] [Config] [Console] [DependencyInjection] [DomCrawler] [Form] [HttpKernel] [PropertyAccess] [Security] [Translation] [Yaml] static code analysis, code cleanup
[Validator] Added missing galician (gl) translations
[travis] Tests Security sub-components
[travis] Tests Security sub-components
CS fixes
[travis] test with php nightly
Conflicts:
src/Symfony/Component/Security/Http/Tests/Firewall/RememberMeListenerTest.php
-rw-r--r-- | Acl/Dbal/AclProvider.php | 12 | ||||
-rw-r--r-- | Acl/Tests/Dbal/AclProviderBenchmarkTest.php | 8 | ||||
-rw-r--r-- | Acl/Tests/Voter/AclVoterTest.php | 12 | ||||
-rw-r--r-- | Core/Authentication/Provider/PreAuthenticatedAuthenticationProvider.php | 2 | ||||
-rw-r--r-- | Core/Tests/Util/SecureRandomTest.php | 8 | ||||
-rw-r--r-- | Http/Tests/Firewall/ExceptionListenerTest.php | 6 | ||||
-rw-r--r-- | Http/Tests/Firewall/RememberMeListenerTest.php | 8 |
7 files changed, 29 insertions, 27 deletions
diff --git a/Acl/Dbal/AclProvider.php b/Acl/Dbal/AclProvider.php index 705b4ff..fd6f5ba 100644 --- a/Acl/Dbal/AclProvider.php +++ b/Acl/Dbal/AclProvider.php @@ -173,7 +173,8 @@ class AclProvider implements AclProviderInterface } // Is it time to load the current batch? - if ((self::MAX_BATCH_SIZE === count($currentBatch) || ($i + 1) === $c) && count($currentBatch) > 0) { + $currentBatchesCount = count($currentBatch); + if ($currentBatchesCount > 0 && (self::MAX_BATCH_SIZE === $currentBatchesCount || ($i + 1) === $c)) { try { $loadedBatch = $this->lookupObjectIdentities($currentBatch, $sids, $oidLookup); } catch (AclNotFoundException $aclNotFoundException) { @@ -559,10 +560,11 @@ QUERY; // attach ACL to the result set; even though we do not enforce that every // object identity has only one instance, we must make sure to maintain // referential equality with the oids passed to findAcls() - if (!isset($oidCache[$objectIdentifier.$classType])) { - $oidCache[$objectIdentifier.$classType] = $acl->getObjectIdentity(); + $oidCacheKey = $objectIdentifier.$classType; + if (!isset($oidCache[$oidCacheKey])) { + $oidCache[$oidCacheKey] = $acl->getObjectIdentity(); } - $result->attach($oidCache[$objectIdentifier.$classType], $acl); + $result->attach($oidCache[$oidCacheKey], $acl); // so, this hasn't been hydrated yet } else { // create object identity if we haven't done so yet @@ -670,7 +672,7 @@ QUERY; // let's see if we have already hydrated this if (isset($acls[$parentId])) { $aclParentAclProperty->setValue($acl, $acls[$parentId]); - $processed += 1; + ++$processed; continue; } diff --git a/Acl/Tests/Dbal/AclProviderBenchmarkTest.php b/Acl/Tests/Dbal/AclProviderBenchmarkTest.php index dab90d4..46a695a 100644 --- a/Acl/Tests/Dbal/AclProviderBenchmarkTest.php +++ b/Acl/Tests/Dbal/AclProviderBenchmarkTest.php @@ -122,7 +122,7 @@ class AclProviderBenchmarkTest extends \PHPUnit_Framework_TestCase if ($id === 1000 || ($id < 1500 && rand(0, 1))) { $this->insertClassStmt->execute(array($id, $this->getRandomString(rand(20, 100), 'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789\\_'))); - $id += 1; + ++$id; return $id-1; } else { @@ -148,7 +148,7 @@ class AclProviderBenchmarkTest extends \PHPUnit_Framework_TestCase } $this->generateAces($classId, $id); - $id += 1; + ++$id; return $id-1; } @@ -163,7 +163,7 @@ class AclProviderBenchmarkTest extends \PHPUnit_Framework_TestCase $this->getRandomString(rand(5, 30)), rand(0, 1), )); - $id += 1; + ++$id; return $id-1; } else { @@ -215,7 +215,7 @@ class AclProviderBenchmarkTest extends \PHPUnit_Framework_TestCase rand(0, 1), )); - $id += 1; + ++$id; } } diff --git a/Acl/Tests/Voter/AclVoterTest.php b/Acl/Tests/Voter/AclVoterTest.php index c4c0b4e..2148135 100644 --- a/Acl/Tests/Voter/AclVoterTest.php +++ b/Acl/Tests/Voter/AclVoterTest.php @@ -27,7 +27,7 @@ class AclVoterTest extends \PHPUnit_Framework_TestCase */ public function testSupportsAttribute($attribute, $supported) { - list($voter, , $permissionMap, ,) = $this->getVoter(true, false); + list($voter, , $permissionMap) = $this->getVoter(true, false); $permissionMap ->expects($this->once()) @@ -44,7 +44,7 @@ class AclVoterTest extends \PHPUnit_Framework_TestCase */ public function testSupportsAttributeNonString($attribute) { - list($voter, , , , ,) = $this->getVoter(true, false); + list($voter) = $this->getVoter(true, false); $this->assertFalse($voter->supportsAttribute($attribute)); } @@ -72,7 +72,7 @@ class AclVoterTest extends \PHPUnit_Framework_TestCase */ public function testSupportsClass($class) { - list($voter, , , ,) = $this->getVoter(); + list($voter) = $this->getVoter(); $this->assertTrue($voter->supportsClass($class)); } @@ -88,7 +88,7 @@ class AclVoterTest extends \PHPUnit_Framework_TestCase public function testVote() { - list($voter, , $permissionMap, ,) = $this->getVoter(); + list($voter, , $permissionMap) = $this->getVoter(); $permissionMap ->expects($this->atLeastOnce()) ->method('getMasks') @@ -103,7 +103,7 @@ class AclVoterTest extends \PHPUnit_Framework_TestCase */ public function testVoteWhenNoObjectIsPassed($allowIfObjectIdentityUnavailable) { - list($voter, , $permissionMap, ,) = $this->getVoter($allowIfObjectIdentityUnavailable); + list($voter, , $permissionMap) = $this->getVoter($allowIfObjectIdentityUnavailable); $permissionMap ->expects($this->once()) ->method('getMasks') @@ -124,7 +124,7 @@ class AclVoterTest extends \PHPUnit_Framework_TestCase */ public function testVoteWhenOidStrategyReturnsNull($allowIfUnavailable) { - list($voter, , $permissionMap, $oidStrategy,) = $this->getVoter($allowIfUnavailable); + list($voter, , $permissionMap, $oidStrategy) = $this->getVoter($allowIfUnavailable); $permissionMap ->expects($this->once()) ->method('getMasks') diff --git a/Core/Authentication/Provider/PreAuthenticatedAuthenticationProvider.php b/Core/Authentication/Provider/PreAuthenticatedAuthenticationProvider.php index 4f73254..c17a954 100644 --- a/Core/Authentication/Provider/PreAuthenticatedAuthenticationProvider.php +++ b/Core/Authentication/Provider/PreAuthenticatedAuthenticationProvider.php @@ -60,7 +60,7 @@ class PreAuthenticatedAuthenticationProvider implements AuthenticationProviderIn throw new BadCredentialsException('No pre-authenticated principal found in request.'); } - $user = $this->userProvider->loadUserByUsername($user); + $user = $this->userProvider->loadUserByUsername($user); $this->userChecker->checkPostAuth($user); diff --git a/Core/Tests/Util/SecureRandomTest.php b/Core/Tests/Util/SecureRandomTest.php index 6e12ef2..590efd3 100644 --- a/Core/Tests/Util/SecureRandomTest.php +++ b/Core/Tests/Util/SecureRandomTest.php @@ -41,7 +41,7 @@ class SecureRandomTest extends \PHPUnit_Framework_TestCase for ($j = 1; $j <= 5000; $j++) { $k = 4 * $j - 1; - $c[8 * $b[$k - 3] + 4 * $b[$k - 2] + 2 * $b[$k - 1] + $b[$k]] += 1; + ++$c[8 * $b[$k - 3] + 4 * $b[$k - 2] + 2 * $b[$k - 1] + $b[$k]]; } $f = 0; @@ -73,14 +73,14 @@ class SecureRandomTest extends \PHPUnit_Framework_TestCase $run = 6; } - $runs[$run] += 1; + ++$runs[$run]; }; $currentRun = 0; $lastBit = null; for ($i = 0; $i < 20000; $i++) { if ($lastBit === $b[$i]) { - $currentRun += 1; + ++$currentRun; } else { if ($currentRun > 0) { $addRun($currentRun); @@ -115,7 +115,7 @@ class SecureRandomTest extends \PHPUnit_Framework_TestCase $lastBit = null; for ($i = 0; $i < 20000; $i++) { if ($lastBit === $b[$i]) { - $currentRun += 1; + ++$currentRun; } else { if ($currentRun > $longestRun) { $longestRun = $currentRun; diff --git a/Http/Tests/Firewall/ExceptionListenerTest.php b/Http/Tests/Firewall/ExceptionListenerTest.php index f1409e4..6b99471 100644 --- a/Http/Tests/Firewall/ExceptionListenerTest.php +++ b/Http/Tests/Firewall/ExceptionListenerTest.php @@ -172,9 +172,9 @@ class ExceptionListenerTest extends \PHPUnit_Framework_TestCase private function createExceptionListener(SecurityContextInterface $context = null, AuthenticationTrustResolverInterface $trustResolver = null, HttpUtils $httpUtils = null, AuthenticationEntryPointInterface $authenticationEntryPoint = null, $errorPage = null, AccessDeniedHandlerInterface $accessDeniedHandler = null) { return new ExceptionListener( - $context ? $context : $this->getMock('Symfony\Component\Security\Core\SecurityContextInterface'), - $trustResolver ? $trustResolver : $this->getMock('Symfony\Component\Security\Core\Authentication\AuthenticationTrustResolverInterface'), - $httpUtils ? $httpUtils : $this->getMock('Symfony\Component\Security\Http\HttpUtils'), + $context ?: $this->getMock('Symfony\Component\Security\Core\SecurityContextInterface'), + $trustResolver ?: $this->getMock('Symfony\Component\Security\Core\Authentication\AuthenticationTrustResolverInterface'), + $httpUtils ?: $this->getMock('Symfony\Component\Security\Http\HttpUtils'), 'key', $authenticationEntryPoint, $errorPage, diff --git a/Http/Tests/Firewall/RememberMeListenerTest.php b/Http/Tests/Firewall/RememberMeListenerTest.php index edc27a1..12ced6b 100644 --- a/Http/Tests/Firewall/RememberMeListenerTest.php +++ b/Http/Tests/Firewall/RememberMeListenerTest.php @@ -20,7 +20,7 @@ class RememberMeListenerTest extends \PHPUnit_Framework_TestCase { public function testOnCoreSecurityDoesNotTryToPopulateNonEmptySecurityContext() { - list($listener, $context, , , ,) = $this->getListener(); + list($listener, $context) = $this->getListener(); $context ->expects($this->once()) @@ -38,7 +38,7 @@ class RememberMeListenerTest extends \PHPUnit_Framework_TestCase public function testOnCoreSecurityDoesNothingWhenNoCookieIsSet() { - list($listener, $context, $service, ,) = $this->getListener(); + list($listener, $context, $service) = $this->getListener(); $context ->expects($this->once()) @@ -64,7 +64,7 @@ class RememberMeListenerTest extends \PHPUnit_Framework_TestCase public function testOnCoreSecurityIgnoresAuthenticationExceptionThrownByAuthenticationManagerImplementation() { - list($listener, $context, $service, $manager,) = $this->getListener(); + list($listener, $context, $service, $manager) = $this->getListener(); $context ->expects($this->once()) @@ -144,7 +144,7 @@ class RememberMeListenerTest extends \PHPUnit_Framework_TestCase public function testOnCoreSecurity() { - list($listener, $context, $service, $manager,) = $this->getListener(); + list($listener, $context, $service, $manager) = $this->getListener(); $context ->expects($this->once()) |