cellog          Sat Sep 13 20:57:09 2008 UTC

  Added files:                 (Branch: PHP_5_3)
    /php-src/ext/phar/tests     bug46060.phpt 

  Modified files:              
    /php-src/ext/phar   util.c 
  Log:
  fix Bug #46060: addEmptyDir() breaks
  
http://cvs.php.net/viewvc.cgi/php-src/ext/phar/util.c?r1=1.55.2.33&r2=1.55.2.34&diff_format=u
Index: php-src/ext/phar/util.c
diff -u php-src/ext/phar/util.c:1.55.2.33 php-src/ext/phar/util.c:1.55.2.34
--- php-src/ext/phar/util.c:1.55.2.33   Sun Aug 31 19:46:35 2008
+++ php-src/ext/phar/util.c     Sat Sep 13 20:57:08 2008
@@ -18,7 +18,7 @@
   +----------------------------------------------------------------------+
 */
 
-/* $Id: util.c,v 1.55.2.33 2008/08/31 19:46:35 cellog Exp $ */
+/* $Id: util.c,v 1.55.2.34 2008/09/13 20:57:08 cellog Exp $ */
 
 #include "phar_internal.h"
 
@@ -785,13 +785,13 @@
        if (allow_dir == 2) {
                etemp.is_dir = 1;
                etemp.flags = etemp.old_flags = PHAR_ENT_PERM_DEF_DIR;
-               if (is_dir) {
-                       etemp.filename_len--; /* strip trailing / */
-                       path_len--;
-               }
        } else {
                etemp.flags = etemp.old_flags = PHAR_ENT_PERM_DEF_FILE;
        }
+       if (is_dir) {
+               etemp.filename_len--; /* strip trailing / */
+               path_len--;
+       }
 
        phar_add_virtual_dirs(phar, path, path_len TSRMLS_CC);
        etemp.is_modified = 1;
@@ -803,7 +803,7 @@
 
        if (phar->is_tar) {
                etemp.is_tar = phar->is_tar;
-               etemp.tar_type = TAR_FILE;
+               etemp.tar_type = etemp.is_dir ? TAR_DIR : TAR_FILE;
        }
 
        if (FAILURE == zend_hash_add(&phar->manifest, etemp.filename, path_len, 
(void*)&etemp, sizeof(phar_entry_info), (void **) &entry)) {

http://cvs.php.net/viewvc.cgi/php-src/ext/phar/tests/bug46060.phpt?view=markup&rev=1.1
Index: php-src/ext/phar/tests/bug46060.phpt
+++ php-src/ext/phar/tests/bug46060.phpt



-- 
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to