Edit report at https://bugs.php.net/bug.php?id=55441&edit=1
ID: 55441
User updated by: frederic dot hardy at mageekbox dot net
Reported by: frederic dot hardy at mageekbox dot net
Summary: \Phar::createDefaultStub() does not handle its
arguments
-Status: Feedback
+Status: Open
Type: Bug
Package: PHAR related
Operating System: MacOS X 10.6.8
PHP Version: 5.3.6
Block user comment: N
Private report: N
New Comment:
<?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
Previous Comments:
------------------------------------------------------------------------
[2011-08-22 14:13:29] [email protected]
By quickly skimming over the source it seems that in order for this function to
work both parameters must have a value. Have you tried that?
------------------------------------------------------------------------
[2011-08-17 13:43:16] 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
------------------------------------------------------------------------
--
Edit this bug report at https://bugs.php.net/bug.php?id=55441&edit=1