[php-src] Issue #21682: ZipArchive is missing the NOT_SERIALIZABLE flag
| From: | arnaud-lb | Date: | Thu, 09 Apr 2026 09:50:48 +0000 |
| Subject: | [php-src] Issue #21682: ZipArchive is missing the NOT_SERIALIZABLE flag | ||
| Groups: | php.bugs | ||
| Request: | Send a blank email to php-bugs+get-251924@lists.php.net to get a copy of this message | ||
Issue: https://github.com/php/php-src/issues/21682
Author: arnaud-lb
### Description
The following code:
```php
$a = new ZipArchive();
var_dump($a->open('test.zip', ZipArchive::CREATE));
var_dump($a->addFromString('test.php', '<?php'));
var_dump($a->numFiles);
$a = unserialize(serialize($a));
echo "# Num files after serialize:\n";
var_dump($a->numFiles);
```
Resulted in this output:
```
[...]
# Num files after serialize:
int(0)
```
But I expected this output instead:
```
Fatal error: Uncaught Exception: Serialization of 'ZipArchive' is not allowed
```
Found by @nicolas-grekas
### PHP Version
```plain
*
```
### Operating System
_No response_