diff options
author | Pierre Joye <pajoye@php.net> | 2008-11-04 13:24:39 +0000 |
---|---|---|
committer | Pierre Joye <pajoye@php.net> | 2008-11-04 13:24:39 +0000 |
commit | 7102449f76cd9b3acf7455322c9a84b19a92f478 (patch) | |
tree | 35a38c72201cfcd65f095859852b6dc2fe20fed2 /ext/zip | |
parent | 4f04fdc735a73eeb742e44a5a8aefd7cd5069aca (diff) | |
download | php-git-7102449f76cd9b3acf7455322c9a84b19a92f478.tar.gz |
- sync tests with pecl
Diffstat (limited to 'ext/zip')
-rw-r--r-- | ext/zip/tests/bug38943.inc | 16 | ||||
-rw-r--r-- | ext/zip/tests/bug38943_2.phpt | 38 | ||||
-rw-r--r-- | ext/zip/tests/pecl12414.phpt | 39 | ||||
-rw-r--r-- | ext/zip/tests/pecl12414.zip | bin | 0 -> 17271 bytes |
4 files changed, 93 insertions, 0 deletions
diff --git a/ext/zip/tests/bug38943.inc b/ext/zip/tests/bug38943.inc new file mode 100644 index 0000000000..a6f45e8294 --- /dev/null +++ b/ext/zip/tests/bug38943.inc @@ -0,0 +1,16 @@ +<?php +class myZip extends ZipArchive { + private $test = 0; + public $testp = 1; + private $testarray = array(); + + public function __construct() { + $this->testarray[] = 1; + var_dump($this->testarray); + } +} + +$z = new myZip; +$z->testp = "foobar"; +var_dump($z); + diff --git a/ext/zip/tests/bug38943_2.phpt b/ext/zip/tests/bug38943_2.phpt new file mode 100644 index 0000000000..1aaba37c12 --- /dev/null +++ b/ext/zip/tests/bug38943_2.phpt @@ -0,0 +1,38 @@ +--TEST-- +#38943, properties in extended class cannot be set (5.3) +--SKIPIF-- +<?php +/* $Id$ */ +if(!extension_loaded('zip')) die('skip'); +if (!defined('PHP_VERSION_MAJOR')) die('skip test for5.3+ only'); +?> +--FILE-- +<?php +include 'bug38943.inc'; +?> +--EXPECTF-- +array(1) { + [0]=> + int(1) +} +object(myZip)#1 (%d) { + ["test":"myZip":private]=> + int(0) + ["testp"]=> + string(6) "foobar" + ["testarray":"myZip":private]=> + array(1) { + [0]=> + int(1) + } + ["status"]=> + int(0) + ["statusSys"]=> + int(0) + ["numFiles"]=> + int(0) + ["filename"]=> + string(0) "" + ["comment"]=> + string(0) "" +} diff --git a/ext/zip/tests/pecl12414.phpt b/ext/zip/tests/pecl12414.phpt new file mode 100644 index 0000000000..ab11d21a63 --- /dev/null +++ b/ext/zip/tests/pecl12414.phpt @@ -0,0 +1,39 @@ +--TEST-- +Bug #12414 ( extracting files from damaged archives) +--SKIPIF-- +<?php +/*$ */ +if(!extension_loaded('zip')) die('skip'); + ?> +--FILE-- +<?php +$filename = 'MYLOGOV2.GFX'; +$zipname = dirname(__FILE__) . "/pecl12414.zip"; +$za = new ZipArchive(); +$res =$za->open($zipname); +if ($res === TRUE) { + $finfo=$za->statName($filename); + $file_size=$finfo['size']; + + if($file_size>0) { + $contents=$za->getFromName($filename); + + echo "ZIP contents size: " . strlen($contents) . "\n"; + if(strlen($contents)!=$file_size) { + echo "zip_readfile recorded data does not match unpacked size: " . $zipname . " : " . $filename; + } + } else { + $contents=false; + echo "zip_readfile could not open stream from zero length file " . $zipname . " : " .$filename; + } + + $za->close(); +} else { + echo "zip_readfile could not read from " . $zipname . " : " . $filename; +} + +?> +--DONE-- +--EXPECTF-- +ZIP contents size: %d +zip_readfile recorded data does not match unpacked size: %specl12414.zip : MYLOGOV2.GFX diff --git a/ext/zip/tests/pecl12414.zip b/ext/zip/tests/pecl12414.zip Binary files differnew file mode 100644 index 0000000000..6cbc60f607 --- /dev/null +++ b/ext/zip/tests/pecl12414.zip |