diff options
author | Fabien Potencier <fabien.potencier@gmail.com> | 2015-03-30 17:54:10 +0200 |
---|---|---|
committer | Fabien Potencier <fabien.potencier@gmail.com> | 2015-03-30 17:54:10 +0200 |
commit | 06dbcd5a5464cccf4c748071f338f34130ecad06 (patch) | |
tree | 428d8a384142a48561d6092a5583da954649b7b6 | |
parent | 94465e02e58f9a17b29dd4afbcac5c02af4bf7e0 (diff) | |
parent | 25e914f2b63d4021af1fb0e510ac0843f1bdb3ee (diff) | |
download | symfony-security-06dbcd5a5464cccf4c748071f338f34130ecad06.zip symfony-security-06dbcd5a5464cccf4c748071f338f34130ecad06.tar.gz symfony-security-06dbcd5a5464cccf4c748071f338f34130ecad06.tar.bz2 |
Merge branch '2.3' into 2.6v2.6.6
* 2.3:
[Validator] Add missing pt_BR translations
Add parsing of hexadecimal strings for PHP 7
[Configuration] improve description for ignoreExtraKeys on ArrayNodeDefinition
[Validator] Added missing Hungarian translation
[Validator] Fixed grammar in Hungarian translation
CS: Unary operators should be placed adjacent to their operands
CS: Binary operators should be arounded by at least one space
remove useless tests that fail in php 7
[Translator] fix test for php 7 compatibility
Update phpdoc of ProcessBuilder#setPrefix()
Conflicts:
src/Symfony/Component/HttpFoundation/Session/Attribute/NamespacedAttributeBag.php
src/Symfony/Component/PropertyAccess/PropertyAccessor.php
src/Symfony/Component/Validator/Resources/translations/validators.pt_BR.xlf
src/Symfony/Component/Yaml/Parser.php
-rw-r--r-- | Acl/Dbal/AclProvider.php | 8 | ||||
-rw-r--r-- | Acl/Dbal/MutableAclProvider.php | 6 | ||||
-rw-r--r-- | Acl/Domain/Acl.php | 28 | ||||
-rw-r--r-- | Acl/Permission/MaskBuilder.php | 2 | ||||
-rw-r--r-- | Acl/Tests/Dbal/AclProviderBenchmarkTest.php | 18 | ||||
-rw-r--r-- | Core/Authentication/Token/AbstractToken.php | 4 | ||||
-rw-r--r-- | Core/Tests/Authentication/Token/RememberMeTokenTest.php | 17 | ||||
-rw-r--r-- | Core/Tests/Util/SecureRandomTest.php | 2 | ||||
-rw-r--r-- | Http/Tests/RememberMe/TokenBasedRememberMeServicesTest.php | 4 |
9 files changed, 36 insertions, 53 deletions
diff --git a/Acl/Dbal/AclProvider.php b/Acl/Dbal/AclProvider.php index fd6f5ba..4714fb3 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; @@ -315,7 +315,7 @@ SELECTCLAUSE; $this->connection->quote($batch[$i]->getType()) ); - if ($i+1 < $count) { + if ($i + 1 < $count) { $sql .= ' OR '; } } @@ -509,8 +509,8 @@ QUERY; $acls = $aces = $emptyArray = array(); $oidCache = $oidLookup; $result = new \SplObjectStorage(); - $loadedAces = & $this->loadedAces; - $loadedAcls = & $this->loadedAcls; + $loadedAces = &$this->loadedAces; + $loadedAcls = &$this->loadedAcls; $permissionGrantingStrategy = $this->permissionGrantingStrategy; // we need these to set protected properties on hydrated objects diff --git a/Acl/Dbal/MutableAclProvider.php b/Acl/Dbal/MutableAclProvider.php index 023a22f..b28e2b2 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()) { @@ -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()) { diff --git a/Acl/Domain/Acl.php b/Acl/Domain/Acl.php index 5649719..61153af 100644 --- a/Acl/Domain/Acl.php +++ b/Acl/Domain/Acl.php @@ -399,7 +399,7 @@ class Acl implements AuditableAclInterface, NotifyPropertyChanged */ private function deleteAce($property, $index) { - $aces = & $this->$property; + $aces = &$this->$property; if (!isset($aces[$index])) { throw new \OutOfBoundsException(sprintf('The index "%d" does not exist.', $index)); } @@ -409,8 +409,8 @@ 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++) { - $this->onEntryPropertyChanged($aces[$i], 'aceOrder', $i+1, $i); + for ($i = $index, $c = count($this->$property); $i < $c; $i++) { + $this->onEntryPropertyChanged($aces[$i], 'aceOrder', $i + 1, $i); } } @@ -425,7 +425,7 @@ class Acl implements AuditableAclInterface, NotifyPropertyChanged */ private function deleteFieldAce($property, $index, $field) { - $aces = & $this->$property; + $aces = &$this->$property; if (!isset($aces[$field][$index])) { throw new \OutOfBoundsException(sprintf('The index "%d" does not exist.', $index)); } @@ -435,8 +435,8 @@ 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++) { - $this->onEntryPropertyChanged($aces[$field][$i], 'aceOrder', $i+1, $i); + for ($i = $index, $c = count($aces[$field]); $i < $c; $i++) { + $this->onEntryPropertyChanged($aces[$field][$i], 'aceOrder', $i + 1, $i); } } @@ -471,7 +471,7 @@ class Acl implements AuditableAclInterface, NotifyPropertyChanged } } - $aces = & $this->$property; + $aces = &$this->$property; $oldValue = $this->$property; if (isset($aces[$index])) { $this->$property = array_merge( @@ -480,8 +480,8 @@ class Acl implements AuditableAclInterface, NotifyPropertyChanged array_slice($this->$property, $index) ); - for ($i = $index, $c = count($this->$property)-1; $i<$c; $i++) { - $this->onEntryPropertyChanged($aces[$i+1], 'aceOrder', $i, $i+1); + for ($i = $index, $c = count($this->$property) - 1; $i < $c; $i++) { + $this->onEntryPropertyChanged($aces[$i + 1], 'aceOrder', $i, $i + 1); } } @@ -521,7 +521,7 @@ class Acl implements AuditableAclInterface, NotifyPropertyChanged } } - $aces = & $this->$property; + $aces = &$this->$property; if (!isset($aces[$field])) { $aces[$field] = array(); } @@ -538,8 +538,8 @@ class Acl implements AuditableAclInterface, NotifyPropertyChanged array_slice($aces[$field], $index) ); - for ($i = $index, $c = count($aces[$field])-1; $i<$c; $i++) { - $this->onEntryPropertyChanged($aces[$field][$i+1], 'aceOrder', $i, $i+1); + for ($i = $index, $c = count($aces[$field]) - 1; $i < $c; $i++) { + $this->onEntryPropertyChanged($aces[$field][$i + 1], 'aceOrder', $i, $i + 1); } } @@ -559,7 +559,7 @@ class Acl implements AuditableAclInterface, NotifyPropertyChanged */ private function updateAce($property, $index, $mask, $strategy = null) { - $aces = & $this->$property; + $aces = &$this->$property; if (!isset($aces[$index])) { throw new \OutOfBoundsException(sprintf('The index "%d" does not exist.', $index)); } @@ -620,7 +620,7 @@ class Acl implements AuditableAclInterface, NotifyPropertyChanged throw new \InvalidArgumentException('$field cannot be empty.'); } - $aces = & $this->$property; + $aces = &$this->$property; if (!isset($aces[$field][$index])) { throw new \OutOfBoundsException(sprintf('The index "%d" does not exist.', $index)); } diff --git a/Acl/Permission/MaskBuilder.php b/Acl/Permission/MaskBuilder.php index 5364c9b..589adaa 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 599b9c4..1f96752 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) { @@ -124,9 +124,9 @@ class AclProviderBenchmarkTest extends \PHPUnit_Framework_TestCase $this->insertClassStmt->execute(array($id, $this->getRandomString(rand(20, 100), 'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789\\_'))); ++$id; - return $id-1; + return $id - 1; } else { - return rand(1000, $id-1); + return rand(1000, $id - 1); } } @@ -150,7 +150,7 @@ class AclProviderBenchmarkTest extends \PHPUnit_Framework_TestCase $this->generateAces($classId, $id); ++$id; - return $id-1; + return $id - 1; } protected function chooseSid() @@ -165,9 +165,9 @@ class AclProviderBenchmarkTest extends \PHPUnit_Framework_TestCase )); ++$id; - return $id-1; + return $id - 1; } else { - return rand(1000, $id-1); + return rand(1000, $id - 1); } } @@ -185,7 +185,7 @@ class AclProviderBenchmarkTest extends \PHPUnit_Framework_TestCase $sid = $this->chooseSid(); } while (array_key_exists($sid, $sids) && in_array($fieldName, $sids[$sid], true)); - $fieldOrder[$fieldName] = array_key_exists($fieldName, $fieldOrder) ? $fieldOrder[$fieldName]+1 : 0; + $fieldOrder[$fieldName] = array_key_exists($fieldName, $fieldOrder) ? $fieldOrder[$fieldName] + 1 : 0; if (!isset($sids[$sid])) { $sids[$sid] = array(); } @@ -238,7 +238,7 @@ class AclProviderBenchmarkTest extends \PHPUnit_Framework_TestCase $cLength = strlen($chars); while (strlen($s) < $length) { - $s .= $chars[mt_rand(0, $cLength-1)]; + $s .= $chars[mt_rand(0, $cLength - 1)]; } return $s; diff --git a/Core/Authentication/Token/AbstractToken.php b/Core/Authentication/Token/AbstractToken.php index c6bf09f..1d12ab0 100644 --- a/Core/Authentication/Token/AbstractToken.php +++ b/Core/Authentication/Token/AbstractToken.php @@ -231,7 +231,7 @@ abstract class AbstractToken implements TokenInterface public function __toString() { $class = get_class($this); - $class = substr($class, strrpos($class, '\\')+1); + $class = substr($class, strrpos($class, '\\') + 1); $roles = array(); foreach ($this->roles as $role) { @@ -248,7 +248,7 @@ abstract class AbstractToken implements TokenInterface } if ($this->user instanceof EquatableInterface) { - return ! (bool) $this->user->isEqualTo($user); + return !(bool) $this->user->isEqualTo($user); } if ($this->user->getPassword() !== $user->getPassword()) { diff --git a/Core/Tests/Authentication/Token/RememberMeTokenTest.php b/Core/Tests/Authentication/Token/RememberMeTokenTest.php index 691f54c..7449204 100644 --- a/Core/Tests/Authentication/Token/RememberMeTokenTest.php +++ b/Core/Tests/Authentication/Token/RememberMeTokenTest.php @@ -52,23 +52,6 @@ class RememberMeTokenTest extends \PHPUnit_Framework_TestCase ); } - /** - * @expectedException \PHPUnit_Framework_Error - * @dataProvider getUserArguments - */ - public function testConstructorUserCannotBeNull($user) - { - new RememberMeToken($user, 'foo', 'foo'); - } - - public function getUserArguments() - { - return array( - array(null), - array('foo'), - ); - } - protected function getUser($roles = array('ROLE_FOO')) { $user = $this->getMock('Symfony\Component\Security\Core\User\UserInterface'); diff --git a/Core/Tests/Util/SecureRandomTest.php b/Core/Tests/Util/SecureRandomTest.php index 590efd3..5dfe1c8 100644 --- a/Core/Tests/Util/SecureRandomTest.php +++ b/Core/Tests/Util/SecureRandomTest.php @@ -49,7 +49,7 @@ class SecureRandomTest extends \PHPUnit_Framework_TestCase $f += $c[$i] * $c[$i]; } - $Y = 16/5000 * $f - 5000; + $Y = 16 / 5000 * $f - 5000; $this->assertTrue($Y > 1.03 && $Y < 57.4, 'Poker test failed, Y = '.$Y); } diff --git a/Http/Tests/RememberMe/TokenBasedRememberMeServicesTest.php b/Http/Tests/RememberMe/TokenBasedRememberMeServicesTest.php index 8c215e2..9801bc8 100644 --- a/Http/Tests/RememberMe/TokenBasedRememberMeServicesTest.php +++ b/Http/Tests/RememberMe/TokenBasedRememberMeServicesTest.php @@ -43,7 +43,7 @@ class TokenBasedRememberMeServicesTest extends \PHPUnit_Framework_TestCase $userProvider = $this->getProvider(); $service = $this->getService($userProvider, array('name' => 'foo', 'path' => null, 'domain' => null, 'always_remember_me' => true, 'lifetime' => 3600)); $request = new Request(); - $request->cookies->set('foo', $this->getCookie('fooclass', 'foouser', time()+3600, 'foopass')); + $request->cookies->set('foo', $this->getCookie('fooclass', 'foouser', time() + 3600, 'foopass')); $userProvider ->expects($this->once()) @@ -129,7 +129,7 @@ class TokenBasedRememberMeServicesTest extends \PHPUnit_Framework_TestCase $service = $this->getService($userProvider, array('name' => 'foo', 'always_remember_me' => true, 'lifetime' => 3600)); $request = new Request(); - $request->cookies->set('foo', $this->getCookie('fooclass', 'foouser', time()+3600, 'foopass')); + $request->cookies->set('foo', $this->getCookie('fooclass', 'foouser', time() + 3600, 'foopass')); $returnedToken = $service->autoLogin($request); |