It seems that calling Phar::webPhar() from inside a function is a bad idea. Doing so will cause global variables in included files to not be global. For instance, do NOT try this:
<?php
$phar = new Phar('test.phar.php');
$phar['test.php'] = '<?php
$FOO = "globals work";
function test() {
global $FOO;
echo "test: $FOO\n";
}
test();
?>';
$phar->setStub('<?php
function _bootstrap() {
Phar::webPhar();
}
_bootstrap();
__HALT_COMPILER(); ?>');
?>
The output will be "test:", not "test: globals work".