php_stream_close(entry->cfp);
entry->cfp = 0;
}
- if (entry->is_deleted) {
+ if (entry->is_deleted || entry->is_mounted) {
/* remove this from the new phar */
continue;
}
if (zend_hash_get_current_data(&phar->manifest, (void **)&entry) == FAILURE) {
continue;
}
- if (entry->is_deleted) {
- /* remove this from the new phar */
+ if (entry->is_deleted || entry->is_mounted) {
+ /* remove this from the new phar if deleted, ignore if mounted */
continue;
}
if (entry->is_dir) {
if (zend_hash_get_current_data(&phar->manifest, (void **)&entry) == FAILURE) {
continue;
}
- if (entry->is_deleted || entry->is_dir) {
+ if (entry->is_deleted || entry->is_dir || entry->is_mounted) {
continue;
}
if (entry->cfp) {
path_len = entry_len;
goto carry_on2;
}
+ zend_throw_exception_ex(phar_ce_PharException, 0 TSRMLS_CC, "Mounting of %s to %s failed", path, actual);
}
/* }}} */
char *fullpath, *slash;
mode_t mode;
+ if (entry->is_mounted) {
+ /* silently ignore mounted entries */
+ return SUCCESS;
+ }
len = spprintf(&fullpath, 0, "%s/%s", dest, entry->filename);
if (len >= MAXPATHLEN) {
char *tmp;
struct _phar_pass_tar_info *fp = (struct _phar_pass_tar_info *)argument;
char padding[512];
+ if (entry->is_mounted) {
+ return ZEND_HASH_APPLY_KEEP;
+ }
if (entry->is_deleted) {
- return ZEND_HASH_APPLY_REMOVE;
+ if (entry->fp_refcount <= 0) {
+ return ZEND_HASH_APPLY_REMOVE;
+ } else {
+ /* we can't delete this in-memory until it is closed */
+ return ZEND_HASH_APPLY_KEEP;
+ }
}
memset((char *) &header, 0, sizeof(header));
$a['file1.txt'] = 'hi';
$a['file2.txt'] = 'hi2';
$a['subdir/ectory/file.txt'] = 'hi3';
+$a->mount($pname . '/mount', __FILE__);
$a->addEmptyDir('one/level');
+$a->extractTo(dirname(__FILE__) . '/extract', 'mount');
$a->extractTo(dirname(__FILE__) . '/extract');
$out = array();
foreach (new RecursiveIteratorIterator(new RecursiveDirectoryIterator(dirname(__FILE__) . '/extract'), RecursiveIteratorIterator::CHILD_FIRST) as $p => $b) {
bool(false)
Invalid argument, expected a filename (string) or array of filenames
-Warning: Phar::extractTo() expects parameter 1 to be string, array given in %sphar_extract.php on line 34
+Warning: Phar::extractTo() expects parameter 1 to be string, array given in %sphar_extract.php on line %d
Invalid argument, extraction path must be non-zero length
Unable to use path "%soops" for extraction, it is a file, must be a directory
Invalid argument, array of filenames to extract contains non-string value
entry = (phar_entry_info *)data;
p = (struct _phar_zip_pass*) arg;
+ if (entry->is_mounted) {
+ return ZEND_HASH_APPLY_KEEP;
+ }
if (entry->is_deleted) {
if (entry->fp_refcount <= 0) {
return ZEND_HASH_APPLY_REMOVE;