}
/* }}} */
+/**
+ * Delete aliases to phar's that got kicked out of the global table
+ */
+static int phar_tmpclose_apply(void *pDest TSRMLS_DC) /* {{{ */
+{
+ phar_entry_info *entry = (phar_entry_info *) pDest;
+
+ if (entry->fp_type != PHAR_TMP) {
+ return ZEND_HASH_APPLY_KEEP;
+ }
+ if (entry->fp && !entry->fp_refcount) {
+ php_stream_close(entry->fp);
+ entry->fp = NULL;
+ }
+ return ZEND_HASH_APPLY_KEEP;
+}
+/* }}} */
+
/**
* Filename map destructor
*/
TSRMLS_FETCH();
if (PHAR_GLOBALS->request_ends) {
+ /* first, iterate over the manifest and close all PHAR_TMP entry fp handles,
+ this prevents unnecessary unfreed stream resources */
+ zend_hash_apply(&(phar_data->manifest), phar_tmpclose_apply TSRMLS_CC);
destroy_phar_data_only(pDest);
return;
}
} catch (Exception $e) {
echo $e->getMessage(),"\n";
}
+try {
+Phar::mount($pname . '/oops', '/home/oops/../../etc/passwd:');
+} catch (Exception $e) {
+echo $e->getMessage(),"\n";
+}
+Phar::mount($pname . '/testit2', $pname . '/testit1');
+echo substr($a['testit2']->getContent(),0, 50),"\n";
?>
===DONE===
--CLEAN--
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
+Mounting of /oops to /home/oops/../../etc/passwd: within phar %sphar_mount.phar.php failed
+<?php
+$fname = dirname(__FILE__) . '/' . basename(
===DONE===
\ No newline at end of file