diff options
author | Nikita Popov <nikita.ppv@gmail.com> | 2020-02-03 22:52:20 +0100 |
---|---|---|
committer | Nikita Popov <nikita.ppv@gmail.com> | 2020-02-03 22:52:20 +0100 |
commit | f8d795820e780a6322e054c26c581570613c14f0 (patch) | |
tree | 99d3ae01ce564752807341c5743863b4c92513f8 /ext/zip | |
parent | d2cb200e10ada6fa44c54a29292bb4665728fff0 (diff) | |
download | php-git-f8d795820e780a6322e054c26c581570613c14f0.tar.gz |
Reindent phpt files
Diffstat (limited to 'ext/zip')
43 files changed, 291 insertions, 291 deletions
diff --git a/ext/zip/tests/bug14962.phpt b/ext/zip/tests/bug14962.phpt index 06a2ce5e6a..fbebfc7275 100644 --- a/ext/zip/tests/bug14962.phpt +++ b/ext/zip/tests/bug14962.phpt @@ -16,7 +16,7 @@ $za->addFromString($file, '1234'); $za->close(); if (!is_file($dir . "/__14962.zip")) { - die('failed to create the archive'); + die('failed to create the archive'); } $za = new ZipArchive; $za->open($dir . '/__14962.zip'); @@ -24,8 +24,8 @@ $za->extractTo($dir, NULL); $za->close(); if (is_file($fullpath)) { - unlink($fullpath); - echo "Ok"; + unlink($fullpath); + echo "Ok"; } unlink($dir . '/' . '__14962.zip'); ?> diff --git a/ext/zip/tests/bug38943.inc b/ext/zip/tests/bug38943.inc index b439939e64..b04049a172 100644 --- a/ext/zip/tests/bug38943.inc +++ b/ext/zip/tests/bug38943.inc @@ -1,13 +1,13 @@ <?php class myZip extends ZipArchive { - private $test = 0; - public $testp = 1; - private $testarray = array(); + private $test = 0; + public $testp = 1; + private $testarray = array(); - public function __construct() { - $this->testarray[] = 1; - var_dump($this->testarray); - } + public function __construct() { + $this->testarray[] = 1; + var_dump($this->testarray); + } } $z = new myZip; diff --git a/ext/zip/tests/bug38943.phpt b/ext/zip/tests/bug38943.phpt index c5e2284719..ffd0f8dc16 100644 --- a/ext/zip/tests/bug38943.phpt +++ b/ext/zip/tests/bug38943.phpt @@ -7,14 +7,14 @@ if(!extension_loaded('zip')) die('skip'); --FILE-- <?php class myZip extends ZipArchive { - private $test = 0; - public $testp = 1; - private $testarray = array(); + private $test = 0; + public $testp = 1; + private $testarray = array(); - public function __construct() { - $this->testarray[] = 1; - var_dump($this->testarray); - } + public function __construct() { + $this->testarray[] = 1; + var_dump($this->testarray); + } } $z = new myZip; diff --git a/ext/zip/tests/bug40228-mb.phpt b/ext/zip/tests/bug40228-mb.phpt index b7095dda68..fddfb65f29 100644 --- a/ext/zip/tests/bug40228-mb.phpt +++ b/ext/zip/tests/bug40228-mb.phpt @@ -10,11 +10,11 @@ $zip = new ZipArchive; $zip->open($arc_name, ZIPARCHIVE::CREATE); $zip->extractTo($dest); if (is_dir($dest . '/test/empty')) { - echo "Ok\n"; - rmdir($dest . '/test/empty'); - rmdir($dest . '/test'); + echo "Ok\n"; + rmdir($dest . '/test/empty'); + rmdir($dest . '/test'); } else { - echo "Failed.\n"; + echo "Failed.\n"; } echo "Done\n"; ?> diff --git a/ext/zip/tests/bug40228.phpt b/ext/zip/tests/bug40228.phpt index ce5f1e6afe..49e202c576 100644 --- a/ext/zip/tests/bug40228.phpt +++ b/ext/zip/tests/bug40228.phpt @@ -10,11 +10,11 @@ $zip = new ZipArchive; $zip->open($arc_name, ZIPARCHIVE::CREATE); $zip->extractTo($dest); if (is_dir($dest . '/test/empty')) { - echo "Ok\n"; - rmdir($dest . '/test/empty'); - rmdir($dest . '/test'); + echo "Ok\n"; + rmdir($dest . '/test/empty'); + rmdir($dest . '/test'); } else { - echo "Failed.\n"; + echo "Failed.\n"; } echo "Done\n"; ?> diff --git a/ext/zip/tests/bug47667.phpt b/ext/zip/tests/bug47667.phpt index 085fb1b87f..ab93202801 100644 --- a/ext/zip/tests/bug47667.phpt +++ b/ext/zip/tests/bug47667.phpt @@ -11,24 +11,24 @@ $filename = $thisdir . "/bug47667.zip"; $zip = new ZipArchive(); if ($zip->open($filename, ZipArchive::CREATE) !== true) { - exit("Unable to open the zip file"); + exit("Unable to open the zip file"); } else { - $zip->addFromString('foo.txt', 'foo bar foobar'); - $zip->close(); + $zip->addFromString('foo.txt', 'foo bar foobar'); + $zip->close(); } for ($i = 0; $i < 10; $i++) { - $zip = new ZipArchive(); - if ($zip->open($filename, ZipArchive::OVERWRITE) !== true) { - exit("Unable to open the zip file"); - } - $zip->addFromString("foo_{$i}.txt", 'foo bar foobar'); - $zip->close(); + $zip = new ZipArchive(); + if ($zip->open($filename, ZipArchive::OVERWRITE) !== true) { + exit("Unable to open the zip file"); + } + $zip->addFromString("foo_{$i}.txt", 'foo bar foobar'); + $zip->close(); } $zip = new ZipArchive(); if ($zip->open($filename, ZipArchive::CREATE) !== true) { - exit("Unable to open the zip file"); + exit("Unable to open the zip file"); } echo "files: " , $zip->numFiles; diff --git a/ext/zip/tests/bug49072.phpt b/ext/zip/tests/bug49072.phpt index b918fba01b..dfe593d01b 100644 --- a/ext/zip/tests/bug49072.phpt +++ b/ext/zip/tests/bug49072.phpt @@ -9,13 +9,13 @@ if(!extension_loaded('zip')) die('skip'); $f = __DIR__ . '/bug49072.zip'; $o = new ZipArchive(); if (! $o->open($f, ZipArchive::CHECKCONS)) { - exit ('error can\'t open'); + exit ('error can\'t open'); } $r = $o->getStream('file1'); // this file has a wrong crc if (!$r)die('failed to open a stream for file1'); $s = ''; while (! feof($r)) { - $s .= fread($r,1024); + $s .= fread($r,1024); } ?> --EXPECTF-- diff --git a/ext/zip/tests/bug51353.phpt b/ext/zip/tests/bug51353.phpt index d84de38f5b..896375dda3 100644 --- a/ext/zip/tests/bug51353.phpt +++ b/ext/zip/tests/bug51353.phpt @@ -13,28 +13,28 @@ set_time_limit(0); $base_path = __DIR__; /* Either we ship a file with 100000 entries which would be >12M big, - or create it dynamically. */ + or create it dynamically. */ $zip = new ZipArchive; $r = $zip->open("$base_path/51353.zip", ZIPARCHIVE::CREATE | ZIPARCHIVE::OVERWRITE); if ($r) { - for ($i = 0; $i < 100000; $i++) { - $zip->addFromString("$i.txt", '1'); - } - $zip->close(); + for ($i = 0; $i < 100000; $i++) { + $zip->addFromString("$i.txt", '1'); + } + $zip->close(); } else { - die("failed"); + die("failed"); } $zip = new ZipArchive; $r = $zip->open("$base_path/51353.zip"); if ($r) { - $zip->extractTo("$base_path/51353_unpack"); - $zip->close(); + $zip->extractTo("$base_path/51353_unpack"); + $zip->close(); - $a = glob("$base_path/51353_unpack/*.txt"); - echo count($a) . "\n"; + $a = glob("$base_path/51353_unpack/*.txt"); + echo count($a) . "\n"; } else { - die("failed"); + die("failed"); } echo "OK"; diff --git a/ext/zip/tests/bug53579.phpt b/ext/zip/tests/bug53579.phpt index 371dc31e4f..d0ec350824 100644 --- a/ext/zip/tests/bug53579.phpt +++ b/ext/zip/tests/bug53579.phpt @@ -11,7 +11,7 @@ $file = $dirname . 'test_with_comment.zip'; include $dirname . 'utils.inc'; $zip = new ZipArchive; if (!$zip->open($file)) { - exit('failed'); + exit('failed'); } $fp = $zip->getStream('foo'); diff --git a/ext/zip/tests/bug53603.phpt b/ext/zip/tests/bug53603.phpt index eb8b169f03..1d1703d590 100644 --- a/ext/zip/tests/bug53603.phpt +++ b/ext/zip/tests/bug53603.phpt @@ -8,11 +8,11 @@ if(!extension_loaded('zip')) die('skip'); <?php class TestStream { - function url_stat($path, $flags) { - if (!($flags & STREAM_URL_STAT_QUIET)) - trigger_error("not quiet"); - return array(); - } + function url_stat($path, $flags) { + if (!($flags & STREAM_URL_STAT_QUIET)) + trigger_error("not quiet"); + return array(); + } } stream_wrapper_register("teststream", "TestStream"); @@ -21,8 +21,8 @@ $dirname = __DIR__ . '/'; $file = $dirname . 'test_with_comment.zip'; $zip = new ZipArchive; if ($zip->open($file) !== TRUE) { - echo "open failed.\n"; - exit('failed'); + echo "open failed.\n"; + exit('failed'); } $a = $zip->extractTo('teststream://test'); diff --git a/ext/zip/tests/bug64342_0.phpt b/ext/zip/tests/bug64342_0.phpt index 96e9667dda..f9cde3afed 100644 --- a/ext/zip/tests/bug64342_0.phpt +++ b/ext/zip/tests/bug64342_0.phpt @@ -10,22 +10,22 @@ Bug #64342 ZipArchive::addFile() has to check file existence (variation 1) $zip = new ZipArchive; $res = $zip->open(__DIR__ . '/bug64342.zip', ZipArchive::CREATE); if ($res === TRUE) { - $f = md5(uniqid()) . '.txt'; - echo "$f\n"; - $res = $zip->addFile($f); - if (true == $res) { - echo "add ok\n"; - } else { - echo "add failed\n"; - } - $res = $zip->close(); - if (true == $res) { - echo "close ok\n"; - } else { - echo "close failed\n"; - } + $f = md5(uniqid()) . '.txt'; + echo "$f\n"; + $res = $zip->addFile($f); + if (true == $res) { + echo "add ok\n"; + } else { + echo "add failed\n"; + } + $res = $zip->close(); + if (true == $res) { + echo "close ok\n"; + } else { + echo "close failed\n"; + } } else { - echo "open failed\n"; + echo "open failed\n"; } diff --git a/ext/zip/tests/bug64342_1-mb.phpt b/ext/zip/tests/bug64342_1-mb.phpt index 6b14c7fb5d..4884c9fe5f 100644 --- a/ext/zip/tests/bug64342_1-mb.phpt +++ b/ext/zip/tests/bug64342_1-mb.phpt @@ -15,25 +15,25 @@ copy($dirname . 'test.zip', $file); $zip = new ZipArchive; if (!$zip->open($file)) { - exit('failed'); + exit('failed'); } if (!$zip->addFile($dirname . 'cant_find_me.txt', 'test.php')) { - echo "failed\n"; + 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(); + if (!verify_entries($zip, [ + "bar", + "foobar/", + "foobar/baz", + "entry1.txt" + ])) { + echo "failed\n"; + } else { + echo "OK"; + } + $zip->close(); } else { - echo "failed\n"; + echo "failed\n"; } @unlink($file); ?> diff --git a/ext/zip/tests/bug64342_1.phpt b/ext/zip/tests/bug64342_1.phpt index 13d8a6d388..6b923d3ef1 100644 --- a/ext/zip/tests/bug64342_1.phpt +++ b/ext/zip/tests/bug64342_1.phpt @@ -15,25 +15,25 @@ copy($dirname . 'test.zip', $file); $zip = new ZipArchive; if (!$zip->open($file)) { - exit('failed'); + exit('failed'); } if (!$zip->addFile($dirname . 'cant_find_me.txt', 'test.php')) { - echo "failed\n"; + 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(); + if (!verify_entries($zip, [ + "bar", + "foobar/", + "foobar/baz", + "entry1.txt" + ])) { + echo "failed\n"; + } else { + echo "OK"; + } + $zip->close(); } else { - echo "failed\n"; + echo "failed\n"; } @unlink($file); ?> diff --git a/ext/zip/tests/bug7214.phpt b/ext/zip/tests/bug7214.phpt index d36f0f4b42..b36bb2759f 100644 --- a/ext/zip/tests/bug7214.phpt +++ b/ext/zip/tests/bug7214.phpt @@ -12,9 +12,9 @@ $entries = 0; $entry = zip_read($zip); $contents = zip_entry_read($entry, zip_entry_filesize($entry)); if (strlen($contents) == zip_entry_filesize($entry)) { - echo "Ok"; + echo "Ok"; } else { - echo "failed"; + echo "failed"; } ?> diff --git a/ext/zip/tests/bug72258.phpt b/ext/zip/tests/bug72258.phpt index 208a810c33..4612cc26f0 100644 --- a/ext/zip/tests/bug72258.phpt +++ b/ext/zip/tests/bug72258.phpt @@ -12,13 +12,13 @@ $fn = __DIR__ . DIRECTORY_SEPARATOR . "bug72258.zip"; $zip = new \ZipArchive(); $res = $zip->open($fn); if ($res !== true) { - echo 'Error opening: ' . $res; - die(); + echo 'Error opening: ' . $res; + die(); } for ($i = 0; $i < $zip->numFiles; $i++) { - $fnInArc = $zip->getNameIndex($i, ZipArchive::FL_ENC_RAW); - var_dump($fnInArc); + $fnInArc = $zip->getNameIndex($i, ZipArchive::FL_ENC_RAW); + var_dump($fnInArc); } ?> --EXPECT-- diff --git a/ext/zip/tests/bug76524.phpt b/ext/zip/tests/bug76524.phpt index e087015c3c..5fd66c1535 100644 --- a/ext/zip/tests/bug76524.phpt +++ b/ext/zip/tests/bug76524.phpt @@ -9,7 +9,7 @@ if(!extension_loaded('zip')) die('skip'); $i = 0; do { - $filename = __DIR__ . "/nonexistent" . ($i++) . ".zip"; + $filename = __DIR__ . "/nonexistent" . ($i++) . ".zip"; } while (file_exists($filename)); $zip = new ZipArchive(); diff --git a/ext/zip/tests/bug7658.phpt b/ext/zip/tests/bug7658.phpt index 9253b01c3f..e2a70aac14 100644 --- a/ext/zip/tests/bug7658.phpt +++ b/ext/zip/tests/bug7658.phpt @@ -7,21 +7,21 @@ if(!extension_loaded('zip')) die('skip'); --FILE-- <?php $expect = array( - "mimetype", - "Configurations2/statusbar/", - "Configurations2/accelerator/current.xml", - "Configurations2/floater/", - "Configurations2/popupmenu/", - "Configurations2/progressbar/", - "Configurations2/menubar/", - "Configurations2/toolbar/", - "Configurations2/images/Bitmaps/", - "content.xml", - "styles.xml", - "meta.xml", - "Thumbnails/thumbnail.png", - "settings.xml", - "META-INF/manifest.xml", + "mimetype", + "Configurations2/statusbar/", + "Configurations2/accelerator/current.xml", + "Configurations2/floater/", + "Configurations2/popupmenu/", + "Configurations2/progressbar/", + "Configurations2/menubar/", + "Configurations2/toolbar/", + "Configurations2/images/Bitmaps/", + "content.xml", + "styles.xml", + "meta.xml", + "Thumbnails/thumbnail.png", + "settings.xml", + "META-INF/manifest.xml", ); $dirname = __DIR__ . '/'; include $dirname . 'utils.inc'; @@ -29,7 +29,7 @@ $file = $dirname . '__tmp_bug7658.odt'; $zip = new ZipArchive(); copy($dirname . 'bug7658.odt', $file); if(!$zip->open($file)) { - echo 'failed'; + echo 'failed'; } @@ -40,8 +40,8 @@ echo "\n"; $zip->open($file); for($i=0; $i < $zip->numFiles; $i++) { - $sb = $zip->statIndex($i); - $found[] = $sb['name']; + $sb = $zip->statIndex($i); + $found[] = $sb['name']; } $ar = array_diff($found, $expect); diff --git a/ext/zip/tests/bug8700.phpt b/ext/zip/tests/bug8700.phpt index 67bd265f9a..ad5d91b7c2 100644 --- a/ext/zip/tests/bug8700.phpt +++ b/ext/zip/tests/bug8700.phpt @@ -17,8 +17,8 @@ if ($zip->open($filename) === FALSE) { $contents_from_idx = $zip->getFromIndex(0); $contents_from_name = $zip->getFromName('1.txt'); if ($contents_from_idx != $contents_from_name) { - echo "failed:"; - var_dump($content_from_idx, $content_from_name); + echo "failed:"; + var_dump($content_from_idx, $content_from_name); } $zip->close(); diff --git a/ext/zip/tests/doubleclose.phpt b/ext/zip/tests/doubleclose.phpt index eb0ed7a829..905dc60f0c 100644 --- a/ext/zip/tests/doubleclose.phpt +++ b/ext/zip/tests/doubleclose.phpt @@ -10,7 +10,7 @@ if(!extension_loaded('zip')) die('skip'); echo "Procedural\n"; $zip = zip_open(__DIR__ . '/test.zip'); if (!is_resource($zip)) { - die("Failure"); + die("Failure"); } var_dump(zip_close($zip)); try { @@ -22,17 +22,17 @@ try { echo "Object\n"; $zip = new ZipArchive(); if (!$zip->open(__DIR__ . '/test.zip')) { - die('Failure'); + die('Failure'); } if ($zip->status == ZIPARCHIVE::ER_OK) { - var_dump($zip->close()); - try { - $zip->close(); - } catch (ValueError $err) { - echo $err->getMessage(), PHP_EOL; - } + var_dump($zip->close()); + try { + $zip->close(); + } catch (ValueError $err) { + echo $err->getMessage(), PHP_EOL; + } } else { - die("Failure"); + die("Failure"); } ?> diff --git a/ext/zip/tests/oo_addemptydir.phpt b/ext/zip/tests/oo_addemptydir.phpt index 4ad424ce19..1a95662b15 100644 --- a/ext/zip/tests/oo_addemptydir.phpt +++ b/ext/zip/tests/oo_addemptydir.phpt @@ -15,25 +15,25 @@ copy($dirname . 'test.zip', $file); $zip = new ZipArchive; if (!$zip->open($file)) { - exit('failed'); + exit('failed'); } $zip->addEmptyDir('emptydir'); if ($zip->status == ZIPARCHIVE::ER_OK) { - if (!verify_entries($zip, [ - "bar", - "foobar/", - "foobar/baz", - "entry1.txt", - "emptydir/" - ])) { - echo "failed\n"; - } else { - echo "OK"; - } - $zip->close(); + if (!verify_entries($zip, [ + "bar", + "foobar/", + "foobar/baz", + "entry1.txt", + "emptydir/" + ])) { + echo "failed\n"; + } else { + echo "OK"; + } + $zip->close(); } else { - echo "failed3\n"; + echo "failed3\n"; } @unlink($file); ?> diff --git a/ext/zip/tests/oo_addemptydir_error.phpt b/ext/zip/tests/oo_addemptydir_error.phpt index a1b083ca50..92c220066f 100644 --- a/ext/zip/tests/oo_addemptydir_error.phpt +++ b/ext/zip/tests/oo_addemptydir_error.phpt @@ -12,16 +12,16 @@ include __DIR__ . '/utils.inc'; $zip = new ZipArchive; if (!$zip->open(__DIR__ . '/test.zip', ZipArchive::RDONLY)) { - exit('failed'); + exit('failed'); } var_dump($zip->addEmptyDir('emptydir')); if ($zip->status == ZipArchive::ER_RDONLY) { - echo "OK\n"; + echo "OK\n"; } else if ($zip->status == ZipArchive::ER_OK) { - dump_entries_name($zip); + dump_entries_name($zip); } else { - echo "Lost\n"; + echo "Lost\n"; } $zip->close(); ?> diff --git a/ext/zip/tests/oo_addfile.phpt b/ext/zip/tests/oo_addfile.phpt index 254f2b7620..5dd99faa0b 100644 --- a/ext/zip/tests/oo_addfile.phpt +++ b/ext/zip/tests/oo_addfile.phpt @@ -15,26 +15,26 @@ copy($dirname . 'test.zip', $file); $zip = new ZipArchive; if (!$zip->open($file)) { - exit('failed'); + exit('failed'); } if (!$zip->addFile($dirname . 'utils.inc', 'test.php')) { - echo "failed\n"; + echo "failed\n"; } if ($zip->status == ZIPARCHIVE::ER_OK) { - if (!verify_entries($zip, [ - "bar", - "foobar/", - "foobar/baz", - "entry1.txt", - "test.php" - ])) { - echo "failed\n"; - } else { - echo "OK"; - } - $zip->close(); + if (!verify_entries($zip, [ + "bar", + "foobar/", + "foobar/baz", + "entry1.txt", + "test.php" + ])) { + echo "failed\n"; + } else { + echo "OK"; + } + $zip->close(); } else { - echo "failed\n"; + echo "failed\n"; } @unlink($file); ?> diff --git a/ext/zip/tests/oo_cancel.phpt b/ext/zip/tests/oo_cancel.phpt index c8653ec52e..4c487072c0 100644 --- a/ext/zip/tests/oo_cancel.phpt +++ b/ext/zip/tests/oo_cancel.phpt @@ -17,12 +17,12 @@ $file = $dirname . '__tmp_oo_progress.zip'; $zip = new ZipArchive; if (!$zip->open($file, ZIPARCHIVE::CREATE)) { - exit('failed'); + exit('failed'); } var_dump($zip->registerCancelCallback(function () { - // Always cancel - return -1; + // Always cancel + return -1; })); var_dump($zip->addFromString(PHP_BINARY, 'entry #1')); diff --git a/ext/zip/tests/oo_close.phpt b/ext/zip/tests/oo_close.phpt index 60a7f364d1..962ce183e7 100644 --- a/ext/zip/tests/oo_close.phpt +++ b/ext/zip/tests/oo_close.phpt @@ -10,14 +10,14 @@ if(!extension_loaded('zip')) die('skip'); $dirname = __DIR__ . '/'; $zip = new ZipArchive; if (!$zip->open($dirname . 'test.zip')) { - exit('failed'); + exit('failed'); } if ($zip->status == ZIPARCHIVE::ER_OK) { - $zip->close(); - echo "ok\n"; + $zip->close(); + echo "ok\n"; } else { - echo "failed\n"; + echo "failed\n"; } ?> --EXPECT-- diff --git a/ext/zip/tests/oo_count.phpt b/ext/zip/tests/oo_count.phpt index a5771fa298..426d456a29 100644 --- a/ext/zip/tests/oo_count.phpt +++ b/ext/zip/tests/oo_count.phpt @@ -12,7 +12,7 @@ $file = $dirname . 'test.zip'; $zip = new ZipArchive; if (!$zip->open($file)) { - exit('failed'); + exit('failed'); } var_dump($zip->numFiles, count($zip), $zip->numFiles == count($zip)); diff --git a/ext/zip/tests/oo_delete.phpt b/ext/zip/tests/oo_delete.phpt index 385b943893..033662be3e 100644 --- a/ext/zip/tests/oo_delete.phpt +++ b/ext/zip/tests/oo_delete.phpt @@ -9,50 +9,50 @@ if(!extension_loaded('zip')) die('skip'); $dirname = __DIR__ . '/'; $file = $dirname . 'oo_delete.zip'; if (file_exists($file)) { - unlink($file); + unlink($file); } $zip = new ZipArchive; if (!$zip->open($file, ZIPARCHIVE::CREATE)) { - exit('failed'); + exit('failed'); } $zip->addFromString('entry1.txt', 'entry #1'); $zip->addFromString('entry2.txt', 'entry #2'); $zip->addFromString('dir/entry2.txt', 'entry #2'); if ($zip->status == ZIPARCHIVE::ER_OK) { - $zip->close(); - echo "ok\n"; + $zip->close(); + echo "ok\n"; } else { - var_dump($zip); - echo "failed\n"; + var_dump($zip); + echo "failed\n"; } if (!$zip->open($file, ZIPARCHIVE::CREATE)) { - exit('failed'); + exit('failed'); } if ($zip->deleteIndex(0)) { - echo "ok\n"; + echo "ok\n"; } if ($zip->deleteName('entry2.txt')) { - echo "ok\n"; + echo "ok\n"; } else { - echo "failed 3\n"; + echo "failed 3\n"; } if ($zip->deleteName('dir/entry2.txt')) { - echo "ok\n"; + echo "ok\n"; } else { - echo "failed 3\n"; + echo "failed 3\n"; } if (!$zip->deleteIndex(123)) { - echo "ok\n"; + echo "ok\n"; } else { - print_r($zip); - echo "failed\n"; + print_r($zip); + echo "failed\n"; } @@ -67,7 +67,7 @@ var_dump($sb); unset($zip); if (file_exists($file)) { - unlink($file); + unlink($file); } ?> --EXPECT-- diff --git a/ext/zip/tests/oo_ext_zip.phpt b/ext/zip/tests/oo_ext_zip.phpt index d35094daeb..70c595a03a 100644 --- a/ext/zip/tests/oo_ext_zip.phpt +++ b/ext/zip/tests/oo_ext_zip.phpt @@ -7,14 +7,14 @@ if(!extension_loaded('zip')) die('skip'); --FILE-- <?php class myZip extends ZipArchive { - private $test = 0; - public $testp = 1; - private $testarray = array(); + private $test = 0; + public $testp = 1; + private $testarray = array(); - public function __construct() { - $this->testarray[] = 1; - var_dump($this->testarray); - } + public function __construct() { + $this->testarray[] = 1; + var_dump($this->testarray); + } } $z = new myZip; diff --git a/ext/zip/tests/oo_extract.phpt b/ext/zip/tests/oo_extract.phpt index d2ae2b5a43..f654ea8c95 100644 --- a/ext/zip/tests/oo_extract.phpt +++ b/ext/zip/tests/oo_extract.phpt @@ -11,57 +11,57 @@ $file = $dirname . 'test_with_comment.zip'; include $dirname . 'utils.inc'; $zip = new ZipArchive; if ($zip->open($file) !== TRUE) { - echo "open failed.\n"; - exit('failed'); + echo "open failed.\n"; + exit('failed'); } $zip->extractTo($dirname . '__oo_extract_tmp'); if (!is_dir($dirname . '__oo_extract_tmp')) { - echo "failed. mkdir\n"; + echo "failed. mkdir\n"; } if (!is_dir($dirname .'__oo_extract_tmp/foobar')) { - echo "failed. mkdir foobar\n"; + echo "failed. mkdir foobar\n"; } if (!file_exists($dirname . '__oo_extract_tmp/foobar/baz')) { - echo "failed. extract foobar/baz\n"; + echo "failed. extract foobar/baz\n"; } else { - echo file_get_contents($dirname . '__oo_extract_tmp/foobar/baz') . "\n"; + echo file_get_contents($dirname . '__oo_extract_tmp/foobar/baz') . "\n"; } if (!file_exists($dirname . '__oo_extract_tmp/bar')) { - echo "failed. bar file\n"; + echo "failed. bar file\n"; } else { - echo file_get_contents($dirname . '__oo_extract_tmp/bar') . "\n"; + echo file_get_contents($dirname . '__oo_extract_tmp/bar') . "\n"; } if (!file_exists($dirname . '__oo_extract_tmp/foo')) { - echo "failed. foo file\n"; + echo "failed. foo file\n"; } else { - echo file_get_contents($dirname . '__oo_extract_tmp/foo') . "\n"; + echo file_get_contents($dirname . '__oo_extract_tmp/foo') . "\n"; } /* extract one file */ $zip->extractTo($dirname . '__oo_extract_tmp', 'bar'); if (!file_exists($dirname . '__oo_extract_tmp/bar')) { - echo "failed. extract bar file\n"; + echo "failed. extract bar file\n"; } else { - echo file_get_contents($dirname . '__oo_extract_tmp/bar') . "\n"; + echo file_get_contents($dirname . '__oo_extract_tmp/bar') . "\n"; } /* extract two files */ $zip->extractTo($dirname . '__oo_extract_tmp', array('bar','foo')); if (!file_exists($dirname . '__oo_extract_tmp/bar')) { - echo "failed. extract bar file\n"; + echo "failed. extract bar file\n"; } else { - echo file_get_contents($dirname . '__oo_extract_tmp/bar') . "\n"; + echo file_get_contents($dirname . '__oo_extract_tmp/bar') . "\n"; } if (!file_exists($dirname . '__oo_extract_tmp/foo')) { - echo "failed. extract foo file\n"; + echo "failed. extract foo file\n"; } else { - echo file_get_contents($dirname . '__oo_extract_tmp/foo') . "\n"; + echo file_get_contents($dirname . '__oo_extract_tmp/foo') . "\n"; } rmdir_rf($dirname . '__oo_extract_tmp'); diff --git a/ext/zip/tests/oo_getcomment.phpt b/ext/zip/tests/oo_getcomment.phpt index 333dfa96bb..6f54105cc8 100644 --- a/ext/zip/tests/oo_getcomment.phpt +++ b/ext/zip/tests/oo_getcomment.phpt @@ -11,7 +11,7 @@ $file = $dirname . 'test_with_comment.zip'; include $dirname . 'utils.inc'; $zip = new ZipArchive; if (!$zip->open($file)) { - exit('failed'); + exit('failed'); } echo $zip->getArchiveComment() . "\n"; diff --git a/ext/zip/tests/oo_getnameindex.phpt b/ext/zip/tests/oo_getnameindex.phpt index 838a5a91b1..0ed563f447 100644 --- a/ext/zip/tests/oo_getnameindex.phpt +++ b/ext/zip/tests/oo_getnameindex.phpt @@ -14,7 +14,7 @@ $file = $dirname . 'oo_getnameindex.zip'; $zip = new ZipArchive; if (!$zip->open($file, ZIPARCHIVE::CREATE)) { - exit('failed'); + exit('failed'); } $zip->addFromString('entry1.txt', 'entry #1'); @@ -22,12 +22,12 @@ $zip->addFromString('entry2.txt', 'entry #2'); $zip->addFromString('dir/entry2d.txt', 'entry #2'); if (!$zip->status == ZIPARCHIVE::ER_OK) { - echo "failed to write zip\n"; + echo "failed to write zip\n"; } $zip->close(); if (!$zip->open($file)) { - exit('failed'); + exit('failed'); } diff --git a/ext/zip/tests/oo_namelocate.phpt b/ext/zip/tests/oo_namelocate.phpt index f6c837ac20..5b4c6dbf89 100644 --- a/ext/zip/tests/oo_namelocate.phpt +++ b/ext/zip/tests/oo_namelocate.phpt @@ -14,7 +14,7 @@ $file = $dirname . 'oo_namelocate.zip'; $zip = new ZipArchive; if (!$zip->open($file, ZIPARCHIVE::CREATE)) { - exit('failed'); + exit('failed'); } $zip->addFromString('entry1.txt', 'entry #1'); @@ -22,12 +22,12 @@ $zip->addFromString('entry2.txt', 'entry #2'); $zip->addFromString('dir/entry2d.txt', 'entry #2'); if (!$zip->status == ZIPARCHIVE::ER_OK) { - echo "failed to write zip\n"; + echo "failed to write zip\n"; } $zip->close(); if (!$zip->open($file)) { - exit('failed'); + exit('failed'); } diff --git a/ext/zip/tests/oo_open.phpt b/ext/zip/tests/oo_open.phpt index 10ebad9441..2dffdc0d88 100644 --- a/ext/zip/tests/oo_open.phpt +++ b/ext/zip/tests/oo_open.phpt @@ -11,16 +11,16 @@ $dirname = __DIR__ . '/'; $zip = new ZipArchive; $r = $zip->open($dirname . 'nofile'); if ($r !== TRUE) { - echo "ER_OPEN: ok\n"; + echo "ER_OPEN: ok\n"; } else { - echo "ER_OPEN: FAILED\n"; + echo "ER_OPEN: FAILED\n"; } $r = $zip->open($dirname . 'nofile', ZIPARCHIVE::CREATE); if (!$r) { - echo "create: failed\n"; + echo "create: failed\n"; } else { - echo "create: ok\n"; + echo "create: ok\n"; } @unlink($dirname . 'nofile'); @@ -28,13 +28,13 @@ $zip = new ZipArchive; $zip->open(''); if (!$zip->open($dirname . 'test.zip')) { - exit("failed 1\n"); + exit("failed 1\n"); } if ($zip->status == ZIPARCHIVE::ER_OK) { - echo "OK\n"; + echo "OK\n"; } else { - echo "failed\n"; + echo "failed\n"; } ?> --EXPECTF-- diff --git a/ext/zip/tests/oo_progress.phpt b/ext/zip/tests/oo_progress.phpt index 480510d862..c4641653ed 100644 --- a/ext/zip/tests/oo_progress.phpt +++ b/ext/zip/tests/oo_progress.phpt @@ -17,13 +17,13 @@ $file = $dirname . '__tmp_oo_progress.zip'; $zip = new ZipArchive; if (!$zip->open($file, ZIPARCHIVE::CREATE)) { - exit('failed'); + exit('failed'); } var_dump($zip->registerProgressCallback(0.5, function ($r) { - // Only check start/end as intermediate is not reliable - if ($r == 0.0) echo "start\n"; - if ($r == 1.0) echo "end\n"; + // Only check start/end as intermediate is not reliable + if ($r == 0.0) echo "start\n"; + if ($r == 1.0) echo "end\n"; })); var_dump($zip->addFromString('foo', 'entry #1')); diff --git a/ext/zip/tests/oo_properties.phpt b/ext/zip/tests/oo_properties.phpt index 108a85e29b..13482f3541 100644 --- a/ext/zip/tests/oo_properties.phpt +++ b/ext/zip/tests/oo_properties.phpt @@ -14,7 +14,7 @@ copy($dirname . 'test_with_comment.zip', $file); $zip = new ZipArchive; if (!$zip->open($file)) { - exit('failed'); + exit('failed'); } printf("zip->status (%d):\n\tempty(): %d\n\tisset(): %d\n", $zip->status, empty($zip->status), isset($zip->status)); diff --git a/ext/zip/tests/oo_rename.phpt b/ext/zip/tests/oo_rename.phpt index cdac489084..9cd9341406 100644 --- a/ext/zip/tests/oo_rename.phpt +++ b/ext/zip/tests/oo_rename.phpt @@ -14,7 +14,7 @@ $file = $dirname . 'oo_rename.zip'; $zip = new ZipArchive; if (!$zip->open($file, ZIPARCHIVE::CREATE)) { - exit('failed'); + exit('failed'); } $zip->addFromString('entry1.txt', 'entry #1'); @@ -22,42 +22,42 @@ $zip->addFromString('entry2.txt', 'entry #2'); $zip->addFromString('dir/entry2.txt', 'entry #2'); if (!$zip->status == ZIPARCHIVE::ER_OK) { - var_dump($zip); - echo "failed2\n"; + var_dump($zip); + echo "failed2\n"; } $zip->close(); if (!$zip->open($file)) { - exit('failed3'); + exit('failed3'); } if (!verify_entries($zip, [ - "entry1.txt", + "entry1.txt", "entry2.txt", "dir/entry2.txt" ])) { - exit("failed4"); + exit("failed4"); } else { - echo "OK\n"; + echo "OK\n"; } if (!$zip->renameIndex(0, 'ren_entry1.txt')) { - echo "failed index 0\n"; + echo "failed index 0\n"; } if (!$zip->renameName('dir/entry2.txt', 'dir3/ren_entry2.txt')) { - echo "failed name dir/entry2.txt\n"; + echo "failed name dir/entry2.txt\n"; } if (!verify_entries($zip, [ - "ren_entry1.txt", + "ren_entry1.txt", "entry2.txt", "dir3/ren_entry2.txt" ])) { - exit("failed5"); + exit("failed5"); } else { - echo "OK\n"; + echo "OK\n"; } $zip->close(); diff --git a/ext/zip/tests/oo_setcomment.phpt b/ext/zip/tests/oo_setcomment.phpt index a4e10bfce5..4518e68647 100644 --- a/ext/zip/tests/oo_setcomment.phpt +++ b/ext/zip/tests/oo_setcomment.phpt @@ -14,7 +14,7 @@ $file = $dirname . 'oo_setcomment.zip'; $zip = new ZipArchive; if (!$zip->open($file, ZIPARCHIVE::CREATE)) { - exit('failed'); + exit('failed'); } $zip->addFromString('entry1.txt', 'entry #1'); @@ -34,13 +34,13 @@ var_dump($zip->setCommentIndex(4, 'entry5.txt')); var_dump($zip->setArchiveComment('archive')); if (!$zip->status == ZIPARCHIVE::ER_OK) { - echo "failed to write zip\n"; + echo "failed to write zip\n"; } $zip->close(); if (!$zip->open($file)) { - @unlink($file); - exit('failed'); + @unlink($file); + exit('failed'); } var_dump($zip->getCommentIndex(0)); diff --git a/ext/zip/tests/oo_setcomment_error.phpt b/ext/zip/tests/oo_setcomment_error.phpt index a4301154c8..78d8d3dc35 100644 --- a/ext/zip/tests/oo_setcomment_error.phpt +++ b/ext/zip/tests/oo_setcomment_error.phpt @@ -12,7 +12,7 @@ $file = __DIR__ . '/__tmp_oo_set_comment_error.zip'; $zip = new ZipArchive; if (!$zip->open($file, ZIPARCHIVE::CREATE)) { - exit('failed'); + exit('failed'); } $zip->addFromString('entry1.txt', 'entry #1'); diff --git a/ext/zip/tests/oo_setcompression.phpt b/ext/zip/tests/oo_setcompression.phpt index 0cdcd791b8..b8519b6834 100644 --- a/ext/zip/tests/oo_setcompression.phpt +++ b/ext/zip/tests/oo_setcompression.phpt @@ -9,13 +9,13 @@ if (!extension_loaded('zip')) die('skip'); $tmpfile = __DIR__ . '/oo_setcompression.zip'; if (file_exists($tmpfile)) { - unlink($tmpfile); + unlink($tmpfile); } // generate the ZIP file $zip = new ZipArchive; if ($zip->open($tmpfile, ZipArchive::CREATE) !== TRUE) { - exit('failed'); + exit('failed'); } $txt = file_get_contents(__FILE__); $zip->addFromString('entry1.txt', $txt); @@ -35,18 +35,18 @@ var_dump($zip->setCompressionIndex(5, ZipArchive::CM_DEFLATE)); var_dump($zip->setCompressionIndex(6, ZipArchive::CM_DEFAULT)); if (!$zip->close()) { - exit('failed'); + exit('failed'); } // check the ZIP file $zip = zip_open($tmpfile); if (!is_resource($zip)) { - exit('failed'); + exit('failed'); } while ($e = zip_read($zip)) { - echo zip_entry_name($e) . ': ' . zip_entry_compressionmethod($e) . "\n"; + echo zip_entry_name($e) . ': ' . zip_entry_compressionmethod($e) . "\n"; } zip_close($zip); ?> diff --git a/ext/zip/tests/oo_setmtime.phpt b/ext/zip/tests/oo_setmtime.phpt index aa1ceb56bb..628f5ac8bb 100644 --- a/ext/zip/tests/oo_setmtime.phpt +++ b/ext/zip/tests/oo_setmtime.phpt @@ -18,7 +18,7 @@ $file = $dirname . '__tmp_oo_set_mtime.zip'; $zip = new ZipArchive; if (!$zip->open($file, ZIPARCHIVE::CREATE)) { - exit('failed'); + exit('failed'); } $zip->addFromString('foo', 'entry #1'); @@ -42,13 +42,13 @@ $s = $zip->statIndex(1); // ONLY with 1.6.0 - var_dump($s['mtime'] == $t2); if (!$zip->status == ZIPARCHIVE::ER_OK) { - echo "failed to write zip\n"; + echo "failed to write zip\n"; } $zip->close(); if (!$zip->open($file)) { - @unlink($file); - exit('failed'); + @unlink($file); + exit('failed'); } echo "Get 1\n"; diff --git a/ext/zip/tests/oo_stream.phpt b/ext/zip/tests/oo_stream.phpt index 89a2711666..d5e58a49a0 100644 --- a/ext/zip/tests/oo_stream.phpt +++ b/ext/zip/tests/oo_stream.phpt @@ -11,7 +11,7 @@ $file = $dirname . 'test_with_comment.zip'; include $dirname . 'utils.inc'; $zip = new ZipArchive; if (!$zip->open($file)) { - exit('failed'); + exit('failed'); } $fp = $zip->getStream('foo'); @@ -19,7 +19,7 @@ var_dump($fp); if(!$fp) exit("\n"); $contents = ''; while (!feof($fp)) { - $contents .= fread($fp, 255); + $contents .= fread($fp, 255); } fclose($fp); diff --git a/ext/zip/tests/pecl12414.phpt b/ext/zip/tests/pecl12414.phpt index 1b728c0ebc..738ed6dd10 100644 --- a/ext/zip/tests/pecl12414.phpt +++ b/ext/zip/tests/pecl12414.phpt @@ -12,24 +12,24 @@ $zipname = __DIR__ . "/pecl12414.zip"; $za = new ZipArchive(); $res =$za->open($zipname); if ($res === TRUE) { - $finfo=$za->statName($filename); - $file_size=$finfo['size']; + $finfo=$za->statName($filename); + $file_size=$finfo['size']; - if($file_size>0) { - $contents=$za->getFromName($filename); + 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; - } + 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(); + $za->close(); } else { - echo "zip_readfile could not read from " . $zipname . " : " . $filename; + echo "zip_readfile could not read from " . $zipname . " : " . $filename; } ?> diff --git a/ext/zip/tests/stream_meta_data.phpt b/ext/zip/tests/stream_meta_data.phpt index 26453af134..735a2e0d7b 100644 --- a/ext/zip/tests/stream_meta_data.phpt +++ b/ext/zip/tests/stream_meta_data.phpt @@ -11,7 +11,7 @@ $file = $dirname . 'test_with_comment.zip'; include $dirname . 'utils.inc'; $zip = new ZipArchive; if (!$zip->open($file)) { - exit('failed'); + exit('failed'); } $fp = $zip->getStream('foo'); diff --git a/ext/zip/tests/utils.inc b/ext/zip/tests/utils.inc index f44ab3af32..6d5049e558 100644 --- a/ext/zip/tests/utils.inc +++ b/ext/zip/tests/utils.inc @@ -9,7 +9,7 @@ function verify_entries($zip, $entries = []) { if (!in_array($stat["name"], $entries)) { $verified = false; } - + $found[] = $stat["name"]; } @@ -22,17 +22,17 @@ function verify_entries($zip, $entries = []) { /* recursively remove a directoryy */ function rmdir_rf($dir) { - if ($handle = opendir($dir)) { - while (false !== ($item = readdir($handle))) { - if ($item != "." && $item != "..") { - if (is_dir($dir . '/' . $item)) { - rmdir_rf($dir . '/' . $item); - } else { - unlink($dir . '/' . $item); - } - } - } - closedir($handle); - rmdir($dir); - } + if ($handle = opendir($dir)) { + while (false !== ($item = readdir($handle))) { + if ($item != "." && $item != "..") { + if (is_dir($dir . '/' . $item)) { + rmdir_rf($dir . '/' . $item); + } else { + unlink($dir . '/' . $item); + } + } + } + closedir($handle); + rmdir($dir); + } } |