php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Doc Bug #55441 \Phar::createDefaultStub() does not handle its arguments
Submitted: 2011-08-17 13:43 UTC Modified: 2011-08-29 18:17 UTC
Votes:1
Avg. Score:4.0 ± 0.0
Reproduced:1 of 1 (100.0%)
Same Version:0 (0.0%)
Same OS:0 (0.0%)
From: frederic dot hardy at mageekbox dot net Assigned:
Status: Not a bug Package: PHAR related
PHP Version: 5.3.6 OS: MacOS X 10.6.8
Private report: No CVE-ID: None
View Add Comment Developer Edit
Welcome! If you don't have a Git account, you can't do anything here.
You can add a comment by following this link or if you reported this bug, you can edit this bug over here.
(description)
Block user comment
Status: Assign to:
Package:
Bug Type:
Summary:
From: frederic dot hardy at mageekbox dot net
New email:
PHP Version: OS:

 

 [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

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2011-08-22 14:13 UTC] kalle@php.net
-Status: Open +Status: Feedback
 [2011-08-22 14:13 UTC] kalle@php.net
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-22 19:44 UTC] frederic dot hardy at mageekbox dot net
-Status: Feedback +Status: Open
 [2011-08-22 19:44 UTC] frederic dot hardy at mageekbox dot net
<?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
 [2011-08-29 15:03 UTC] bjori@php.net
-Status: Open +Status: Bogus
 [2011-08-29 15:03 UTC] bjori@php.net
Sorry, but your problem does not imply a bug in PHP itself.  For a
list of more appropriate places to ask for help using PHP, please
visit http://www.php.net/support.php as this bug system is not the
appropriate forum for asking support questions.  Due to the volume
of reports we can not explain in detail here why your report is not
a bug.  The support channels will be able to provide an explanation
for you.

Thank you for your interest in PHP.

You are looking for $phar->setDefaultStub() or $phar->setStub($phar-
>createDefaultStub());
 [2011-08-29 18:17 UTC] frederic dot hardy at mageekbox dot net
-Type: Bug +Type: Documentation Problem
 [2011-08-29 18:17 UTC] frederic dot hardy at mageekbox dot net
So there is a bug in the documentation about /phar::createDefaultStub().
 
PHP Copyright © 2001-2020 The PHP Group
All rights reserved.
Last updated: Mon Aug 10 02:01:24 2020 UTC