File:
[ELWIX - Embedded LightWeight unIX -] /
embedaddon /
php /
ext /
phar /
tests /
tar /
phar_setdefaultstub.phpt
Revision
1.1.1.1 (vendor branch):
download - view:
text,
annotated -
select for diffs -
revision graph
Tue Feb 21 23:48:00 2012 UTC (12 years, 5 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,
v5_3_10,
HEAD
php
--TEST--
Phar: Phar::setDefaultStub() with and without arg, tar-based phar
--SKIPIF--
<?php if (!extension_loaded("phar")) die("skip"); ?>
--INI--
phar.readonly=0
--FILE--
<?php
$fname = dirname(__FILE__) . '/' . basename(__FILE__, '.php') . '.phar.tar';
$phar = new Phar($fname);
$phar['a.php'] = '<php echo "this is a\n"; ?>';
$phar['b.php'] = '<php echo "this is b\n"; ?>';
$phar->setStub('<?php echo "Hello World\n"; __HALT_COMPILER(); ?>');
var_dump($phar->getStub());
echo "============================================================================\n";
echo "============================================================================\n";
try {
$phar->setDefaultStub();
$phar->stopBuffering();
} catch(Exception $e) {
echo $e->getMessage(). "\n";
}
var_dump($phar->getStub());
echo "============================================================================\n";
echo "============================================================================\n";
try {
$phar->setDefaultStub('my/custom/thingy.php');
$phar->stopBuffering();
} catch(Exception $e) {
echo $e->getMessage(). "\n";
}
var_dump($phar->getStub());
echo "============================================================================\n";
echo "============================================================================\n";
try {
$phar->setDefaultStub('my/custom/thingy.php', 'the/web.php');
$phar->stopBuffering();
} catch(Exception $e) {
echo $e->getMessage(). "\n";
}
var_dump($phar->getStub());
?>
===DONE===
--CLEAN--
<?php
unlink(dirname(__FILE__) . '/' . basename(__FILE__, '.clean.php') . '.phar.tar');
?>
--EXPECTF--
string(51) "<?php echo "Hello World\n"; __HALT_COMPILER(); ?>
"
============================================================================
============================================================================
string(60) "<?php // tar-based phar archive stub file
__HALT_COMPILER();"
============================================================================
============================================================================
Warning: Phar::setDefaultStub(): method accepts no arguments for a tar- or zip-based phar stub, 1 given in %sphar_setdefaultstub.php on line %d
string(60) "<?php // tar-based phar archive stub file
__HALT_COMPILER();"
============================================================================
============================================================================
Warning: Phar::setDefaultStub(): method accepts no arguments for a tar- or zip-based phar stub, 2 given in %sphar_setdefaultstub.php on line %d
string(60) "<?php // tar-based phar archive stub file
__HALT_COMPILER();"
===DONE===
FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>