newentry = *entry;
if (newentry.link) {
newentry.link = estrdup(newentry.link);
+ goto no_copy;
+ }
+ if (newentry.tmp) {
+ newentry.tmp = estrdup(newentry.tmp);
+ goto no_copy;
}
if (FAILURE == phar_copy_file_contents(&newentry, phar->fp TSRMLS_CC)) {
zend_hash_destroy(&(phar->manifest));
/* exception already thrown */
return NULL;
}
+no_copy:
newentry.filename = estrndup(newentry.filename, newentry.filename_len);
if (newentry.metadata) {
zval *t;
phar.readonly=0
--FILE--
<?php
-$fname = dirname(__FILE__) . '/tempmanifest1.phar.php';
+$fname = dirname(__FILE__) . '/' . basename(__FILE__, '.php') . '.phar.php';
$pname = 'phar://' . $fname;
+$fname2 = dirname(__FILE__) . '/' . basename(__FILE__, '.php') . '.phar.tar';
$a = new Phar($fname);
$a['index.php'] = '<?php
__HALT_COMPILER();');
Phar::mount($pname . '/testit1', __FILE__);
include $fname;
+// test copying of a phar with mounted entries
+$b = $a->convertToExecutable(Phar::TAR);
+$b->setStub('<?php
+set_include_path("phar://" . __FILE__);
+include "index.php";
+__HALT_COMPILER();');
+try {
+include $fname2;
+} catch (Exception $e) {
+echo $e->getMessage(),"\n";
+}
?>
===DONE===
--CLEAN--
-<?php
-@unlink(dirname(__FILE__) . '/tempmanifest1.phar.php');
-?>
+<?php unlink(dirname(__FILE__) . '/' . basename(__FILE__, '.clean.php') . '.phar.php'); ?>
+<?php unlink(dirname(__FILE__) . '/' . basename(__FILE__, '.clean.php') . '.phar.tar'); ?>
--EXPECTF--
-Mounting of testit to %sphar_mount.php within phar %stempmanifest1.phar.php failed
-Can only mount internal paths within a phar archive, use a relative path instead of "phar://%stempmanifest1.phar.php/testit1"
+Mounting of testit to %sphar_mount.php within phar %sphar_mount.phar.php failed
+Can only mount internal paths within a phar archive, use a relative path instead of "phar://%sphar_mount.phar.php/testit1"
+Mounting of testit to %sphar_mount.php within phar %sphar_mount.phar.tar failed
===DONE===
\ No newline at end of file