|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
[2011-08-17 13:43 UTC] frederic dot hardy at mageekbox dot net
Description:
------------
\Phar::createDefaultStub() takes two optional arguments.
With these arguments, the user can defined file in phar archive which will be used
in stub.
However, these arguments seems to be not used by \Phar::createDefaultStub().
Test script:
---------------
<?php
# In CLI, do php -d phar.readonly=0 path/to/this/script to generate my.phar.
# In CLI, do php my.phar
$phar = new \phar('my.phar');
$phar['stub.php'] = '<?php echo 'This is the stub !'; ?>';
$phar->createDefaultStub('stub.php');
Expected result:
----------------
This is the stub !
Actual result:
--------------
PHP Warning: include(phar:///path/to/my.phar/index.php): failed to open stream:
phar error: "index.php" is not a file in phar "/path/to/my.phar" in
/path/to/my.phar on line 9
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
|
|||||||||||||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Thu Oct 30 15:00:01 2025 UTC |
<?php $phar = new phar('createDefaultStub.phar'); $phar['cli.php'] = '<?php echo \'CLI\' . PHP_EOL; ?>'; $phar['web.php'] = '<?php echo \'WEB\' . PHP_EOL; ?>'; $phar->createDefaultStub('cli.php', 'web.php'); ?> # php createDefaultStub.phar PHP Warning: include(phar:///path/to/createDefaultStub.phar/index.php): failed to open stream: phar error: "index.php" is not a file in phar "/path/to/createDefaultStub.phar" in /path/to/createDefaultStub.phar on line 9