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
This commit is contained in:
commit
4f6541e4f5
@ -217,10 +217,6 @@ class InlineServiceDefinitionsPass extends AbstractRecursivePass implements Repe
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($isReferencedByConstructor && $this->container->getDefinition($srcId)->isLazy() && ($definition->getProperties() || $definition->getMethodCalls() || $definition->getConfigurator())) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
return $this->container->getDefinition($srcId)->isShared();
|
return $this->container->getDefinition($srcId)->isShared();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -655,6 +655,7 @@ EOF;
|
|||||||
$autowired = $definition->isAutowired() ? ' autowired' : '';
|
$autowired = $definition->isAutowired() ? ' autowired' : '';
|
||||||
|
|
||||||
if ($definition->isLazy()) {
|
if ($definition->isLazy()) {
|
||||||
|
unset($this->circularReferences[$id]);
|
||||||
$lazyInitialization = '$lazyLoad = true';
|
$lazyInitialization = '$lazyLoad = true';
|
||||||
} else {
|
} else {
|
||||||
$lazyInitialization = '';
|
$lazyInitialization = '';
|
||||||
|
@ -52,7 +52,7 @@ abstract class AbstractType implements FormTypeInterface
|
|||||||
*/
|
*/
|
||||||
public function getBlockPrefix()
|
public function getBlockPrefix()
|
||||||
{
|
{
|
||||||
return StringUtil::fqcnToBlockPrefix(\get_class($this));
|
return StringUtil::fqcnToBlockPrefix(\get_class($this)) ?: '';
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -60,7 +60,7 @@ class CustomUserMessageAuthenticationException extends AuthenticationException
|
|||||||
*/
|
*/
|
||||||
public function serialize()
|
public function serialize()
|
||||||
{
|
{
|
||||||
return serialize([parent::serialize(true), $this->messageKey, $this->messageData]);
|
$serialized = [parent::serialize(true), $this->messageKey, $this->messageData];
|
||||||
|
|
||||||
return $this->doSerialize($serialized, \func_num_args() ? \func_get_arg(0) : null);
|
return $this->doSerialize($serialized, \func_num_args() ? \func_get_arg(0) : null);
|
||||||
}
|
}
|
||||||
|
@ -15,6 +15,21 @@ use PHPUnit\Framework\TestCase;
|
|||||||
use Symfony\Component\Security\Core\Authentication\Token\AnonymousToken;
|
use Symfony\Component\Security\Core\Authentication\Token\AnonymousToken;
|
||||||
use Symfony\Component\Security\Core\Exception\CustomUserMessageAuthenticationException;
|
use Symfony\Component\Security\Core\Exception\CustomUserMessageAuthenticationException;
|
||||||
|
|
||||||
|
class ChildCustomUserMessageAuthenticationException extends CustomUserMessageAuthenticationException
|
||||||
|
{
|
||||||
|
public function serialize()
|
||||||
|
{
|
||||||
|
return serialize([$this->childMember, parent::serialize()]);
|
||||||
|
}
|
||||||
|
|
||||||
|
public function unserialize($str)
|
||||||
|
{
|
||||||
|
list($this->childMember, $parentData) = unserialize($str);
|
||||||
|
|
||||||
|
parent::unserialize($parentData);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
class CustomUserMessageAuthenticationExceptionTest extends TestCase
|
class CustomUserMessageAuthenticationExceptionTest extends TestCase
|
||||||
{
|
{
|
||||||
public function testConstructWithSAfeMessage()
|
public function testConstructWithSAfeMessage()
|
||||||
@ -39,4 +54,18 @@ class CustomUserMessageAuthenticationExceptionTest extends TestCase
|
|||||||
$this->assertEquals($token, $processed->getMessageData()['token']);
|
$this->assertEquals($token, $processed->getMessageData()['token']);
|
||||||
$this->assertSame($processed->getToken(), $processed->getMessageData()['token']);
|
$this->assertSame($processed->getToken(), $processed->getMessageData()['token']);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function testSharedSerializedDataFromChild()
|
||||||
|
{
|
||||||
|
$token = new AnonymousToken('foo', 'bar');
|
||||||
|
|
||||||
|
$exception = new ChildCustomUserMessageAuthenticationException();
|
||||||
|
$exception->childMember = $token;
|
||||||
|
$exception->setToken($token);
|
||||||
|
|
||||||
|
$processed = unserialize(serialize($exception));
|
||||||
|
$this->assertEquals($token, $processed->childMember);
|
||||||
|
$this->assertEquals($token, $processed->getToken());
|
||||||
|
$this->assertSame($processed->getToken(), $processed->childMember);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user