1--TEST-- 2zip::open() function 3--EXTENSIONS-- 4zip 5--FILE-- 6<?php 7 8$dirname = __DIR__ . '/'; 9$zip = new ZipArchive; 10$r = $zip->open($dirname . 'nofile'); 11if ($r !== TRUE) { 12 echo "ER_OPEN: ok\n"; 13} else { 14 echo "ER_OPEN: FAILED\n"; 15} 16 17$r = $zip->open($dirname . 'nofile', ZIPARCHIVE::CREATE); 18if (!$r) { 19 echo "create: failed\n"; 20} else { 21 echo "create: ok\n"; 22} 23@unlink($dirname . 'nofile'); 24 25$zip = new ZipArchive; 26try { 27 $zip->open(''); 28} catch (\ValueError $e) { 29 echo $e->getMessage() . \PHP_EOL; 30} 31 32if (!$zip->open($dirname . 'test.zip')) { 33 exit("failed 1\n"); 34} 35 36if ($zip->status == ZIPARCHIVE::ER_OK) { 37 echo "OK\n"; 38} else { 39 echo "failed\n"; 40} 41?> 42--EXPECT-- 43ER_OPEN: ok 44create: ok 45ZipArchive::open(): Argument #1 ($filename) cannot be empty 46OK 47