File:
[ELWIX - Embedded LightWeight unIX -] /
embedaddon /
php /
ext /
zip /
tests /
oo_properties.phpt
Revision
1.1.1.2 (vendor branch):
download - view:
text,
annotated -
select for diffs -
revision graph
Tue May 29 12:34:38 2012 UTC (12 years, 2 months ago) by
misho
Branches:
php,
MAIN
CVS tags:
v5_4_3elwix,
v5_4_29p0,
v5_4_29,
v5_4_20p0,
v5_4_20,
v5_4_17p0,
v5_4_17,
HEAD
php 5.4.3+patches
--TEST--
ziparchive::properties isset()/empty() checks
--SKIPIF--
<?php
/* $Id: oo_properties.phpt,v 1.1.1.2 2012/05/29 12:34:38 misho Exp $ */
if(!extension_loaded('zip')) die('skip');
?>
--FILE--
<?php
$dirname = dirname(__FILE__) . '/';
$file = $dirname . '__property_test.zip';
copy($dirname . 'test_with_comment.zip', $file);
$zip = new ZipArchive;
if (!$zip->open($file)) {
exit('failed');
}
printf("zip->status (%d):\n\tempty(): %d\n\tisset(): %d\n", $zip->status, empty($zip->status), isset($zip->status));
printf("zip->numFiles (%d):\n\tempty(): %d\n\tisset(): %d\n", $zip->numFiles, empty($zip->numFiles), isset($zip->numFiles));
printf("zip->bogus (%d):\n\tempty(): %d\n\tisset(): %d\n", $zip->bogus, empty($zip->bogus), isset($zip->bogus));
$zip->addEmptyDir('emptydir');
printf("zip->status (%d):\n\tempty(): %d\n\tisset(): %d\n", $zip->status, empty($zip->status), isset($zip->status));
printf("zip->numFiles (%d):\n\tempty(): %d\n\tisset(): %d\n", $zip->numFiles, empty($zip->numFiles), isset($zip->numFiles));
printf("zip->filename (%d):\n\tempty(): %d\n\tisset(): %d\n", strlen($zip->filename), empty($zip->filename), isset($zip->filename));
printf("zip->comment (%d):\n\tempty(): %d\n\tisset(): %d\n", strlen($zip->comment), empty($zip->comment), isset($zip->comment));
unset($zip); //close the file before unlinking
@unlink($file);
?>
--EXPECTF--
zip->status (0):
empty(): 1
isset(): 1
zip->numFiles (4):
empty(): 0
isset(): 1
Notice: Undefined property: ZipArchive::$bogus in %s on line %d
zip->bogus (0):
empty(): 1
isset(): 0
zip->status (0):
empty(): 1
isset(): 1
zip->numFiles (5):
empty(): 0
isset(): 1
zip->filename (%d):
empty(): 0
isset(): 1
zip->comment (19):
empty(): 0
isset(): 1
FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>