Skip to content

Commit bb6ad0f

Browse files
Merge branch '3.4'
* 3.4: (26 commits) [Routing] Fix resource miss [Security] Fixed auth provider authenticate() cannot return void [FrameworkBundle][Serializer] Move DateIntervalNormalizer definition to xml declare argument type Improving annotation loader message [FrameworkBundle][Serializer] Move normalizer/encoders definitions to xml file & remove unnecessary checks Update UPGRADE-4.0.md streamed response should return $this $isClientIpsVali is not used [WebServerBundle] Prevent commands from being registered by convention content can be a resource Adding the Form default theme files to be warmed up in Twig's cache Remove BC Break label from `NullDumper` class Username and password in basic auth are allowed to contain '.' Remove obsolete PHPDoc from UriSigner [Serializer] YamlEncoder: throw if the Yaml component isn't installed [Serializer] ObjectNormalizer: throw if PropertyAccess isn't installed [PropertyInfo] Add support for the iterable type pdo session fix Fixed pathinfo calculation for requests starting with a question mark. - fix bad conflict resolving issue - port symfony/symfony#21968 to 3.3+ ...
2 parents 4aee8cc + 36ee9ff commit bb6ad0f

File tree

6 files changed

+50
-11
lines changed

6 files changed

+50
-11
lines changed

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>

Tests/ButtonBuilderTest.php

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313

1414
use PHPUnit\Framework\TestCase;
1515
use Symfony\Component\Form\ButtonBuilder;
16+
use Symfony\Component\Form\Exception\InvalidArgumentException;
1617

1718
/**
1819
* @author Alexander Cheprasov <[email protected]>
@@ -53,10 +54,12 @@ public function getInvalidNames()
5354
*/
5455
public function testInvalidNames($name)
5556
{
56-
$this->{method_exists($this, $_ = 'expectException') ? $_ : 'setExpectedException'}(
57-
'\Symfony\Component\Form\Exception\InvalidArgumentException',
58-
'Buttons cannot have empty names.'
59-
);
57+
if (method_exists($this, 'expectException')) {
58+
$this->expectException(InvalidArgumentException::class);
59+
$this->expectExceptionMessage('Buttons cannot have empty names.');
60+
} else {
61+
$this->setExpectedException(InvalidArgumentException::class, 'Buttons cannot have empty names.');
62+
}
6063
new ButtonBuilder($name);
6164
}
6265
}

Tests/Extension/Core/DataTransformer/DateIntervalToArrayTransformerTest.php

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -181,7 +181,12 @@ public function testReverseTransformWithEmptyFields()
181181
'minutes' => '',
182182
'seconds' => '6',
183183
);
184-
$this->{method_exists($this, $_ = 'expectException') ? $_ : 'setExpectedException'}(TransformationFailedException::class, 'This amount of "minutes" is invalid');
184+
if (method_exists($this, 'expectException')) {
185+
$this->expectException(TransformationFailedException::class);
186+
$this->expectExceptionMessage('This amount of "minutes" is invalid');
187+
} else {
188+
$this->setExpectedException(TransformationFailedException::class, 'This amount of "minutes" is invalid');
189+
}
185190
$transformer->reverseTransform($input);
186191
}
187192

@@ -191,7 +196,12 @@ public function testReverseTransformWithWrongInvertType()
191196
$input = array(
192197
'invert' => '1',
193198
);
194-
$this->{method_exists($this, $_ = 'expectException') ? $_ : 'setExpectedException'}(TransformationFailedException::class, 'The value of "invert" must be boolean');
199+
if (method_exists($this, 'expectException')) {
200+
$this->expectException(TransformationFailedException::class);
201+
$this->expectExceptionMessage('The value of "invert" must be boolean');
202+
} else {
203+
$this->setExpectedException(TransformationFailedException::class, 'The value of "invert" must be boolean');
204+
}
195205
$transformer->reverseTransform($input);
196206
}
197207

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

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

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
/**

0 commit comments

Comments
 (0)