[php-src] Issue #12522: Serialization segmentation fault when serializing references
| From: | ssigwart | Date: | Wed, 25 Oct 2023 16:12:07 +0000 |
| Subject: | [php-src] Issue #12522: Serialization segmentation fault when serializing references | ||
| Groups: | php.bugs | ||
| Request: | Send a blank email to php-bugs+get-245649@lists.php.net to get a copy of this message | ||
Issue: https://github.com/php/php-src/issues/12522
Author: ssigwart
### Description
The following code causes a segmentation fault.
```php
<?php
class TestA
{
public TestB $b;
public function __serialize(): array
{
return [serialize($this->b)];
}
public function __unserialize(array $data): void
{
$this->b = unserialize($data[0]);
}
}
class TestB
{
public TestA $a;
}
$a = new TestA();
$b = new TestB();
$a->b = $b;
$b->a = $a;
echo serialize($a);
```
This probably isn't code people would actually use, but I was trying to debug a related
unserializing bug and came across this.
### PHP Version
PHP 8.0.30; PHP 8.2.11
### Operating System
_No response_