php-src/ext/zip/tests/bug64342_1-mb.phpt
Nikita Popov 7485978339
Migrate SKIPIF -> EXTENSIONS (#7138)
This is an automated migration of most SKIPIF extension_loaded checks.
2021-06-11 11:57:42 +02:00

42 lines
843 B
PHP

--TEST--
Bug #64342 ZipArchive::addFile() has to check file existence (variation 2)
--EXTENSIONS--
zip
--FILE--
<?php
$dirname = __DIR__ . '/';
include $dirname . 'utils.inc';
$file = $dirname . '__私はガラスを食べられますtmp_oo_addfile.zip';
copy($dirname . 'test.zip', $file);
$zip = new ZipArchive;
if (!$zip->open($file)) {
exit('failed');
}
if (!$zip->addFile($dirname . 'cant_find_me.txt', 'test.php')) {
echo "failed\n";
}
if ($zip->status == ZIPARCHIVE::ER_OK) {
if (!verify_entries($zip, [
"bar",
"foobar/",
"foobar/baz",
"entry1.txt"
])) {
echo "failed\n";
} else {
echo "OK";
}
$zip->close();
} else {
echo "failed\n";
}
@unlink($file);
?>
--EXPECTF--
Warning: ZipArchive::addFile(): No such file or directory in %s on line %d
failed
OK