diff --git a/ext/phar/phar_object.c b/ext/phar/phar_object.c index 8c5bfb12cc5..3b5ae23e0d3 100755 --- a/ext/phar/phar_object.c +++ b/ext/phar/phar_object.c @@ -1959,6 +1959,11 @@ static zval *phar_convert_to_other(phar_archive_data *source, int convert, char 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)); @@ -1967,6 +1972,7 @@ static zval *phar_convert_to_other(phar_archive_data *source, int convert, char /* exception already thrown */ return NULL; } +no_copy: newentry.filename = estrndup(newentry.filename, newentry.filename_len); if (newentry.metadata) { zval *t; diff --git a/ext/phar/tests/phar_mount.phpt b/ext/phar/tests/phar_mount.phpt index 90386ffd097..4578b3a33de 100644 --- a/ext/phar/tests/phar_mount.phpt +++ b/ext/phar/tests/phar_mount.phpt @@ -6,8 +6,9 @@ Phar: Phar::mount phar.readonly=0 --FILE-- convertToExecutable(Phar::TAR); +$b->setStub('getMessage(),"\n"; +} ?> ===DONE=== --CLEAN-- - + + --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