summaryrefslogtreecommitdiff
path: root/ext/zip/tests/bug76524.phpt
blob: e087015c3c2a98e2efd254800d3b1116b076848b (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
--TEST--
ZipArchive Bug #76524 (memory leak with ZipArchive::OVERWRITE flag and empty archive)
--SKIPIF--
<?php
if(!extension_loaded('zip')) die('skip');
?>
--FILE--
<?php

$i = 0;
do {
	$filename = __DIR__ . "/nonexistent" . ($i++) . ".zip";
} while (file_exists($filename));

$zip = new ZipArchive();
$zip->open($filename, ZipArchive::CREATE | ZipArchive::OVERWRITE);
echo 'ok';

/* Zip-related error messages depend on platform and libzip version,
   so the regex is used to check that Zend MM does NOT show warnings
   about leaks: */
?>
--EXPECTREGEX--
ok((?!memory leaks detected).)*