From: Greg Beaver Date: Mon, 21 Apr 2008 16:29:09 +0000 (+0000) Subject: implement opendir for mounted directories - much simpler to do than I initially thought X-Git-Tag: RELEASE_2_0_0b1~288 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=779fec227837a05961825fac15e4402a6d0327af;p=php implement opendir for mounted directories - much simpler to do than I initially thought --- diff --git a/ext/phar/dirstream.c b/ext/phar/dirstream.c index 1d372829fd..e7d2b7e1aa 100644 --- a/ext/phar/dirstream.c +++ b/ext/phar/dirstream.c @@ -361,11 +361,10 @@ php_stream *phar_wrapper_open_dir(php_stream_wrapper *wrapper, char *path, char php_url_free(resource); return NULL; } else if (entry && entry->is_dir) { - /*if (entry->is_mounted) { - external directory, TODO: construct an internal dirstream based on this actual dir's dirstream + if (entry->is_mounted) { php_url_free(resource); return php_stream_opendir(entry->tmp, options, context); - }*/ + } internal_file = estrdup(internal_file); php_url_free(resource); return phar_make_dirstream(internal_file, &phar->manifest TSRMLS_CC); diff --git a/ext/phar/phar_object.c b/ext/phar/phar_object.c index d486a2888b..acfa4903be 100755 --- a/ext/phar/phar_object.c +++ b/ext/phar/phar_object.c @@ -221,7 +221,6 @@ static int phar_file_action(phar_entry_data *phar, char *mime_type, int code, ch efree(arch); #endif zend_bailout(); - return PHAR_MIME_PHPS; case PHAR_MIME_OTHER: /* send headers, output file contents */ efree(basename); @@ -261,7 +260,6 @@ static int phar_file_action(phar_entry_data *phar, char *mime_type, int code, ch phar_entry_delref(phar TSRMLS_CC); zend_bailout(); - return PHAR_MIME_OTHER; case PHAR_MIME_PHP: if (basename) { phar_mung_server_vars(arch, entry, entry_len, basename, basename_len, ru, ru_len TSRMLS_CC); diff --git a/ext/phar/tests/mounteddir.phpt b/ext/phar/tests/mounteddir.phpt index e09705bab1..eee69da959 100644 --- a/ext/phar/tests/mounteddir.phpt +++ b/ext/phar/tests/mounteddir.phpt @@ -7,6 +7,8 @@ phar.readonly=0 --FILE-- '); include dirname(__FILE__) . '/testit/extfile.php'; include $fname; + +$a = opendir($pname . '/testit'); +$out = array(); +while (false !== ($b = readdir($a))) { + $out[] = $b; +} +sort($out); +foreach ($out as $b) { + echo "$b\n"; +} +$out = array(); +foreach (new Phar($pname . '/testit') as $b) { + $out[] = $b->getPathName(); +} +sort($out); +foreach ($out as $b) { + echo "$b\n"; +} ?> ===DONE=== --CLEAN-- @@ -41,4 +61,10 @@ include $fname; string(%d) "%sextfile.php" string(%d) "phar://%sextfile.php" string(%d) "phar://%sextfile2.php" +. +.. +extfile.php +extfile2.php +phar://%stempmanifest1.phar.php/testit%cextfile.php +phar://%stempmanifest1.phar.php/testit%cextfile2.php ===DONE=== \ No newline at end of file