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