8000 Merge branch '3.4' into 4.2 · symfony/symfony@4f6541e · GitHub
[go: up one dir, main page]

Skip to content

Commit 4f6541e

Browse files
Merge branch '3.4' into 4.2
* 3.4: [DI] Fix dumping Doctrine-like service graphs fix serialization workaround in CustomUserMessageAuthenticationException PHPUnit Bridge: Rollback to traditional array syntax. [Form] fix some docblocks and type checks
2 parents bc8656c + 5b1948e commit 4f6541e

File tree

5 files changed

+32
-6
lines changed

5 files changed

+32
-6
lines changed

src/Symfony/Component/DependencyInjection/Compiler/InlineServiceDefinitionsPass.php

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -217,10 +217,6 @@ private function isInlineableDefinition($id, Definition $definition)
217217
return false;
218218
}
219219

220-
if ($isReferencedByConstructor && $this->container->getDefinition($srcId)->isLazy() && ($definition->getProperties() || $definition->getMethodCalls() || $definition->getConfigurator())) {
221-
return false;
222-
}
223-
224220
return $this->container->getDefinition($srcId)->isShared();
225221
}
226222
}

src/Symfony/Component/DependencyInjection/Dumper/PhpDumper.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -655,6 +655,7 @@ private function addService(string $id, Definition $definition): array
655655
$autowired = $definition->isAutowired() ? ' autowired' : '';
656656

657657
if ($definition->isLazy()) {
658+
unset($this->circularReferences[$id]);
658659
$lazyInitialization = '$lazyLoad = true';
659660
} else {
660661
$lazyInitialization = '';

src/Symfony/Component/Form/AbstractType.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ public function configureOptions(OptionsResolver $resolver)
5252
*/
5353
public function getBlockPrefix()
5454
{
55-
return StringUtil::fqcnToBlockPrefix(\get_class($this));
55+
return StringUtil::fqcnToBlockPrefix(\get_class($this)) ?: '';
5656
}
5757

5858
/**

src/Symfony/Component/Security/Core/Exception/CustomUserMessageAuthenticationException.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ public function getMessageData()
6060
*/
6161
public function serialize()
6262
{
63-
return serialize([parent::serialize(true), $this->messageKey, $this->messageData]);
63+
$serialized = [parent::serialize(true), $this->messageKey, $this->messageData];
6464

6565
return $this->doSerialize($serialized, \func_num_args() ? \func_get_arg(0) : null);
6666
}

src/Symfony/Component/Security/Core/Tests/Exception/CustomUserMessageAuthenticationExceptionTest.php

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,21 @@
1515
use Symfony\Component\Security\Core\Authentication\Token\AnonymousToken;
1616
use Symfony\Component\Security\Core\Exception\CustomUserMessageAuthenticationException;
1717

18+
class ChildCustomUserMessageAuthenticationException extends CustomUserMessageAuthenticationException
19+
{
20+
public function serialize()
21+
{
22+
return serialize([$this->childMember, parent::serialize()]);
23+
}
24+
25+
public function unserialize($str)
26+
{
27+
list($this->childMember, $parentData) = unserialize($str);
28+
29+
parent::unserialize($parentData);
30+
}
31+
}
32+
1833
class CustomUserMessageAuthenticationExceptionTest extends TestCase
1934
{
2035
public function testConstructWithSAfeMessage()
@@ -39,4 +54,18 @@ public function testSharedSerializedData()
3954
$this->assertEquals($token, $processed->getMessageData()['token']);
4055
$this->assertSame($processed->getToken(), $processed->getMessageData()['token']);
4156
}
57+
58+
public function testSharedSerializedDataFromChild()
59+
{
60+
$token = new AnonymousToken('foo', 'bar');
61+
62+
$exception = new ChildCustomUserMessageAuthenticationException();
63+
$exception->childMember = $token;
64+
$exception->setToken($token);
65+
66+
$processed = unserialize(serialize($exception));
67+
$this->assertEquals($token, $processed->childMember);
68+
$this->assertEquals($token, $processed->getToken());
69+
$this->assertSame($processed->getToken(), $processed->childMember);
70+
}
4271
}

0 commit comments

Comments
 (0)
0