[HttpKernel] fix nested calls to serialize when using DataCollector
This commit is contained in:
parent
b4357d734b
commit
3cfb558f03
@ -42,12 +42,15 @@ abstract class DataCollector implements DataCollectorInterface, \Serializable
|
||||
|
||||
public function serialize()
|
||||
{
|
||||
return serialize($this->data);
|
||||
$trace = debug_backtrace(DEBUG_BACKTRACE_PROVIDE_OBJECT, 2);
|
||||
$isCalledFromOverridingMethod = isset($trace[1]['function'], $trace[1]['object']) && 'serialize' === $trace[1]['function'] && $this === $trace[1]['object'];
|
||||
|
||||
return $isCalledFromOverridingMethod ? $this->data : serialize($this->data);
|
||||
}
|
||||
|
||||
public function unserialize($data)
|
||||
{
|
||||
$this->data = unserialize($data);
|
||||
$this->data = \is_array($data) ? $data : unserialize($data);
|
||||
}
|
||||
|
||||
/**
|
||||
|
Reference in New Issue
Block a user