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;
|
||||
}
|
||||
|
||||
if ($isReferencedByConstructor && $this->container->getDefinition($srcId)->isLazy() && ($definition->getProperties() || $definition->getMethodCalls() || $definition->getConfigurator())) {
|
||||
return false;
|
||||
}
|
||||
|
||||
return $this->container->getDefinition($srcId)->isShared();
|
||||
}
|
||||
}
|
||||
|
@ -655,6 +655,7 @@ EOF;
|
||||
$autowired = $definition->isAutowired() ? ' autowired' : '';
|
||||
|
||||
if ($definition->isLazy()) {
|
||||
unset($this->circularReferences[$id]);
|
||||
$lazyInitialization = '$lazyLoad = true';
|
||||
} else {
|
||||
$lazyInitialization = '';
|
||||
|
@ -52,7 +52,7 @@ abstract class AbstractType implements FormTypeInterface
|
||||
*/
|
||||
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()
|
||||
{
|
||||
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);
|
||||
}
|
||||
|
@ -15,6 +15,21 @@ use PHPUnit\Framework\TestCase;
|
||||
use Symfony\Component\Security\Core\Authentication\Token\AnonymousToken;
|
||||
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
|
||||
{
|
||||
public function testConstructWithSAfeMessage()
|
||||
@ -39,4 +54,18 @@ class CustomUserMessageAuthenticationExceptionTest extends TestCase
|
||||
$this->assertEquals($token, $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