PHP 8.5.0 Alpha 4 available for testing

Voting

: nine minus eight?
(Example: nine)

The Note You're Voting On

James
12 years ago
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".

<< Back to user notes page

To Top