Skip to content

Commit 5f0a704

Browse files
committed
Merge branch '2.7' into 2.8
* 2.7: Username and password in basic auth are allowed to contain '.' Remove obsolete PHPDoc from UriSigner [Serializer] ObjectNormalizer: throw if PropertyAccess isn't installed pdo session fix Fixed unsetting from loosely equal keys OrderedHashMap [Debug] Fix same vendor detection in class loader Updated the source text and translation reject remember-me token if user check fails
2 parents 6b9850a + 2fc9b57 commit 5f0a704

File tree

11 files changed

+44
-20
lines changed

11 files changed

+44
-20
lines changed

src/Symfony/Component/Debug/DebugClassLoader.php

Lines changed: 2 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -203,18 +203,11 @@ public function loadClass($class)
203203
} elseif (preg_match('#\n \* @deprecated (.*?)\r?\n \*(?: @|/$)#s', $refl->getDocComment(), $notice)) {
204204
self::$deprecated[$name] = preg_replace('#\s*\r?\n \* +#', ' ', $notice[1]);
205205
} else {
206-
if (2 > $len = 1 + (strpos($name, '\\', 1 + strpos($name, '\\')) ?: strpos($name, '_'))) {
206+
if (2 > $len = 1 + (strpos($name, '\\') ?: strpos($name, '_'))) {
207207
$len = 0;
208208
$ns = '';
209209
} else {
210-
switch ($ns = substr($name, 0, $len)) {
211-
case 'Symfony\Bridge\\':
212-
case 'Symfony\Bundle\\':
213-
case 'Symfony\Component\\':
214-
$ns = 'Symfony\\';
215-
$len = strlen($ns);
216-
break;
217-
}
210+
$ns = substr($name, 0, $len);
218211
}
219212
$parent = get_parent_class($class);
220213

src/Symfony/Component/Form/Resources/translations/validators.sv.xlf

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,8 @@
1111
<target>Den uppladdade filen var för stor. Försök ladda upp en mindre fil.</target>
1212
</trans-unit>
1313
<trans-unit id="30">
14-
<source>The CSRF token is invalid.</source>
15-
<target>CSRF-symbolen är inte giltig.</target>
14+
<source>The CSRF token is invalid. Please try to resubmit the form.</source>
15+
<target>CSRF-elementet är inte giltigt. Försök att skicka formuläret igen.</target>
1616
</trans-unit>
1717
</body>
1818
</file>

src/Symfony/Component/Form/Tests/Util/OrderedHashMapTest.php

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,15 @@ public function testInsertNullKeys()
5656
$this->assertSame(array(0 => 1, 'foo' => 2, 1 => 3), iterator_to_array($map));
5757
}
5858

59+
public function testInsertLooselyEqualKeys()
60+
{
61+
$map = new OrderedHashMap();
62+
$map['1 as a string'] = '1 as a string';
63+
$map[1] = 1;
64+
65+
$this->assertSame(array('1 as a string' => '1 as a string', 1 => 1), iterator_to_array($map));
66+
}
67+
5968
/**
6069
* Updates should not change the position of an element, otherwise we could
6170
* turn foreach loops into endless loops if they change the current
@@ -111,6 +120,17 @@ public function testUnset()
111120
$this->assertSame(array('second' => 2), iterator_to_array($map));
112121
}
113122

123+
public function testUnsetFromLooselyEqualKeysHashMap()
124+
{
125+
$map = new OrderedHashMap();
126+
$map['1 as a string'] = '1 as a string';
127+
$map[1] = 1;
128+
129+
unset($map[1]);
130+
131+
$this->assertSame(array('1 as a string' => '1 as a string'), iterator_to_array($map));
132+
}
133+
114134
public function testUnsetNonExistingSucceeds()
115135
{
116136
$map = new OrderedHashMap();

src/Symfony/Component/Form/Util/OrderedHashMap.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -133,7 +133,7 @@ public function offsetSet($key, $value)
133133
: 1 + (int) max($this->orderedKeys);
134134
}
135135

136-
$this->orderedKeys[] = $key;
136+
$this->orderedKeys[] = (string) $key;
137137
}
138138

139139
$this->elements[$key] = $value;
@@ -144,7 +144,7 @@ public function offsetSet($key, $value)
144144
*/
145145
public function offsetUnset($key)
146146
{
147-
if (false !== ($position = array_search($key, $this->orderedKeys))) {
147+
if (false !== ($position = array_search((string) $key, $this->orderedKeys))) {
148148
array_splice($this->orderedKeys, $position, 1);
149149
unset($this->elements[$key]);
150150

src/Symfony/Component/Form/Util/OrderedHashMapIterator.php

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -118,7 +118,13 @@ public function next()
118118
*/
119119
public function key()
120120
{
121-
return $this->key;
121+
if (null === $this->key) {
122+
return null;
123+
}
124+
125+
$array = array($this->key => null);
126+
127+
return key($array);
122128
}
123129

124130
/**

src/Symfony/Component/HttpFoundation/Session/Storage/Handler/PdoSessionHandler.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -387,7 +387,7 @@ public function close()
387387
$this->gcCalled = false;
388388

389389
// delete the session records that have expired
390-
$sql = "DELETE FROM $this->table WHERE $this->lifetimeCol + $this->timeCol < :time";
390+
$sql = "DELETE FROM $this->table WHERE $this->lifetimeCol < :time - $this->timeCol";
391391

392392
$stmt = $this->pdo->prepare($sql);
393393
$stmt->bindValue(':time', time(), \PDO::PARAM_INT);

src/Symfony/Component/HttpKernel/UriSigner.php

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -55,10 +55,6 @@ public function sign($uri)
5555
/**
5656
* Checks that a URI contains the correct hash.
5757
*
58-
* The _hash query string parameter must be the last one
59-
* (as it is generated that way by the sign() method, it should
60-
* never be a problem).
61-
*
6258
* @param string $uri A signed URI
6359
*
6460
* @return bool True if the URI is signed correctly, false otherwise

src/Symfony/Component/Security/Core/Authentication/Provider/RememberMeAuthenticationProvider.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,7 @@ public function authenticate(TokenInterface $token)
4949

5050
$user = $token->getUser();
5151
$this->userChecker->checkPreAuth($user);
52+
$this->userChecker->checkPostAuth($user);
5253

5354
$authenticatedToken = new RememberMeToken($user, $this->providerKey, $this->secret);
5455
$authenticatedToken->setAttributes($token->getAttributes());

src/Symfony/Component/Serializer/Normalizer/ObjectNormalizer.php

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@
1616
use Symfony\Component\PropertyAccess\PropertyAccessorInterface;
1717
use Symfony\Component\Serializer\Exception\CircularReferenceException;
1818
use Symfony\Component\Serializer\Exception\LogicException;
19+
use Symfony\Component\Serializer\Exception\RuntimeException;
1920
use Symfony\Component\Serializer\Mapping\Factory\ClassMetadataFactoryInterface;
2021
use Symfony\Component\Serializer\NameConverter\NameConverterInterface;
2122

@@ -35,6 +36,10 @@ class ObjectNormalizer extends AbstractNormalizer
3536

3637
public function __construct(ClassMetadataFactoryInterface $classMetadataFactory = null, NameConverterInterface $nameConverter = null, PropertyAccessorInterface $propertyAccessor = null)
3738
{
39+
if (!class_exists('Symfony\Component\PropertyAccess\PropertyAccess')) {
40+
throw new RuntimeException('The ObjectNormalizer class requires the "PropertyAccess" component. Install "symfony/property-access" to use it.');
41+
}
42+
3843
parent::__construct($classMetadataFactory, $nameConverter);
3944

4045
$this->propertyAccessor = $propertyAccessor ?: PropertyAccess::createPropertyAccessor();

src/Symfony/Component/Validator/Constraints/UrlValidator.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ class UrlValidator extends ConstraintValidator
2323
{
2424
const PATTERN = '~^
2525
(%s):// # protocol
26-
(([\pL\pN-]+:)?([\pL\pN-]+)@)? # basic auth
26+
(([\.\pL\pN-]+:)?([\.\pL\pN-]+)@)? # basic auth
2727
(
2828
([\pL\pN\pS-\.])+(\.?([\pL\pN]|xn\-\-[\pL\pN-]+)+\.?) # a domain name
2929
| # or

0 commit comments

Comments
 (0)