Skip to content

ZipArchive is missing the NOT_SERIALIZABLE flag #21682

Description

@arnaud-lb

Description

The following code:

$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

*

Operating System

No response

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions