Skip to content
This repository was archived by the owner on May 31, 2024. It is now read-only.

Commit b883dbd

Browse files
committed
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
2 parents b4d7bfb + 9c25665 commit b883dbd

File tree

7 files changed

+29
-27
lines changed

7 files changed

+29
-27
lines changed

Acl/Dbal/AclProvider.php

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -173,7 +173,8 @@ public function findAcls(array $oids, array $sids = array())
173173
}
174174

175175
// Is it time to load the current batch?
176-
if ((self::MAX_BATCH_SIZE === count($currentBatch) || ($i + 1) === $c) && count($currentBatch) > 0) {
176+
$currentBatchesCount = count($currentBatch);
177+
if ($currentBatchesCount > 0 && (self::MAX_BATCH_SIZE === $currentBatchesCount || ($i + 1) === $c)) {
177178
try {
178179
$loadedBatch = $this->lookupObjectIdentities($currentBatch, $sids, $oidLookup);
179180
} catch (AclNotFoundException $aclNotFoundException) {
@@ -559,10 +560,11 @@ private function hydrateObjectIdentities(Statement $stmt, array $oidLookup, arra
559560
// attach ACL to the result set; even though we do not enforce that every
560561
// object identity has only one instance, we must make sure to maintain
561562
// referential equality with the oids passed to findAcls()
562-
if (!isset($oidCache[$objectIdentifier.$classType])) {
563-
$oidCache[$objectIdentifier.$classType] = $acl->getObjectIdentity();
563+
$oidCacheKey = $objectIdentifier.$classType;
564+
if (!isset($oidCache[$oidCacheKey])) {
565+
$oidCache[$oidCacheKey] = $acl->getObjectIdentity();
564566
}
565-
$result->attach($oidCache[$objectIdentifier.$classType], $acl);
567+
$result->attach($oidCache[$oidCacheKey], $acl);
566568
// so, this hasn't been hydrated yet
567569
} else {
568570
// create object identity if we haven't done so yet
@@ -670,7 +672,7 @@ private function hydrateObjectIdentities(Statement $stmt, array $oidLookup, arra
670672
// let's see if we have already hydrated this
671673
if (isset($acls[$parentId])) {
672674
$aclParentAclProperty->setValue($acl, $acls[$parentId]);
673-
$processed += 1;
675+
++$processed;
674676

675677
continue;
676678
}

Acl/Tests/Dbal/AclProviderBenchmarkTest.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -122,7 +122,7 @@ protected function chooseClassId()
122122

123123
if ($id === 1000 || ($id < 1500 && rand(0, 1))) {
124124
$this->insertClassStmt->execute(array($id, $this->getRandomString(rand(20, 100), 'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789\\_')));
125-
$id += 1;
125+
++$id;
126126

127127
return $id-1;
128128
} else {
@@ -148,7 +148,7 @@ protected function generateAcl($classId, $parentId, $ancestors)
148148
}
149149

150150
$this->generateAces($classId, $id);
151-
$id += 1;
151+
++$id;
152152

153153
return $id-1;
154154
}
@@ -163,7 +163,7 @@ protected function chooseSid()
163163
$this->getRandomString(rand(5, 30)),
164164
rand(0, 1),
165165
));
166-
$id += 1;
166+
++$id;
167167

168168
return $id-1;
169169
} else {
@@ -215,7 +215,7 @@ protected function generateAces($classId, $objectId)
215215
rand(0, 1),
216216
));
217217

218-
$id += 1;
218+
++$id;
219219
}
220220
}
221221

