diff options
author | Tom Van Looy <tom@ctors.net> | 2016-11-20 10:08:51 +0100 |
---|---|---|
committer | Nikita Popov <nikic@php.net> | 2016-11-20 14:16:50 +0100 |
commit | 442fd2f92a2c89eb4721c7d2b861aed09f792a0f (patch) | |
tree | 37a5be406b587e4ab0407aeb824db18eae06df43 /ext/phar/tests/zip | |
parent | d37482679aa072190986df84a7168b0ccdbc7acf (diff) | |
download | php-git-442fd2f92a2c89eb4721c7d2b861aed09f792a0f.tar.gz |
Cleanup tests version checks
Diffstat (limited to 'ext/phar/tests/zip')
18 files changed, 2 insertions, 559 deletions
diff --git a/ext/phar/tests/zip/all.phpt b/ext/phar/tests/zip/all.phpt index d69b76e1ea..82769345ce 100644 --- a/ext/phar/tests/zip/all.phpt +++ b/ext/phar/tests/zip/all.phpt @@ -3,7 +3,6 @@ Phar: test that creation of zip-based phar generates valid zip with all bells/wh --SKIPIF-- <?php if (!extension_loaded("phar")) die("skip"); -if (version_compare(PHP_VERSION, "6.0", "==")) die("skip pre-unicode version of PHP required"); if (!extension_loaded("spl")) die("skip SPL not available"); if (!extension_loaded("zlib")) die("skip zlib not available"); if (!extension_loaded("bz2")) die("skip bz2 not available"); diff --git a/ext/phar/tests/zip/allU.phpt b/ext/phar/tests/zip/allU.phpt deleted file mode 100644 index 97a9dd53bd..0000000000 --- a/ext/phar/tests/zip/allU.phpt +++ /dev/null @@ -1,65 +0,0 @@ ---TEST-- -Phar: test that creation of zip-based phar generates valid zip with all bells/whistles ---SKIPIF-- -<?php -if (!extension_loaded("phar")) die("skip"); -if (version_compare(PHP_VERSION, "6.0", "!=")) die("skip Unicode support required"); -if (!extension_loaded("spl")) die("skip SPL not available"); -if (!extension_loaded("zlib")) die("skip zlib not available"); -if (!extension_loaded("bz2")) die("skip bz2 not available"); -?> ---INI-- -phar.readonly=0 ---FILE-- -<?php - -$fname = dirname(__FILE__) . '/' . basename(__FILE__, '.php') . '.phar.zip.php'; -$pname = 'phar://' . $fname; -$fname2 = dirname(__FILE__) . '/' . basename(__FILE__, '.php') . '.2.phar.zip.php'; -$pname2 = 'phar://' . $fname2; - -$phar = new Phar($fname); - -$phar->setMetadata('hi there'); -$phar['a'] = 'hi'; -$phar['a']->setMetadata('a meta'); -$phar['b'] = 'hi2'; -$phar['b']->compress(Phar::GZ); -$phar['c'] = 'hi3'; -$phar['c']->compress(Phar::BZ2); -$phar['b']->chmod(0444); -$phar->setStub("<?php ok __HALT_COMPILER();"); -$phar->setAlias("hime"); -unset($phar); -copy($fname, $fname2); -Phar::unlinkArchive($fname); -var_dump(file_exists($fname), file_exists($pname . '/a')); - -$phar = new Phar($fname2); -var_dump($phar['a']->getContent(), $phar['b']->getContent(), $phar['c']->getContent()); -var_dump($phar['a']->isCompressed(), $phar['b']->isCompressed() == Phar::GZ, $phar['c']->isCompressed() == Phar::BZ2); -var_dump((string) decoct(fileperms($pname2 . '/b'))); -var_dump($phar->getStub()); -var_dump($phar->getAlias()); -var_dump($phar->getMetadata()); -var_dump($phar['a']->getMetadata()); -?> -===DONE=== ---CLEAN-- -<?php unlink(dirname(__FILE__) . '/' . basename(__FILE__, '.clean.php') . '.2.phar.zip.php'); ?> ---EXPECT-- -bool(false) -bool(false) -string(2) "hi" -string(3) "hi2" -string(3) "hi3" -bool(false) -bool(true) -bool(true) -unicode(6) "100444" -string(32) "<?php ok __HALT_COMPILER(); ?> -" -string(4) "hime" -unicode(8) "hi there" -unicode(6) "a meta" -===DONE=== diff --git a/ext/phar/tests/zip/metadata_write_commit.phpt b/ext/phar/tests/zip/metadata_write_commit.phpt index 326695f825..0de63401ce 100644 --- a/ext/phar/tests/zip/metadata_write_commit.phpt +++ b/ext/phar/tests/zip/metadata_write_commit.phpt @@ -3,7 +3,6 @@ Phar with meta-data (write) zip-based --SKIPIF-- <?php if (!extension_loaded("phar")) die("skip"); -if (version_compare(PHP_VERSION, "6.0", "==")) die("skip pre-unicode version of PHP required"); ?> --INI-- phar.require_hash=0 diff --git a/ext/phar/tests/zip/metadata_write_commitU.phpt b/ext/phar/tests/zip/metadata_write_commitU.phpt deleted file mode 100644 index 9e54ba7f6b..0000000000 --- a/ext/phar/tests/zip/metadata_write_commitU.phpt +++ /dev/null @@ -1,88 +0,0 @@ ---TEST-- -Phar with meta-data (write) zip-based ---SKIPIF-- -<?php -if (!extension_loaded("phar")) die("skip"); -if (version_compare(PHP_VERSION, "6.0", "!=")) die("skip Unicode support required"); -?> ---INI-- -phar.require_hash=0 -phar.readonly=0 ---FILE-- -<?php -$fname = dirname(__FILE__) . '/' . basename(__FILE__, '.php') . '.phar.zip.php'; -$f2name = dirname(__FILE__) . '/files/metadata.phar.zip'; -$pname = 'phar://' . $fname; -$p2name = 'phar://' . $f2name; - -$file = "<?php __HALT_COMPILER(); ?>"; - -$files = array(); -$files['a'] = array('cont' => 'a'); -$files['b'] = array('cont' => 'b', 'meta' => 'hi there'); -$files['c'] = array('cont' => 'c', 'meta' => array('hi', 'there')); -$files['d'] = array('cont' => 'd', 'meta' => array('hi'=>'there','foo'=>'bar')); - -foreach($files as $name => $cont) { - var_dump(file_get_contents($p2name.'/'.$name)); -} - -copy($f2name, $fname); -$phar = new Phar($fname); -$phar->startBuffering(); -$phar['a']->setMetadata(42); -$phar['b']->setMetadata(NULL); -$phar['c']->setMetadata(array(25, 'foo'=>'bar')); -$phar['d']->setMetadata(true); -$phar->setMetadata('hi'); - -foreach($files as $name => $cont) { - var_dump($phar[$name]->getMetadata()); -} -$phar->stopBuffering(); - -unset($phar); - -$phar = new Phar($fname); - -foreach($files as $name => $cont) { - var_dump(file_get_contents($pname.'/'.$name)); -} - -foreach($files as $name => $cont) { - var_dump($phar[$name]->getMetadata()); -} -var_dump($phar->getMetadata()); -?> -===DONE=== ---CLEAN-- -<?php unlink(dirname(__FILE__) . '/' . basename(__FILE__, '.clean.php') . '.phar.zip.php'); ?> ---EXPECT-- -string(1) "a" -string(1) "b" -string(1) "c" -string(1) "d" -int(42) -NULL -array(2) { - [0]=> - int(25) - [u"foo"]=> - unicode(3) "bar" -} -bool(true) -string(1) "a" -string(1) "b" -string(1) "c" -string(1) "d" -int(42) -NULL -array(2) { - [0]=> - int(25) - [u"foo"]=> - unicode(3) "bar" -} -bool(true) -unicode(2) "hi" -===DONE=== diff --git a/ext/phar/tests/zip/open_for_write_existing_b.phpt b/ext/phar/tests/zip/open_for_write_existing_b.phpt index d1f963e9af..24368ad34b 100644 --- a/ext/phar/tests/zip/open_for_write_existing_b.phpt +++ b/ext/phar/tests/zip/open_for_write_existing_b.phpt @@ -3,7 +3,6 @@ Phar: fopen a .phar for writing (existing file) zip-based --SKIPIF-- <?php if (!extension_loaded("phar")) die("skip"); -if (version_compare(PHP_VERSION, "5.3", "<")) die("skip requires 5.3 or later"); ?> --INI-- phar.readonly=0 diff --git a/ext/phar/tests/zip/open_for_write_existing_b_5_2.phpt b/ext/phar/tests/zip/open_for_write_existing_b_5_2.phpt deleted file mode 100644 index 522a1deda6..0000000000 --- a/ext/phar/tests/zip/open_for_write_existing_b_5_2.phpt +++ /dev/null @@ -1,53 +0,0 @@ ---TEST-- -Phar: fopen a .phar for writing (existing file) zip-based ---SKIPIF-- -<?php if (!extension_loaded("phar")) die("skip"); ?> -<?php if (version_compare(PHP_VERSION, "5.3", ">")) die("skip requires 5.2 or earlier"); ?> ---INI-- -phar.readonly=0 -phar.require_hash=0 ---FILE-- -<?php - -$fname = dirname(__FILE__) . '/' . basename(__FILE__, '.php') . '.phar.zip'; -$alias = 'phar://' . $fname; - -$phar = new Phar($fname); -$phar->setStub('<?php __HALT_COMPILER(); ?>'); - -$files = array(); - -$files['a.php'] = '<?php echo "This is a\n"; ?>'; -$files['b.php'] = '<?php echo "This is b\n"; ?>'; -$files['b/c.php'] = '<?php echo "This is b/c\n"; ?>'; - -foreach ($files as $n => $file) { - $phar[$n] = $file; -} -$phar->stopBuffering(); - -ini_set('phar.readonly', 1); - -function err_handler($errno, $errstr, $errfile, $errline) { - echo "Recoverable fatal error: $errstr in $errfile on line $errline\n"; -} - -set_error_handler("err_handler", E_RECOVERABLE_ERROR); - -$fp = fopen($alias . '/b/c.php', 'wb'); -fwrite($fp, 'extra'); -fclose($fp); -include $alias . '/b/c.php'; -?> -===DONE=== ---CLEAN-- -<?php unlink(dirname(__FILE__) . '/' . basename(__FILE__, '.clean.php') . '.phar.zip'); ?> ---EXPECTF-- - -Warning: fopen(phar://%sopen_for_write_existing_b_5_2.phar.zip/b/c.php): failed to open stream: phar error: write operations disabled by the php.ini setting phar.readonly in %sopen_for_write_existing_b_5_2.php on line %d - -Warning: fwrite(): supplied argument is not a valid stream resource in %spen_for_write_existing_b_5_2.php on line %d - -Warning: fclose(): supplied argument is not a valid stream resource in %spen_for_write_existing_b_5_2.php on line %d -This is b/c -===DONE=== diff --git a/ext/phar/tests/zip/open_for_write_existing_c.phpt b/ext/phar/tests/zip/open_for_write_existing_c.phpt index 313ee4ab32..3e769cf427 100644 --- a/ext/phar/tests/zip/open_for_write_existing_c.phpt +++ b/ext/phar/tests/zip/open_for_write_existing_c.phpt @@ -3,7 +3,6 @@ Phar: fopen a .phar for writing (existing file) zip-based --SKIPIF-- <?php if (!extension_loaded("phar")) die("skip"); -if (version_compare(PHP_VERSION, "5.3", "<")) die("skip requires 5.3 or later"); ?> --INI-- phar.readonly=0 diff --git a/ext/phar/tests/zip/open_for_write_existing_c_5_2.phpt b/ext/phar/tests/zip/open_for_write_existing_c_5_2.phpt deleted file mode 100644 index 9e23fd55b3..0000000000 --- a/ext/phar/tests/zip/open_for_write_existing_c_5_2.phpt +++ /dev/null @@ -1,47 +0,0 @@ ---TEST-- -Phar: fopen a .phar for writing (existing file) zip-based ---SKIPIF-- -<?php if (!extension_loaded("phar")) die("skip"); ?> -<?php if (version_compare(PHP_VERSION, "5.3", ">")) die("skip requires 5.2 or earlier"); ?> ---INI-- -phar.readonly=0 -phar.require_hash=0 ---FILE-- -<?php - -$fname = dirname(__FILE__) . '/' . basename(__FILE__, '.php') . '.phar.zip'; -$alias = 'phar://' . $fname; - -$phar = new Phar($fname); -$phar->setStub('<?php __HALT_COMPILER(); ?>'); - -$files = array(); - -$files['a.php'] = '<?php echo "This is a\n"; ?>'; -$files['b.php'] = '<?php echo "This is b\n"; ?>'; -$files['b/c.php'] = '<?php echo "This is b/c\n"; ?>'; - -foreach ($files as $n => $file) { - $phar[$n] = $file; -} -$phar->stopBuffering(); - -ini_set('phar.readonly', 1); - -$fp = fopen($alias . '/b/c.php', 'wb'); -fwrite($fp, 'extra'); -fclose($fp); -include $alias . '/b/c.php'; -?> -===DONE=== ---CLEAN-- -<?php unlink(dirname(__FILE__) . '/' . basename(__FILE__, '.clean.php') . '.phar.zip'); ?> ---EXPECTF-- - -Warning: fopen(phar://%sopen_for_write_existing_c_5_2.phar.zip/b/c.php): failed to open stream: phar error: write operations disabled by the php.ini setting phar.readonly in %sopen_for_write_existing_c_5_2.php on line %d - -Warning: fwrite(): supplied argument is not a valid stream resource in %sopen_for_write_existing_c_5_2.php on line %d - -Warning: fclose(): supplied argument is not a valid stream resource in %sopen_for_write_existing_c_5_2.php on line %d -This is b/c -===DONE=== diff --git a/ext/phar/tests/zip/open_for_write_newfile_b.phpt b/ext/phar/tests/zip/open_for_write_newfile_b.phpt index 9f5328ff91..9303a457e0 100644 --- a/ext/phar/tests/zip/open_for_write_newfile_b.phpt +++ b/ext/phar/tests/zip/open_for_write_newfile_b.phpt @@ -3,7 +3,6 @@ Phar: fopen a .phar for writing (new file) zip-based --SKIPIF-- <?php if (!extension_loaded("phar")) die("skip"); -if (version_compare(PHP_VERSION, "5.3", "<")) die("skip requires 5.3 or later"); ?> --INI-- phar.readonly=0 diff --git a/ext/phar/tests/zip/open_for_write_newfile_b_5_2.phpt b/ext/phar/tests/zip/open_for_write_newfile_b_5_2.phpt deleted file mode 100644 index 2575201bd1..0000000000 --- a/ext/phar/tests/zip/open_for_write_newfile_b_5_2.phpt +++ /dev/null @@ -1,61 +0,0 @@ ---TEST-- -Phar: fopen a .phar for writing (new file) zip-based ---SKIPIF-- -<?php if (!extension_loaded("phar")) die("skip"); ?> -<?php if (version_compare(PHP_VERSION, "5.3", ">")) die("skip requires 5.2 or earlier"); ?> ---INI-- -phar.readonly=0 -phar.require_hash=0 ---FILE-- -<?php - -$fname = dirname(__FILE__) . '/' . basename(__FILE__, '.php') . '.phar.zip'; -$alias = 'phar://' . $fname; - -$phar = new Phar($fname); -$phar->setStub('<?php __HALT_COMPILER(); ?>'); - -$files = array(); - -$files['a.php'] = '<?php echo "This is a\n"; ?>'; -$files['b.php'] = '<?php echo "This is b\n"; ?>'; -$files['b/c.php'] = '<?php echo "This is b/c\n"; ?>'; - -foreach ($files as $n => $file) { - $phar[$n] = $file; -} -$phar->stopBuffering(); - -ini_set('phar.readonly', 1); - -function err_handler($errno, $errstr, $errfile, $errline) { - echo "Recoverable fatal error: $errstr in $errfile on line $errline\n"; -} - -set_error_handler("err_handler", E_RECOVERABLE_ERROR); - -$fp = fopen($alias . '/b/new.php', 'wb'); -fwrite($fp, 'extra'); -fclose($fp); - -include $alias . '/b/c.php'; -include $alias . '/b/new.php'; -?> - -===DONE=== ---CLEAN-- -<?php unlink(dirname(__FILE__) . '/' . basename(__FILE__, '.clean.php') . '.phar.zip'); ?> ---EXPECTF-- - -Warning: fopen(phar://%sopen_for_write_newfile_b_5_2.phar.zip/b/new.php): failed to open stream: phar error: write operations disabled by the php.ini setting phar.readonly in %sopen_for_write_newfile_b_5_2.php on line %d - -Warning: fwrite(): supplied argument is not a valid stream resource in %sopen_for_write_newfile_b_5_2.php on line %d - -Warning: fclose(): supplied argument is not a valid stream resource in %sopen_for_write_newfile_b_5_2.php on line %d -This is b/c - -Warning: include(phar://%sopen_for_write_newfile_b_5_2.phar.zip/b/new.php): failed to open stream: phar error: "b/new.php" is not a file in phar "%sopen_for_write_newfile_b_5_2.phar.zip" in %sopen_for_write_newfile_b_5_2.php on line %d - -Warning: include(): Failed opening 'phar://%sopen_for_write_newfile_b_5_2.phar.zip/b/new.php' for inclusion (include_path='%s') in %sopen_for_write_newfile_b_5_2.php on line %d - -===DONE=== diff --git a/ext/phar/tests/zip/open_for_write_newfile_c.phpt b/ext/phar/tests/zip/open_for_write_newfile_c.phpt index ef580cb229..f50a152243 100644 --- a/ext/phar/tests/zip/open_for_write_newfile_c.phpt +++ b/ext/phar/tests/zip/open_for_write_newfile_c.phpt @@ -3,7 +3,6 @@ Phar: fopen a .phar for writing (new file) zip-based --SKIPIF-- <?php if (!extension_loaded("phar")) die("skip"); -if (version_compare(PHP_VERSION, "5.3", "<")) die("skip requires 5.3 or later"); ?> --INI-- phar.readonly=0 @@ -54,4 +53,4 @@ Warning: include(phar://%sopen_for_write_newfile_c.phar.zip/b/new.php): failed t Warning: include(): Failed opening 'phar://%sopen_for_write_newfile_c.phar.zip/b/new.php' for inclusion (include_path='%s') in %sopen_for_write_newfile_c.php on line %d -===DONE===
\ No newline at end of file +===DONE=== diff --git a/ext/phar/tests/zip/open_for_write_newfile_c_5_2.phpt b/ext/phar/tests/zip/open_for_write_newfile_c_5_2.phpt deleted file mode 100644 index 9bf5af54ff..0000000000 --- a/ext/phar/tests/zip/open_for_write_newfile_c_5_2.phpt +++ /dev/null @@ -1,55 +0,0 @@ ---TEST-- -Phar: fopen a .phar for writing (new file) zip-based ---SKIPIF-- -<?php if (!extension_loaded("phar")) die("skip"); ?> -<?php if (version_compare(PHP_VERSION, "5.3", ">")) die("skip requires 5.2 or earlier"); ?> ---INI-- -phar.readonly=0 -phar.require_hash=0 ---FILE-- -<?php - -$fname = dirname(__FILE__) . '/' . basename(__FILE__, '.php') . '.phar.zip'; -$alias = 'phar://' . $fname; - -$phar = new Phar($fname); -$phar->setStub('<?php __HALT_COMPILER(); ?>'); - -$files = array(); - -$files['a.php'] = '<?php echo "This is a\n"; ?>'; -$files['b.php'] = '<?php echo "This is b\n"; ?>'; -$files['b/c.php'] = '<?php echo "This is b/c\n"; ?>'; - -foreach ($files as $n => $file) { - $phar[$n] = $file; -} -$phar->stopBuffering(); - -ini_set('phar.readonly', 1); - -$fp = fopen($alias . '/b/new.php', 'wb'); -fwrite($fp, 'extra'); -fclose($fp); - -include $alias . '/b/c.php'; -include $alias . '/b/new.php'; -?> - -===DONE=== ---CLEAN-- -<?php unlink(dirname(__FILE__) . '/' . basename(__FILE__, '.clean.php') . '.phar.zip'); ?> ---EXPECTF-- - -Warning: fopen(phar://%sopen_for_write_newfile_c_5_2.phar.zip/b/new.php): failed to open stream: phar error: write operations disabled by the php.ini setting phar.readonly in %sopen_for_write_newfile_c_5_2.php on line %d - -Warning: fwrite(): supplied argument is not a valid stream resource in %sopen_for_write_newfile_c_5_2.php on line %d - -Warning: fclose(): supplied argument is not a valid stream resource in %sopen_for_write_newfile_c_5_2.php on line %d -This is b/c - -Warning: include(phar://%sopen_for_write_newfile_c_5_2.phar.zip/b/new.php): failed to open stream: phar error: "b/new.php" is not a file in phar "%sopen_for_write_newfile_c_5_2.phar.zip" in %sopen_for_write_newfile_c_5_2.php on line %d - -Warning: include(): Failed opening 'phar://%sopen_for_write_newfile_c_5_2.phar.zip/b/new.php' for inclusion (include_path='%s') in %sopen_for_write_newfile_c_5_2.php on line %d - -===DONE=== diff --git a/ext/phar/tests/zip/phar_begin_setstub_commit.phpt b/ext/phar/tests/zip/phar_begin_setstub_commit.phpt index 5c42c29962..fe200949e8 100644 --- a/ext/phar/tests/zip/phar_begin_setstub_commit.phpt +++ b/ext/phar/tests/zip/phar_begin_setstub_commit.phpt @@ -3,7 +3,6 @@ Phar::startBuffering()/setStub()/stopBuffering() zip-based --SKIPIF-- <?php if (!extension_loaded("phar")) die("skip"); -if (version_compare(PHP_VERSION, "6.0", "==")) die("skip pre-unicode version of PHP required"); ?> --INI-- phar.readonly=0 @@ -68,4 +67,4 @@ string(93) "<?php var_dump("First resource"); Phar::mapPhar("brandnewphar.phar") " string(93) "<?php var_dump("First resource"); Phar::mapPhar("brandnewphar.phar"); __HALT_COMPILER(); ?> " -===DONE===
\ No newline at end of file +===DONE=== diff --git a/ext/phar/tests/zip/phar_begin_setstub_commitU.phpt b/ext/phar/tests/zip/phar_begin_setstub_commitU.phpt deleted file mode 100644 index ae38d59c5f..0000000000 --- a/ext/phar/tests/zip/phar_begin_setstub_commitU.phpt +++ /dev/null @@ -1,71 +0,0 @@ ---TEST-- -Phar::startBuffering()/setStub()/stopBuffering() zip-based ---SKIPIF-- -<?php -if (!extension_loaded("phar")) die("skip"); -if (version_compare(PHP_VERSION, "6.0", "!=")) die("skip Unicode support required"); -?> ---INI-- -phar.readonly=0 ---FILE-- -<?php -$p = new Phar(dirname(__FILE__) . '/brandnewphar.phar.zip', 0, 'brandnewphar.phar'); -var_dump($p->isFileFormat(Phar::ZIP)); -//var_dump($p->getStub()); -var_dump($p->isBuffering()); -$p->startBuffering(); -var_dump($p->isBuffering()); -$p['a.php'] = '<?php var_dump("Hello");'; -$p->setStub('<?php var_dump("First"); Phar::mapPhar("brandnewphar.phar"); __HALT_COMPILER(); ?>'); -include 'phar://brandnewphar.phar/a.php'; -var_dump($p->getStub()); -$p['b.php'] = '<?php var_dump("World");'; -$p->setStub('<?php var_dump("Second"); Phar::mapPhar("brandnewphar.phar"); __HALT_COMPILER();'); -include 'phar://brandnewphar.phar/b.php'; -var_dump($p->getStub()); -$p->stopBuffering(); -echo "===COMMIT===\n"; -var_dump($p->isBuffering()); -include 'phar://brandnewphar.phar/a.php'; -include 'phar://brandnewphar.phar/b.php'; -var_dump($p->getStub()); - -// add portion to test setting stub from resource -file_put_contents(dirname(__FILE__) . '/myfakestub.php', '<?php var_dump("First resource"); Phar::mapPhar("brandnewphar.phar"); __HALT_COMPILER(); ?>'); -$a = fopen(dirname(__FILE__) . '/myfakestub.php', 'rb'); -$p->setStub($a); -var_dump($p->getStub()); -$c = strlen('<?php var_dump("First resource"); Phar::mapPhar("brandnewphar.phar"); __HALT_COMPILER(); ?>'); -file_put_contents(dirname(__FILE__) . '/myfakestub.php', '<?php var_dump("First resource"); Phar::mapPhar("brandnewphar.phar"); __HALT_COMPILER(); ?>' . 'extra stuff'); -fseek($a, 0); -$p->setStub($a, $c); -var_dump($p->getStub()); -fclose($a); -?> -===DONE=== ---CLEAN-- -<?php -unlink(dirname(__FILE__) . '/brandnewphar.phar.zip'); -unlink(dirname(__FILE__) . '/myfakestub.php'); -?> ---EXPECT-- -bool(true) -bool(false) -bool(true) -unicode(5) "Hello" -string(84) "<?php var_dump("First"); Phar::mapPhar("brandnewphar.phar"); __HALT_COMPILER(); ?> -" -unicode(5) "World" -string(85) "<?php var_dump("Second"); Phar::mapPhar("brandnewphar.phar"); __HALT_COMPILER(); ?> -" -===COMMIT=== -bool(false) -unicode(5) "Hello" -unicode(5) "World" -string(85) "<?php var_dump("Second"); Phar::mapPhar("brandnewphar.phar"); __HALT_COMPILER(); ?> -" -string(93) "<?php var_dump("First resource"); Phar::mapPhar("brandnewphar.phar"); __HALT_COMPILER(); ?> -" -string(93) "<?php var_dump("First resource"); Phar::mapPhar("brandnewphar.phar"); __HALT_COMPILER(); ?> -" -===DONE=== diff --git a/ext/phar/tests/zip/phar_magic.phpt b/ext/phar/tests/zip/phar_magic.phpt index b05e6974a8..4dfdd2e84d 100644 --- a/ext/phar/tests/zip/phar_magic.phpt +++ b/ext/phar/tests/zip/phar_magic.phpt @@ -3,7 +3,6 @@ Phar: include/fopen magic zip-based --SKIPIF-- <?php if (!extension_loaded("phar")) die("skip"); -if (version_compare(PHP_VERSION, "6.0", "==")) die("skip pre-unicode version of PHP required"); ?> --INI-- phar.require_hash=0 @@ -21,9 +20,6 @@ $p->setStub('<?php var_dump(__FILE__); var_dump(substr(__FILE__, 0, 4) != "phar"); set_include_path("phar://" . __FILE__); -if (version_compare(PHP_VERSION, "5.3", "<")) { -Phar::interceptFileFuncs(); -} include "phar://" . __FILE__ . "/a"; __HALT_COMPILER();'); include $pname; diff --git a/ext/phar/tests/zip/phar_magicU.phpt b/ext/phar/tests/zip/phar_magicU.phpt deleted file mode 100644 index 4f843bc378..0000000000 --- a/ext/phar/tests/zip/phar_magicU.phpt +++ /dev/null @@ -1,41 +0,0 @@ ---TEST-- -Phar: include/fopen magic zip-based ---SKIPIF-- -<?php -if (!extension_loaded("phar")) die("skip"); -if (version_compare(PHP_VERSION, "6.0", "!=")) die("skip Unicode support required"); -?> ---INI-- -phar.require_hash=0 -phar.readonly=0 ---FILE-- -<?php -$fname = dirname(__FILE__) . '/' . basename(__FILE__, '.php') . '.phar.zip.php'; -$pname = dirname(__FILE__) . '/' . basename(__FILE__, '.php') . '.phar.zip.php'; -$p = new Phar($fname); -var_dump($p->isFileFormat(Phar::ZIP)); -$p['a'] = '<?php include "b/c.php";' . "\n"; -$p['b/c.php'] = '<?php echo "in b\n";$a = fopen("a", "r", true);echo stream_get_contents($a);fclose($a);include dirname(__FILE__) . "/../d";'; -$p['d'] = "in d\n"; -$p->setStub('<?php -var_dump(__FILE__); -var_dump(substr(__FILE__, 0, 4) != "phar"); -set_include_path("phar://" . __FILE__); -include "phar://" . __FILE__ . "/a"; -__HALT_COMPILER();'); -include $pname; -?> -===DONE=== ---CLEAN-- -<?php -unlink(dirname(__FILE__) . '/' . basename(__FILE__, '.clean.php') . '.phar.zip.php'); -__HALT_COMPILER(); -?> ---EXPECTF-- -bool(true) -unicode(%d) "%sphar_magicU.phar.zip.php" -bool(true) -in b -<?php include "b/c.php"; -in d -===DONE=== diff --git a/ext/phar/tests/zip/refcount1.phpt b/ext/phar/tests/zip/refcount1.phpt index 618e7fefca..9917871148 100644 --- a/ext/phar/tests/zip/refcount1.phpt +++ b/ext/phar/tests/zip/refcount1.phpt @@ -3,7 +3,6 @@ Phar: test that refcounting avoids problems with deleting a file zip-based --SKIPIF-- <?php if (!extension_loaded("phar")) die("skip"); ?> <?php if (!extension_loaded("spl")) die("skip SPL not available"); ?> -<?php if (version_compare(PHP_VERSION, "5.3", "<")) die("skip requires 5.3 or later"); ?> --INI-- phar.readonly=0 phar.require_hash=0 diff --git a/ext/phar/tests/zip/refcount1_5_2.phpt b/ext/phar/tests/zip/refcount1_5_2.phpt deleted file mode 100644 index f3b2771f44..0000000000 --- a/ext/phar/tests/zip/refcount1_5_2.phpt +++ /dev/null @@ -1,64 +0,0 @@ ---TEST-- -Phar: test that refcounting avoids problems with deleting a file zip-based ---SKIPIF-- -<?php if (!extension_loaded("phar")) die("skip"); ?> -<?php if (!extension_loaded("spl")) die("skip SPL not available"); ?> -<?php if (version_compare(PHP_VERSION, "5.3", ">")) die("skip requires 5.2 or earlier"); ?> ---INI-- -phar.readonly=0 -phar.require_hash=0 ---FILE-- -<?php - -$fname = dirname(__FILE__) . '/' . basename(__FILE__, '.php') . '.phar.zip'; -$alias = 'phar://' . $fname; - -$phar = new Phar($fname); -$phar->setStub("<?php __HALT_COMPILER(); ?>"); -$phar->setAlias('hio'); - -$files = array(); - -$files['a.php'] = '<?php echo "This is a\n"; ?>'; -$files['b.php'] = '<?php echo "This is b\n"; ?>'; -$files['b/c.php'] = '<?php echo "This is b/c\n"; ?>'; - -foreach ($files as $n => $file) { - $phar[$n] = $file; -} -$phar->stopBuffering(); - -$fp = fopen($alias . '/b/c.php', 'wb'); -fwrite($fp, "extra"); -fclose($fp); - -echo "===CLOSE===\n"; - -$b = fopen($alias . '/b/c.php', 'rb'); -$a = $phar['b/c.php']; -var_dump($a); -var_dump(fread($b, 20)); -rewind($b); -echo "===UNLINK===\n"; -unlink($alias . '/b/c.php'); -var_dump($a); -var_dump(fread($b, 20)); -include $alias . '/b/c.php'; -?> - -===DONE=== ---CLEAN-- -<?php unlink(dirname(__FILE__) . '/' . basename(__FILE__, '.clean.php') . '.phar.zip'); ?> ---EXPECTF-- -===CLOSE=== -object(PharFileInfo)#%d (0) { -} -string(5) "extra" -===UNLINK=== - -Warning: unlink(): phar error: "b/c.php" in phar "%sefcount1_5_2.phar.zip", has open file pointers, cannot unlink in %sefcount1_5_2.php on line %d -object(PharFileInfo)#%d (0) { -} -string(5) "extra" -extra -===DONE=== |