Skip to content

Commit f51d4d4

Browse files
committed
Merge branch '2.8' into 3.3
* 2.8: Username and password in basic auth are allowed to contain '.' Remove obsolete PHPDoc from UriSigner [Serializer] ObjectNormalizer: throw if PropertyAccess isn't installed [PropertyInfo] Add support for the iterable type 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 7ac01bc + 5f0a704 commit f51d4d4

File tree

13 files changed

+53
-21
lines changed

13 files changed

+53
-21
lines changed

src/Symfony/Component/Debug/DebugClassLoader.php

Lines changed: 2 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -204,18 +204,11 @@ public function loadClass($class)
204204
self::$deprecated[$name] = preg_replace('#\s*\r?\n \* +#', ' ', $notice[1]);
205205
} else {
206206
// Don't trigger deprecations for classes in the same vendor
207-
if (2 > $len = 1 + (strpos($name, '\\', 1 + strpos($name, '\\')) ?: strpos($name, '_'))) {
207+
if (2 > $len = 1 + (strpos($name, '\\') ?: strpos($name, '_'))) {
208208
$len = 0;
209209
$ns = '';
210210
} else {
211-
switch ($ns = substr($name, 0, $len)) {
212-
case 'Symfony\Bridge\\':
213-
case 'Symfony\Bundle\\':
214-
case 'Symfony\Component\\':
215-
$ns = 'Symfony\\';
216-
$len = strlen($ns);
217-
break;
218-
}
211+
$ns = substr($name, 0, $len);
219212
}
220213

221214
if (!$parent || strncmp($ns, $parent, $len)) {

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
@@ -58,10 +58,6 @@ public function sign($uri)
5858
/**
5959
* Checks that a URI contains the correct hash.
6060
*
61-
* The query string parameter must be the last one
62-
* (as it is generated that way by the sign() method, it should
63-
* never be a problem).
64-
*
6561
* @param string $uri A signed URI
6662
*
6763
* @return bool True if the URI is signed correctly, false otherwise

src/Symfony/Component/PropertyInfo/Tests/TypeTest.php

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,12 @@ public function testConstruct()
3737
$this->assertEquals(Type::BUILTIN_TYPE_STRING, $collectionValueType->getBuiltinType());
3838
}
3939

40+
public function testIterable()
41+
{
42+
$type = new Type('iterable');
43+
$this->assertSame('iterable', $type->getBuiltinType());
44+
}
45+
4046
/**
4147
* @expectedException \InvalidArgumentException
4248
* @expectedExceptionMessage "foo" is not a valid PHP type.

src/Symfony/Component/PropertyInfo/Type.php

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@ class Type
2929
const BUILTIN_TYPE_ARRAY = 'array';
3030
const BUILTIN_TYPE_NULL = 'null';
3131
const BUILTIN_TYPE_CALLABLE = 'callable';
32+
const BUILTIN_TYPE_ITERABLE = 'iterable';
3233

3334
/**
3435
* List of PHP builtin types.
@@ -45,6 +46,7 @@ class Type
4546
self::BUILTIN_TYPE_ARRAY,
4647
self::BUILTIN_TYPE_CALLABLE,
4748
self::BUILTIN_TYPE_NULL,
49+
self::BUILTIN_TYPE_ITERABLE,
4850
);
4951

5052
/**
@@ -104,7 +106,7 @@ public function __construct($builtinType, $nullable = false, $class = null, $col
104106
/**
105107
* Gets built-in type.
106108
*
107-
* Can be bool, int, float, string, array, object, resource, null or callback.
109+
* Can be bool, int, float, string, array, object, resource, null, callback or iterable.
108110
*
109111
* @return string
110112
*/

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());

0 commit comments

Comments
 (0)