Acl/Tests/Voter/AclVoterTest.php

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ class AclVoterTest extends \PHPUnit_Framework_TestCase
2727
*/
2828
public function testSupportsAttribute($attribute, $supported)
2929
{
30-
list($voter, , $permissionMap, ,) = $this->getVoter(true, false);
30+
list($voter, , $permissionMap) = $this->getVoter(true, false);
3131

3232
$permissionMap
3333
->expects($this->once())
@@ -44,7 +44,7 @@ public function testSupportsAttribute($attribute, $supported)
4444
*/
4545
public function testSupportsAttributeNonString($attribute)
4646
{
47-
list($voter, , , , ,) = $this->getVoter(true, false);
47+
list($voter) = $this->getVoter(true, false);
4848

4949
$this->assertFalse($voter->supportsAttribute($attribute));
5050
}
@@ -72,7 +72,7 @@ public function getSupportsAttributeNonStringTests()
7272
*/
7373
public function testSupportsClass($class)
7474
{
75-
list($voter, , , ,) = $this->getVoter();
75+
list($voter) = $this->getVoter();
7676

7777
$this->assertTrue($voter->supportsClass($class));
7878
}
@@ -88,7 +88,7 @@ public function getSupportsClassTests()
8888

8989
public function testVote()
9090
{
91-
list($voter, , $permissionMap, ,) = $this->getVoter();
91+
list($voter, , $permissionMap) = $this->getVoter();
9292
$permissionMap
9393
->expects($this->atLeastOnce())
9494
->method('getMasks')
@@ -103,7 +103,7 @@ public function testVote()
103103
*/
104104
public function testVoteWhenNoObjectIsPassed($allowIfObjectIdentityUnavailable)
105105
{
106-
list($voter, , $permissionMap, ,) = $this->getVoter($allowIfObjectIdentityUnavailable);
106+
list($voter, , $permissionMap) = $this->getVoter($allowIfObjectIdentityUnavailable);
107107
$permissionMap
108108
->expects($this->once())
109109
->method('getMasks')
@@ -124,7 +124,7 @@ public function testVoteWhenNoObjectIsPassed($allowIfObjectIdentityUnavailable)
124124
*/
125125
public function testVoteWhenOidStrategyReturnsNull($allowIfUnavailable)
126126
{
127-
list($voter, , $permissionMap, $oidStrategy,) = $this->getVoter($allowIfUnavailable);
127+
list($voter, , $permissionMap, $oidStrategy) = $this->getVoter($allowIfUnavailable);
128128
$permissionMap
129129
->expects($this->once())
130130
->method('getMasks')

Core/Authentication/Provider/PreAuthenticatedAuthenticationProvider.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ public function authenticate(TokenInterface $token)
6060
throw new BadCredentialsException('No pre-authenticated principal found in request.');
6161
}
6262

63-
$user = $this->userProvider->loadUserByUsername($user);
63+
$user = $this->userProvider->loadUserByUsername($user);
6464

6565
$this->userChecker->checkPostAuth($user);
6666

Core/Tests/Util/SecureRandomTest.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ public function testPoker($secureRandom)
4141

4242
for ($j = 1; $j <= 5000; $j++) {
4343
$k = 4 * $j - 1;
44-
$c[8 * $b[$k - 3] + 4 * $b[$k - 2] + 2 * $b[$k - 1] + $b[$k]] += 1;
44+
++$c[8 * $b[$k - 3] + 4 * $b[$k - 2] + 2 * $b[$k - 1] + $b[$k]];
4545
}
4646

4747
$f = 0;
@@ -73,14 +73,14 @@ public function testRun($secureRandom)
7373
$run = 6;
7474
}
7575

76-
$runs[$run] += 1;
76+
++$runs[$run];
7777
};
7878

7979
$currentRun = 0;
8080
$lastBit = null;
8181
for ($i = 0; $i < 20000; $i++) {
8282
if ($lastBit === $b[$i]) {
83-
$currentRun += 1;
83+
++$currentRun;
8484
} else {
8585
if ($currentRun > 0) {
8686
$addRun($currentRun);
@@ -115,7 +115,7 @@ public function testLongRun($secureRandom)
115115
$lastBit = null;
116116
for ($i = 0; $i < 20000; $i++) {
117117
if ($lastBit === $b[$i]) {
118-
$currentRun += 1;
118+
++$currentRun;
119119
} else {
120120
if ($currentRun > $longestRun) {
121121
$longestRun = $currentRun;

Http/Tests/Firewall/ExceptionListenerTest.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -172,9 +172,9 @@ private function createEvent(\Exception $exception, $kernel = null)
172172
private function createExceptionListener(SecurityContextInterface $context = null, AuthenticationTrustResolverInterface $trustResolver = null, HttpUtils $httpUtils = null, AuthenticationEntryPointInterface $authenticationEntryPoint = null, $errorPage = null, AccessDeniedHandlerInterface $accessDeniedHandler = null)
173173
{
174174
return new ExceptionListener(
175-
$context ? $context : $this->getMock('Symfony\Component\Security\Core\SecurityContextInterface'),
176-
$trustResolver ? $trustResolver : $this->getMock('Symfony\Component\Security\Core\Authentication\AuthenticationTrustResolverInterface'),
177-
$httpUtils ? $httpUtils : $this->getMock('Symfony\Component\Security\Http\HttpUtils'),
175+
$context ?: $this->getMock('Symfony\Component\Security\Core\SecurityContextInterface'),
176+
$trustResolver ?: $this->getMock('Symfony\Component\Security\Core\Authentication\AuthenticationTrustResolverInterface'),
177+
$httpUtils ?: $this->getMock('Symfony\Component\Security\Http\HttpUtils'),
178178
'key',
179179
$authenticationEntryPoint,
180180
$errorPage,

Http/Tests/Firewall/RememberMeListenerTest.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ class RememberMeListenerTest extends \PHPUnit_Framework_TestCase
2020
{
2121
public function testOnCoreSecurityDoesNotTryToPopulateNonEmptySecurityContext()
2222
{
23-
list($listener, $context, , , ,) = $this->getListener();
23+
list($listener, $context) = $this->getListener();
2424

2525
$context
2626
->expects($this->once())
@@ -38,7 +38,7 @@ public function testOnCoreSecurityDoesNotTryToPopulateNonEmptySecurityContext()
3838

3939
public function testOnCoreSecurityDoesNothingWhenNoCookieIsSet()
4040
{
41-
list($listener, $context, $service, ,) = $this->getListener();
41+
list($listener, $context, $service) = $this->getListener();
4242

4343
$context
4444
->expects($this->once())
@@ -64,7 +64,7 @@ public function testOnCoreSecurityDoesNothingWhenNoCookieIsSet()
6464

6565
public function testOnCoreSecurityIgnoresAuthenticationExceptionThrownByAuthenticationManagerImplementation()
6666
{
67-
list($listener, $context, $service, $manager,) = $this->getListener();
67+
list($listener, $context, $service, $manager) = $this->getListener();
6868

6969
$context
7070
->expects($this->once())
@@ -144,7 +144,7 @@ public function testOnCoreSecurityIgnoresAuthenticationOptionallyRethrowsExcepti
144144

145145
public function testOnCoreSecurity()
146146
{
147-
list($listener, $context, $service, $manager,) = $this->getListener();
147+
list($listener, $context, $service, $manager) = $this->getListener();
148148

149149
$context
150150
->expects($this->once())

0 commit comments

Comments
 (0)