mirror of
https://github.com/symfony/http-kernel.git
synced 2026-03-24 01:12:09 +01:00
Merge branch '6.4' into 7.3
* 6.4: Replace __sleep/wakeup() by __(un)serialize() for throwing and internal usages
This commit is contained in:
@@ -143,10 +143,7 @@ class DumpDataCollector extends DataCollector implements DataDumperInterface
|
||||
$this->clonesIndex = 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* @internal
|
||||
*/
|
||||
public function __sleep(): array
|
||||
public function __serialize(): array
|
||||
{
|
||||
if (!$this->dataCount) {
|
||||
$this->data = [];
|
||||
@@ -161,16 +158,12 @@ class DumpDataCollector extends DataCollector implements DataDumperInterface
|
||||
$this->dataCount = 0;
|
||||
$this->isCollected = true;
|
||||
|
||||
return parent::__sleep();
|
||||
return ['data' => $this->data];
|
||||
}
|
||||
|
||||
/**
|
||||
* @internal
|
||||
*/
|
||||
public function __wakeup(): void
|
||||
public function __unserialize(array $data): void
|
||||
{
|
||||
parent::__wakeup();
|
||||
|
||||
$this->data = array_pop($data) ?? [];
|
||||
$charset = array_pop($this->data);
|
||||
$fileLinkFormat = array_pop($this->data);
|
||||
$this->dataCount = \count($this->data);
|
||||
|
||||
@@ -60,7 +60,7 @@ class DumpDataCollectorTest extends TestCase
|
||||
$this->assertSame(0, $collector->getDumpsCount());
|
||||
|
||||
$serialized = serialize($collector);
|
||||
$this->assertSame("O:60:\"Symfony\Component\HttpKernel\DataCollector\DumpDataCollector\":1:{s:7:\"\0*\0data\";a:2:{i:0;b:0;i:1;s:5:\"UTF-8\";}}", $serialized);
|
||||
$this->assertSame("O:60:\"Symfony\Component\HttpKernel\DataCollector\DumpDataCollector\":1:{s:4:\"data\";a:2:{i:0;b:0;i:1;s:5:\"UTF-8\";}}", $serialized);
|
||||
|
||||
$this->assertInstanceOf(DumpDataCollector::class, unserialize($serialized));
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user