Bug->Doc #55441 [Bgs]: \Phar::createDefaultStub() does not handle its arguments

From: Date: Mon, 29 Aug 2011 18:17:31 +0000
Subject: Bug->Doc #55441 [Bgs]: \Phar::createDefaultStub() does not handle its arguments
References: 1  Groups: php.doc.bugs 
Request: Send a blank email to doc-bugs+get-7086@lists.php.net to get a copy of this message
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:             Bogus
-Type:               Bug
+Type:               Documentation Problem
 Package:            PHAR related
 Operating System:   MacOS X 10.6.8
 PHP Version:        5.3.6
 Block user comment: N
 Private report:     N

 New Comment:

So there is a bug in the documentation about /phar::createDefaultStub().


Previous Comments:
------------------------------------------------------------------------
[2011-08-29 15:03:14] 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-22 19:44:34] 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-22 14:13:29] 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-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


Thread (1 message)

  • frederic dot hardy at mageekbox dot net
  • Unknown Message
    • frederic dot hardy at mageekbox dot net
« previous php.doc.bugs (#7086) next »