]> granicus.if.org Git - php/commitdiff
fix several issues:
authorGreg Beaver <cellog@php.net>
Tue, 24 Jun 2008 01:11:27 +0000 (01:11 +0000)
committerGreg Beaver <cellog@php.net>
Tue, 24 Jun 2008 01:11:27 +0000 (01:11 +0000)
1) segfault in phar_buildfromdirectoryiterator8.phpt
2) tests failing because SKIPDOTS is default on 64 bit, not on 32
3) Marcus, you really need to add SKIPDOTS as a class constant, so we don't have to use 0x00001000

ext/phar/phar.phar
ext/phar/phar_object.c
ext/phar/tests/phar_buildfromiterator8.phpt
ext/phar/tests/phar_extract.phpt
ext/phar/tests/phar_extract2.phpt

index 8d0ec2fea5d5b269427c9548cbcbd1aec251d3e2..e299feb7d6b7b55ceb184c2b06e0bf361edc2a97 100755 (executable)
Binary files a/ext/phar/phar.phar and b/ext/phar/phar.phar differ
index ffd42bdb5d709395cc22a790a63b605f48e6b1ff..6e7b3e0bc48fb2d6c7e116fb0e652a0bdaff0e20 100755 (executable)
@@ -1134,7 +1134,7 @@ PHP_METHOD(Phar, __construct)
 #else
        char *fname, *alias = NULL, *error, *arch = NULL, *entry = NULL, *save_fname;
        int fname_len, alias_len = 0, arch_len, entry_len, is_data;
-       long flags = 0, format = 0;
+       long flags = SPL_FILE_DIR_SKIPDOTS, format = 0;
        phar_archive_object *phar_obj;
        phar_archive_data   *phar_data;
        zval *zobj = getThis(), arg1, arg2;
@@ -1237,15 +1237,10 @@ PHP_METHOD(Phar, __construct)
        INIT_PZVAL(&arg1);
        ZVAL_STRINGL(&arg1, fname, fname_len, 0);
 
-       if (ZEND_NUM_ARGS() > 1) {
-               INIT_PZVAL(&arg2);
-               ZVAL_LONG(&arg2, flags);
-               zend_call_method_with_2_params(&zobj, Z_OBJCE_P(zobj), 
-                       &spl_ce_RecursiveDirectoryIterator->constructor, "__construct", NULL, &arg1, &arg2);
-       } else {
-               zend_call_method_with_1_params(&zobj, Z_OBJCE_P(zobj), 
-                       &spl_ce_RecursiveDirectoryIterator->constructor, "__construct", NULL, &arg1);
-       }
+       INIT_PZVAL(&arg2);
+       ZVAL_LONG(&arg2, flags);
+       zend_call_method_with_2_params(&zobj, Z_OBJCE_P(zobj), 
+               &spl_ce_RecursiveDirectoryIterator->constructor, "__construct", NULL, &arg1, &arg2);
 
        if (!phar_data->is_persistent) {
                phar_obj->arc.archive->is_data = is_data;
@@ -1621,6 +1616,7 @@ after_open_fp:
                data->internal_file->fp = NULL;
                data->internal_file->fp_type = PHAR_UFP;
                data->internal_file->offset_abs = data->internal_file->offset = php_stream_tell(p_obj->fp);
+               data->fp = NULL;
                contents_len = php_stream_copy_to_stream(fp, p_obj->fp, PHP_STREAM_COPY_ALL);
                data->internal_file->uncompressed_filesize = data->internal_file->compressed_filesize =
                        php_stream_tell(p_obj->fp) - data->internal_file->offset;
@@ -1681,9 +1677,11 @@ PHP_METHOD(Phar, buildFromDirectory)
 
        INIT_PZVAL(&arg);
        ZVAL_STRINGL(&arg, dir, dir_len, 0);
+       INIT_PZVAL(&arg2);
+       ZVAL_LONG(&arg2, SPL_FILE_DIR_SKIPDOTS);
 
-       zend_call_method_with_1_params(&iter, spl_ce_RecursiveDirectoryIterator, 
-                       &spl_ce_RecursiveDirectoryIterator->constructor, "__construct", NULL, &arg);
+       zend_call_method_with_2_params(&iter, spl_ce_RecursiveDirectoryIterator, 
+                       &spl_ce_RecursiveDirectoryIterator->constructor, "__construct", NULL, &arg, &arg2);
 
        if (EG(exception)) {
                zval_ptr_dtor(&iter);
index d382b82ee0da57d6d50c274de021c4b53305286e..bb1b780d759b72ea1b5f2ccb0beffbc0da30187b 100644 (file)
@@ -3,7 +3,6 @@ Phar::buildFromIterator() RegexIterator(DirectoryIterator), SplFileInfo as curre
 --SKIPIF--
 <?php if (!extension_loaded("phar")) die("skip"); ?>
 --INI--
-phar.require_hash=0
 phar.readonly=0
 --FILE--
 <?php
index 82e5f8d1918e8d4624b6c05c3e49f19131f24606..851beb8f512aea3efa92cbf8a8c821c027d69c9d 100644 (file)
@@ -19,7 +19,7 @@ $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) {
+foreach (new RecursiveIteratorIterator(new RecursiveDirectoryIterator(dirname(__FILE__) . '/extract', 0x00001000), RecursiveIteratorIterator::CHILD_FIRST) as $p => $b) {
        $out[] = $p;
 }
 sort($out);
index 64b8a74588667d0bb9233ba2721da60a15aadc9a..180d6ff4a5e42f5abb2a5505e9cf1d4c3b173083 100644 (file)
@@ -23,7 +23,7 @@ $phar->extractTo(dirname(__FILE__) . '/extract', 'mount');
 $phar->extractTo(dirname(__FILE__) . '/extract');
 $out = array();
 
-foreach (new RecursiveIteratorIterator(new RecursiveDirectoryIterator(dirname(__FILE__) . '/extract'), RecursiveIteratorIterator::CHILD_FIRST) as $path => $file) {
+foreach (new RecursiveIteratorIterator(new RecursiveDirectoryIterator(dirname(__FILE__) . '/extract', 0x00001000), RecursiveIteratorIterator::CHILD_FIRST) as $path => $file) {
        $extracted[] = $path;
 }