[php-src] Issue #21824: Crash in unserialize()

[email protected] (iluuu1994)
Newsgroups php.bugs
Message-ID <RRUQHnim1HO6b6wlnJIDSN2HC3mnZaECzObUubbY4qk@main.internal.php.net>
Issue: https://github.com/php/php-src/issues/21824
Author: iluuu1994

### Description

Originally reported by @calysteon.

```php
<?php
class Trigger {
    public function __destruct() {
        @unserialize('i:1;');
    }
}

$payload = 'a:1019:{';
for ($i = 0; $i < 1017; $i++) {
    $payload .= "i:$i;s:1:\"A\";";
}
// Entry that overflows into a second var_entries block
$payload .= 'i:1017;O:7:"Trigger":0:{}';
// Duplicate key overwrites Trigger, pushing it to dtor list (refcount stays at 1)
$payload .= 'i:1017;i:0;}';

$result = @unserialize($payload);
```

### PHP Version

```plain
-
```

### Operating System

_No response_
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.