1--TEST-- 2ziparchive::properties isset()/empty() checks 3--EXTENSIONS-- 4zip 5--FILE-- 6<?php 7 8$dirname = __DIR__ . '/'; 9$file = $dirname . '__property_test.zip'; 10 11copy($dirname . 'test_with_comment.zip', $file); 12 13$zip = new ZipArchive; 14if (!$zip->open($file)) { 15 exit('failed'); 16} 17 18printf("zip->status (%d):\n\tempty(): %d\n\tisset(): %d\n", $zip->status, empty($zip->status), isset($zip->status)); 19printf("zip->numFiles (%d):\n\tempty(): %d\n\tisset(): %d\n", $zip->numFiles, empty($zip->numFiles), isset($zip->numFiles)); 20printf("zip->bogus (%d):\n\tempty(): %d\n\tisset(): %d\n", $zip->bogus, empty($zip->bogus), isset($zip->bogus)); 21 22 23$zip->addEmptyDir('emptydir'); 24 25printf("zip->status (%d):\n\tempty(): %d\n\tisset(): %d\n", $zip->status, empty($zip->status), isset($zip->status)); 26printf("zip->numFiles (%d):\n\tempty(): %d\n\tisset(): %d\n", $zip->numFiles, empty($zip->numFiles), isset($zip->numFiles)); 27printf("zip->filename (%d):\n\tempty(): %d\n\tisset(): %d\n", strlen($zip->filename), empty($zip->filename), isset($zip->filename)); 28printf("zip->comment (%d):\n\tempty(): %d\n\tisset(): %d\n", strlen($zip->comment), empty($zip->comment), isset($zip->comment)); 29 30unset($zip); //close the file before unlinking 31@unlink($file); 32?> 33--EXPECTF-- 34zip->status (0): 35 empty(): 1 36 isset(): 1 37zip->numFiles (4): 38 empty(): 0 39 isset(): 1 40 41Warning: Undefined property: ZipArchive::$bogus in %s on line %d 42zip->bogus (0): 43 empty(): 1 44 isset(): 0 45zip->status (0): 46 empty(): 1 47 isset(): 1 48zip->numFiles (5): 49 empty(): 0 50 isset(): 1 51zip->filename (%d): 52 empty(): 0 53 isset(): 1 54zip->comment (19): 55 empty(): 0 56 isset(): 1 57