xref: /PHP-8.1/ext/zip/tests/bug76524.phpt (revision 74859783)
1--TEST--
2ZipArchive Bug #76524 (memory leak with ZipArchive::OVERWRITE flag and empty archive)
3--EXTENSIONS--
4zip
5--FILE--
6<?php
7
8$i = 0;
9do {
10    $filename = __DIR__ . "/nonexistent" . ($i++) . ".zip";
11} while (file_exists($filename));
12
13$zip = new ZipArchive();
14$zip->open($filename, ZipArchive::CREATE | ZipArchive::OVERWRITE);
15echo 'ok';
16
17/* Zip-related error messages depend on platform and libzip version,
18   so the regex is used to check that Zend MM does NOT show warnings
19   about leaks: */
20?>
21--EXPECTREGEX--
22ok((?!memory leaks detected).)*
23