diff options
author | Fabien Potencier <fabien.potencier@gmail.com> | 2015-05-15 15:32:45 +0200 |
---|---|---|
committer | Fabien Potencier <fabien.potencier@gmail.com> | 2015-05-15 15:32:45 +0200 |
commit | f81b1cd7a05c28ce191bc5d4295bbea7367368d4 (patch) | |
tree | 162878fcf036372b2b7afeccc92b689c3c292cdd | |
parent | db95dbe483b2f8ce7bae38ea37ae1f42fe141a6c (diff) | |
parent | c29b2f6d4618d6366d6e5fb3770169c7e1773bf3 (diff) | |
download | symfony-security-f81b1cd7a05c28ce191bc5d4295bbea7367368d4.zip symfony-security-f81b1cd7a05c28ce191bc5d4295bbea7367368d4.tar.gz symfony-security-f81b1cd7a05c28ce191bc5d4295bbea7367368d4.tar.bz2 |
Merge branch '2.3' into 2.6
* 2.3:
Fix tests in HHVM
CS: Pre incrementation/decrementation should be used if possible
Conflicts:
src/Symfony/Bundle/TwigBundle/Command/LintCommand.php
src/Symfony/Component/Console/Helper/TableHelper.php
src/Symfony/Component/EventDispatcher/Tests/EventDispatcherTest.php
src/Symfony/Component/HttpKernel/DataCollector/LoggerDataCollector.php
src/Symfony/Component/HttpKernel/HttpCache/EsiResponseCacheStrategy.php
src/Symfony/Component/Security/Acl/Dbal/AclProvider.php
src/Symfony/Component/Security/Http/RememberMe/TokenBasedRememberMeServices.php
-rw-r--r-- | Acl/Dbal/AclProvider.php | 8 | ||||
-rw-r--r-- | Acl/Dbal/MutableAclProvider.php | 12 | ||||
-rw-r--r-- | Acl/Domain/Acl.php | 8 | ||||
-rw-r--r-- | Acl/Permission/MaskBuilder.php | 2 | ||||
-rw-r--r-- | Acl/Tests/Dbal/AclProviderBenchmarkTest.php | 8 | ||||
-rw-r--r-- | Acl/Tests/Dbal/AclProviderTest.php | 2 | ||||
-rw-r--r-- | Acl/Tests/Domain/DoctrineAclCacheTest.php | 2 | ||||
-rw-r--r-- | Core/Encoder/MessageDigestPasswordEncoder.php | 2 | ||||
-rw-r--r-- | Core/Encoder/Pbkdf2PasswordEncoder.php | 4 | ||||
-rw-r--r-- | Core/Tests/Authorization/AccessDecisionManagerTest.php | 6 | ||||
-rw-r--r-- | Core/Tests/Encoder/BCryptPasswordEncoderTest.php | 2 | ||||
-rw-r--r-- | Core/Tests/Util/SecureRandomTest.php | 14 | ||||
-rw-r--r-- | Core/Util/StringUtils.php | 2 | ||||
-rw-r--r-- | Http/Tests/Authentication/DefaultAuthenticationFailureHandlerTest.php | 2 |
14 files changed, 37 insertions, 37 deletions
diff --git a/Acl/Dbal/AclProvider.php b/Acl/Dbal/AclProvider.php index 4714fb3..19b902f 100644 --- a/Acl/Dbal/AclProvider.php +++ b/Acl/Dbal/AclProvider.php @@ -104,7 +104,7 @@ class AclProvider implements AclProviderInterface $currentBatch = array(); $oidLookup = array(); - for ($i = 0, $c = count($oids); $i < $c; $i++) { + for ($i = 0, $c = count($oids); $i < $c; ++$i) { $oid = $oids[$i]; $oidLookupKey = $oid->getIdentifier().$oid->getType(); $oidLookup[$oidLookupKey] = $oid; @@ -281,7 +281,7 @@ SELECTCLAUSE; $types = array(); $count = count($batch); - for ($i = 0; $i < $count; $i++) { + for ($i = 0; $i < $count; ++$i) { if (!isset($types[$batch[$i]->getType()])) { $types[$batch[$i]->getType()] = true; @@ -296,7 +296,7 @@ SELECTCLAUSE; if (1 === count($types)) { $ids = array(); - for ($i = 0; $i < $count; $i++) { + for ($i = 0; $i < $count; ++$i) { $identifier = (string) $batch[$i]->getIdentifier(); $ids[] = $this->connection->quote($identifier); } @@ -308,7 +308,7 @@ SELECTCLAUSE; ); } else { $where = '(o.object_identifier = %s AND c.class_type = %s)'; - for ($i = 0; $i < $count; $i++) { + for ($i = 0; $i < $count; ++$i) { $sql .= sprintf( $where, $this->connection->quote($batch[$i]->getIdentifier()), diff --git a/Acl/Dbal/MutableAclProvider.php b/Acl/Dbal/MutableAclProvider.php index b28e2b2..7d802d4 100644 --- a/Acl/Dbal/MutableAclProvider.php +++ b/Acl/Dbal/MutableAclProvider.php @@ -854,7 +854,7 @@ QUERY; $sids = new \SplObjectStorage(); $classIds = new \SplObjectStorage(); foreach ($changes[1] as $field => $new) { - for ($i = 0, $c = count($new); $i < $c; $i++) { + for ($i = 0, $c = count($new); $i < $c; ++$i) { $ace = $new[$i]; if (null === $ace->getId()) { @@ -895,7 +895,7 @@ QUERY; { $currentIds = array(); foreach ($changes[1] as $field => $new) { - for ($i = 0, $c = count($new); $i < $c; $i++) { + for ($i = 0, $c = count($new); $i < $c; ++$i) { $ace = $new[$i]; if (null !== $ace->getId()) { @@ -905,7 +905,7 @@ QUERY; } foreach ($changes[0] as $old) { - for ($i = 0, $c = count($old); $i < $c; $i++) { + for ($i = 0, $c = count($old); $i < $c; ++$i) { $ace = $old[$i]; if (!isset($currentIds[$ace->getId()])) { @@ -928,7 +928,7 @@ QUERY; $sids = new \SplObjectStorage(); $classIds = new \SplObjectStorage(); - for ($i = 0, $c = count($new); $i < $c; $i++) { + for ($i = 0, $c = count($new); $i < $c; ++$i) { $ace = $new[$i]; if (null === $ace->getId()) { @@ -969,7 +969,7 @@ QUERY; list($old, $new) = $changes; $currentIds = array(); - for ($i = 0, $c = count($new); $i < $c; $i++) { + for ($i = 0, $c = count($new); $i < $c; ++$i) { $ace = $new[$i]; if (null !== $ace->getId()) { @@ -977,7 +977,7 @@ QUERY; } } - for ($i = 0, $c = count($old); $i < $c; $i++) { + for ($i = 0, $c = count($old); $i < $c; ++$i) { $ace = $old[$i]; if (!isset($currentIds[$ace->getId()])) { diff --git a/Acl/Domain/Acl.php b/Acl/Domain/Acl.php index 61153af..f417c8f 100644 --- a/Acl/Domain/Acl.php +++ b/Acl/Domain/Acl.php @@ -409,7 +409,7 @@ class Acl implements AuditableAclInterface, NotifyPropertyChanged $this->$property = array_values($this->$property); $this->onPropertyChanged($property, $oldValue, $this->$property); - for ($i = $index, $c = count($this->$property); $i < $c; $i++) { + for ($i = $index, $c = count($this->$property); $i < $c; ++$i) { $this->onEntryPropertyChanged($aces[$i], 'aceOrder', $i + 1, $i); } } @@ -435,7 +435,7 @@ class Acl implements AuditableAclInterface, NotifyPropertyChanged $aces[$field] = array_values($aces[$field]); $this->onPropertyChanged($property, $oldValue, $this->$property); - for ($i = $index, $c = count($aces[$field]); $i < $c; $i++) { + for ($i = $index, $c = count($aces[$field]); $i < $c; ++$i) { $this->onEntryPropertyChanged($aces[$field][$i], 'aceOrder', $i + 1, $i); } } @@ -480,7 +480,7 @@ class Acl implements AuditableAclInterface, NotifyPropertyChanged array_slice($this->$property, $index) ); - for ($i = $index, $c = count($this->$property) - 1; $i < $c; $i++) { + for ($i = $index, $c = count($this->$property) - 1; $i < $c; ++$i) { $this->onEntryPropertyChanged($aces[$i + 1], 'aceOrder', $i, $i + 1); } } @@ -538,7 +538,7 @@ class Acl implements AuditableAclInterface, NotifyPropertyChanged array_slice($aces[$field], $index) ); - for ($i = $index, $c = count($aces[$field]) - 1; $i < $c; $i++) { + for ($i = $index, $c = count($aces[$field]) - 1; $i < $c; ++$i) { $this->onEntryPropertyChanged($aces[$field][$i + 1], 'aceOrder', $i, $i + 1); } } diff --git a/Acl/Permission/MaskBuilder.php b/Acl/Permission/MaskBuilder.php index 589adaa..7c1e503 100644 --- a/Acl/Permission/MaskBuilder.php +++ b/Acl/Permission/MaskBuilder.php @@ -122,7 +122,7 @@ class MaskBuilder $length = strlen($pattern); $bitmask = str_pad(decbin($this->mask), $length, '0', STR_PAD_LEFT); - for ($i = $length - 1; $i >= 0; $i--) { + for ($i = $length - 1; $i >= 0; --$i) { if ('1' === $bitmask[$i]) { try { $pattern[$i] = self::getCode(1 << ($length - $i - 1)); diff --git a/Acl/Tests/Dbal/AclProviderBenchmarkTest.php b/Acl/Tests/Dbal/AclProviderBenchmarkTest.php index 1f96752..c95b474 100644 --- a/Acl/Tests/Dbal/AclProviderBenchmarkTest.php +++ b/Acl/Tests/Dbal/AclProviderBenchmarkTest.php @@ -92,7 +92,7 @@ class AclProviderBenchmarkTest extends \PHPUnit_Framework_TestCase $this->insertEntryStmt = $this->con->prepare('INSERT INTO acl_entries (id, class_id, object_identity_id, field_name, ace_order, security_identity_id, mask, granting, granting_strategy, audit_success, audit_failure) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)'); $this->insertOidAncestorStmt = $this->con->prepare('INSERT INTO acl_object_identity_ancestors (object_identity_id, ancestor_id) VALUES (?, ?)'); - for ($i = 0; $i < 40000; $i++) { + for ($i = 0; $i < 40000; ++$i) { $this->generateAclHierarchy(); } } @@ -107,7 +107,7 @@ class AclProviderBenchmarkTest extends \PHPUnit_Framework_TestCase protected function generateAclLevel($depth, $parentId, $ancestors) { $level = count($ancestors); - for ($i = 0, $t = rand(1, 10); $i < $t; $i++) { + for ($i = 0, $t = rand(1, 10); $i < $t; ++$i) { $id = $this->generateAcl($this->chooseClassId(), $parentId, $ancestors); if ($level < $depth) { @@ -178,7 +178,7 @@ class AclProviderBenchmarkTest extends \PHPUnit_Framework_TestCase $sids = array(); $fieldOrder = array(); - for ($i = 0; $i <= 30; $i++) { + for ($i = 0; $i <= 30; ++$i) { $fieldName = rand(0, 1) ? null : $this->getRandomString(rand(10, 20)); do { @@ -226,7 +226,7 @@ class AclProviderBenchmarkTest extends \PHPUnit_Framework_TestCase while ($i <= 30) { $mask |= 1 << rand(0, 30); - $i++; + ++$i; } return $mask; diff --git a/Acl/Tests/Dbal/AclProviderTest.php b/Acl/Tests/Dbal/AclProviderTest.php index 717a258..9470d80 100644 --- a/Acl/Tests/Dbal/AclProviderTest.php +++ b/Acl/Tests/Dbal/AclProviderTest.php @@ -130,7 +130,7 @@ class AclProviderTest extends \PHPUnit_Framework_TestCase $i = 0; foreach ($aces as $index => $ace) { $this->assertEquals($i, $index); - $i++; + ++$i; } $sid = $aces[0]->getSecurityIdentity(); diff --git a/Acl/Tests/Domain/DoctrineAclCacheTest.php b/Acl/Tests/Domain/DoctrineAclCacheTest.php index 128f2c8..255f7f4 100644 --- a/Acl/Tests/Domain/DoctrineAclCacheTest.php +++ b/Acl/Tests/Domain/DoctrineAclCacheTest.php @@ -72,7 +72,7 @@ class DoctrineAclCacheTest extends \PHPUnit_Framework_TestCase $acl->insertClassFieldAce('foo', $sid, 1); $acl->insertObjectAce($sid, 1); $acl->insertObjectFieldAce('foo', $sid, 1); - $id++; + ++$id; if ($depth > 0) { $acl->setParentAcl($this->getAcl($depth - 1)); diff --git a/Core/Encoder/MessageDigestPasswordEncoder.php b/Core/Encoder/MessageDigestPasswordEncoder.php index 03de228..1706fc8 100644 --- a/Core/Encoder/MessageDigestPasswordEncoder.php +++ b/Core/Encoder/MessageDigestPasswordEncoder.php @@ -55,7 +55,7 @@ class MessageDigestPasswordEncoder extends BasePasswordEncoder $digest = hash($this->algorithm, $salted, true); // "stretch" hash - for ($i = 1; $i < $this->iterations; $i++) { + for ($i = 1; $i < $this->iterations; ++$i) { $digest = hash($this->algorithm, $digest.$salted, true); } diff --git a/Core/Encoder/Pbkdf2PasswordEncoder.php b/Core/Encoder/Pbkdf2PasswordEncoder.php index dac1cad..6f24c4f 100644 --- a/Core/Encoder/Pbkdf2PasswordEncoder.php +++ b/Core/Encoder/Pbkdf2PasswordEncoder.php @@ -87,11 +87,11 @@ class Pbkdf2PasswordEncoder extends BasePasswordEncoder $blocks = ceil($length / strlen(hash($algorithm, null, true))); $digest = ''; - for ($i = 1; $i <= $blocks; $i++) { + for ($i = 1; $i <= $blocks; ++$i) { $ib = $block = hash_hmac($algorithm, $salt.pack('N', $i), $password, true); // Iterations - for ($j = 1; $j < $iterations; $j++) { + for ($j = 1; $j < $iterations; ++$j) { $ib ^= ($block = hash_hmac($algorithm, $block, $password, true)); } diff --git a/Core/Tests/Authorization/AccessDecisionManagerTest.php b/Core/Tests/Authorization/AccessDecisionManagerTest.php index 126bfe8..3c970d1 100644 --- a/Core/Tests/Authorization/AccessDecisionManagerTest.php +++ b/Core/Tests/Authorization/AccessDecisionManagerTest.php @@ -153,13 +153,13 @@ class AccessDecisionManagerTest extends \PHPUnit_Framework_TestCase protected function getVoters($grants, $denies, $abstains) { $voters = array(); - for ($i = 0; $i < $grants; $i++) { + for ($i = 0; $i < $grants; ++$i) { $voters[] = $this->getVoter(VoterInterface::ACCESS_GRANTED); } - for ($i = 0; $i < $denies; $i++) { + for ($i = 0; $i < $denies; ++$i) { $voters[] = $this->getVoter(VoterInterface::ACCESS_DENIED); } - for ($i = 0; $i < $abstains; $i++) { + for ($i = 0; $i < $abstains; ++$i) { $voters[] = $this->getVoter(VoterInterface::ACCESS_ABSTAIN); } diff --git a/Core/Tests/Encoder/BCryptPasswordEncoderTest.php b/Core/Tests/Encoder/BCryptPasswordEncoderTest.php index 2f7b845..ecad3e5 100644 --- a/Core/Tests/Encoder/BCryptPasswordEncoderTest.php +++ b/Core/Tests/Encoder/BCryptPasswordEncoderTest.php @@ -40,7 +40,7 @@ class BCryptPasswordEncoderTest extends \PHPUnit_Framework_TestCase public function testCostInRange() { - for ($cost = 4; $cost <= 31; $cost++) { + for ($cost = 4; $cost <= 31; ++$cost) { new BCryptPasswordEncoder($cost); } } diff --git a/Core/Tests/Util/SecureRandomTest.php b/Core/Tests/Util/SecureRandomTest.php index 5dfe1c8..666af30 100644 --- a/Core/Tests/Util/SecureRandomTest.php +++ b/Core/Tests/Util/SecureRandomTest.php @@ -35,17 +35,17 @@ class SecureRandomTest extends \PHPUnit_Framework_TestCase { $b = $this->getBitSequence($secureRandom, 20000); $c = array(); - for ($i = 0; $i <= 15; $i++) { + for ($i = 0; $i <= 15; ++$i) { $c[$i] = 0; } - for ($j = 1; $j <= 5000; $j++) { + 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]]; } $f = 0; - for ($i = 0; $i <= 15; $i++) { + for ($i = 0; $i <= 15; ++$i) { $f += $c[$i] * $c[$i]; } @@ -64,7 +64,7 @@ class SecureRandomTest extends \PHPUnit_Framework_TestCase $b = $this->getBitSequence($secureRandom, 20000); $runs = array(); - for ($i = 1; $i <= 6; $i++) { + for ($i = 1; $i <= 6; ++$i) { $runs[$i] = 0; } @@ -78,7 +78,7 @@ class SecureRandomTest extends \PHPUnit_Framework_TestCase $currentRun = 0; $lastBit = null; - for ($i = 0; $i < 20000; $i++) { + for ($i = 0; $i < 20000; ++$i) { if ($lastBit === $b[$i]) { ++$currentRun; } else { @@ -113,7 +113,7 @@ class SecureRandomTest extends \PHPUnit_Framework_TestCase $longestRun = $currentRun = 0; $lastBit = null; - for ($i = 0; $i < 20000; $i++) { + for ($i = 0; $i < 20000; ++$i) { if ($lastBit === $b[$i]) { ++$currentRun; } else { @@ -142,7 +142,7 @@ class SecureRandomTest extends \PHPUnit_Framework_TestCase $b = $this->getBitSequence($secureRandom, 20000); $Z = 0; - for ($i = 0; $i < 5000; $i++) { + for ($i = 0; $i < 5000; ++$i) { $Z += $b[$i] === $b[$i + $shift] ? 1 : 0; } diff --git a/Core/Util/StringUtils.php b/Core/Util/StringUtils.php index e68347f..343585c 100644 --- a/Core/Util/StringUtils.php +++ b/Core/Util/StringUtils.php @@ -60,7 +60,7 @@ class StringUtils $result = 0; - for ($i = 0; $i < $knownLen; $i++) { + for ($i = 0; $i < $knownLen; ++$i) { $result |= (ord($knownString[$i]) ^ ord($userInput[$i])); } diff --git a/Http/Tests/Authentication/DefaultAuthenticationFailureHandlerTest.php b/Http/Tests/Authentication/DefaultAuthenticationFailureHandlerTest.php index e065660..f642096 100644 --- a/Http/Tests/Authentication/DefaultAuthenticationFailureHandlerTest.php +++ b/Http/Tests/Authentication/DefaultAuthenticationFailureHandlerTest.php @@ -38,7 +38,7 @@ class DefaultAuthenticationFailureHandlerTest extends \PHPUnit_Framework_TestCas $this->session = $this->getMock('Symfony\Component\HttpFoundation\Session\SessionInterface'); $this->request = $this->getMock('Symfony\Component\HttpFoundation\Request'); $this->request->expects($this->any())->method('getSession')->will($this->returnValue($this->session)); - $this->exception = $this->getMock('Symfony\Component\Security\Core\Exception\AuthenticationException'); + $this->exception = $this->getMock('Symfony\Component\Security\Core\Exception\AuthenticationException', array('getMessage')); } public function testForward() |