cellog          Sat May 17 20:07:38 2008 UTC

  Modified files:              
    /php-src/ext/phar   config.m4 config.w32 phar.c phar_internal.h 
                        phar_object.c zip.c 
  Log:
  enable by default statically instead of shared
  this is done by removing zlib/bz2 explicit dependencies because they are 
unnecessary
  we only ever use the stream filter, and the check for existence has
  been moved to runtime where it is after startup
  
http://cvs.php.net/viewvc.cgi/php-src/ext/phar/config.m4?r1=1.27&r2=1.28&diff_format=u
Index: php-src/ext/phar/config.m4
diff -u php-src/ext/phar/config.m4:1.27 php-src/ext/phar/config.m4:1.28
--- php-src/ext/phar/config.m4:1.27     Mon Jan 28 08:52:06 2008
+++ php-src/ext/phar/config.m4  Sat May 17 20:07:38 2008
@@ -1,4 +1,4 @@
-dnl $Id: config.m4,v 1.27 2008/01/28 08:52:06 cellog Exp $
+dnl $Id: config.m4,v 1.28 2008/05/17 20:07:38 cellog Exp $
 dnl config.m4 for extension phar
 
 PHP_ARG_ENABLE(phar, for phar archive support,
@@ -8,8 +8,6 @@
   PHP_NEW_EXTENSION(phar, util.c tar.c zip.c stream.c func_interceptors.c 
dirstream.c phar.c phar_object.c phar_path_check.c, $ext_shared)
   PHP_ADD_BUILD_DIR($ext_builddir/lib, 1)
   PHP_SUBST(PHAR_SHARED_LIBADD)
-  PHP_ADD_EXTENSION_DEP(phar, zlib, true)
-  PHP_ADD_EXTENSION_DEP(phar, bz2, true)
   PHP_ADD_EXTENSION_DEP(phar, spl, true)
   PHP_ADD_MAKEFILE_FRAGMENT
 fi
http://cvs.php.net/viewvc.cgi/php-src/ext/phar/config.w32?r1=1.27&r2=1.28&diff_format=u
Index: php-src/ext/phar/config.w32
diff -u php-src/ext/phar/config.w32:1.27 php-src/ext/phar/config.w32:1.28
--- php-src/ext/phar/config.w32:1.27    Mon Jan 28 14:39:16 2008
+++ php-src/ext/phar/config.w32 Sat May 17 20:07:38 2008
@@ -1,4 +1,4 @@
-// $Id: config.w32,v 1.27 2008/01/28 14:39:16 sfox Exp $
+// $Id: config.w32,v 1.28 2008/05/17 20:07:38 cellog Exp $
 // vim:ft=javascript
 
 ARG_ENABLE("phar", "enable phar support", "no");
@@ -8,7 +8,5 @@
        if (PHP_PHAR_SHARED) {
                ADD_FLAG("CFLAGS_PHAR", "/D COMPILE_DL_PHAR ");
        }
-       ADD_EXTENSION_DEP('phar', 'bz2', true);
        ADD_EXTENSION_DEP('phar', 'spl', true);
-       ADD_EXTENSION_DEP('phar', 'zlib', true);
 }
http://cvs.php.net/viewvc.cgi/php-src/ext/phar/phar.c?r1=1.373&r2=1.374&diff_format=u
Index: php-src/ext/phar/phar.c
diff -u php-src/ext/phar/phar.c:1.373 php-src/ext/phar/phar.c:1.374
--- php-src/ext/phar/phar.c:1.373       Wed May 14 21:27:31 2008
+++ php-src/ext/phar/phar.c     Sat May 17 20:07:38 2008
@@ -17,7 +17,7 @@
   +----------------------------------------------------------------------+
 */
 
-/* $Id: phar.c,v 1.373 2008/05/14 21:27:31 sfox Exp $ */
+/* $Id: phar.c,v 1.374 2008/05/17 20:07:38 cellog Exp $ */
 
 #define PHAR_MAIN 1
 #include "phar_internal.h"
@@ -25,8 +25,6 @@
 #include "func_interceptors.h"
 
 ZEND_DECLARE_MODULE_GLOBALS(phar)
-int phar_has_bz2;
-int phar_has_zlib;
 #if PHP_VERSION_ID >= 50300
 char *(*phar_save_resolve_path)(const char *filename, int filename_len 
TSRMLS_DC);
 #endif
@@ -886,7 +884,7 @@
                offset += entry.compressed_filesize;
                switch (entry.flags & PHAR_ENT_COMPRESSION_MASK) {
                case PHAR_ENT_COMPRESSED_GZ:
-                       if (!phar_has_zlib) {
+                       if (!PHAR_G(has_zlib)) {
                                if (entry.metadata) {
                                        zval_ptr_dtor(&entry.metadata);
                                }
@@ -895,7 +893,7 @@
                        }
                        break;
                case PHAR_ENT_COMPRESSED_BZ2:
-                       if (!phar_has_bz2) {
+                       if (!PHAR_G(has_bz2)) {
                                if (entry.metadata) {
                                        zval_ptr_dtor(&entry.metadata);
                                }
@@ -1307,7 +1305,7 @@
                                /* to properly decompress, we have to tell zlib 
to look for a zlib or gzip header */
                                zval filterparams;
 
-                               if (!phar_has_zlib) {
+                               if (!PHAR_G(has_zlib)) {
                                        MAPPHAR_ALLOC_FAIL("unable to 
decompress gzipped phar archive \"%s\" to temporary file, enable zlib extension 
in php.ini")
                                }
                                array_init(&filterparams);
@@ -1358,7 +1356,7 @@
                                php_stream_filter *filter;
                                php_stream *temp;
 
-                               if (!phar_has_bz2) {
+                               if (!PHAR_G(has_bz2)) {
                                        MAPPHAR_ALLOC_FAIL("unable to 
decompress bzipped phar archive \"%s\" to temporary file, enable bz2 extension 
in php.ini")
                                }
                                /* entire file is bzip-compressed, uncompress 
to temporary file */
@@ -2943,8 +2941,6 @@
        ZEND_INIT_MODULE_GLOBALS(phar, php_phar_init_globals_module, NULL);
        REGISTER_INI_ENTRIES();
 
-       phar_has_bz2 = zend_hash_exists(&module_registry, "bz2", sizeof("bz2"));
-       phar_has_zlib = zend_hash_exists(&module_registry, "zlib", 
sizeof("zlib"));
        phar_orig_compile_file = zend_compile_file;
        zend_compile_file = phar_compile_file;
 
@@ -2981,6 +2977,8 @@
 {
        if (!PHAR_GLOBALS->request_init)
        {
+               PHAR_G(has_bz2) = zend_hash_exists(&module_registry, "bz2", 
sizeof("bz2"));
+               PHAR_G(has_zlib) = zend_hash_exists(&module_registry, "zlib", 
sizeof("zlib"));
                PHAR_GLOBALS->request_init = 1;
                PHAR_GLOBALS->request_ends = 0;
                PHAR_GLOBALS->request_done = 0;
@@ -3022,20 +3020,21 @@
 
 PHP_MINFO_FUNCTION(phar) /* {{{ */
 {
+       phar_request_initialize(TSRMLS_C);
        php_info_print_table_start();
        php_info_print_table_header(2, "Phar: PHP Archive support", "enabled");
        php_info_print_table_row(2, "Phar EXT version", PHP_PHAR_VERSION);
        php_info_print_table_row(2, "Phar API version", PHP_PHAR_API_VERSION);
-       php_info_print_table_row(2, "CVS revision", "$Revision: 1.373 $");
+       php_info_print_table_row(2, "CVS revision", "$Revision: 1.374 $");
        php_info_print_table_row(2, "Phar-based phar archives", "enabled");
        php_info_print_table_row(2, "Tar-based phar archives", "enabled");
        php_info_print_table_row(2, "ZIP-based phar archives", "enabled");
-       if (phar_has_zlib) {
+       if (PHAR_G(has_zlib)) {
                php_info_print_table_row(2, "gzip compression", "enabled");
        } else {
                php_info_print_table_row(2, "gzip compression", "disabled 
(install ext/zlib)");
        }
-       if (phar_has_bz2) {
+       if (PHAR_G(has_bz2)) {
                php_info_print_table_row(2, "bzip2 compression", "enabled");
        } else {
                php_info_print_table_row(2, "bzip2 compression", "disabled 
(install pecl/bz2)");
@@ -3058,8 +3057,6 @@
  */
 static zend_module_dep phar_deps[] = {
        ZEND_MOD_OPTIONAL("apc")
-       ZEND_MOD_OPTIONAL("zlib")
-       ZEND_MOD_OPTIONAL("bz2")
 #if HAVE_SPL
        ZEND_MOD_REQUIRED("spl")
 #endif
http://cvs.php.net/viewvc.cgi/php-src/ext/phar/phar_internal.h?r1=1.111&r2=1.112&diff_format=u
Index: php-src/ext/phar/phar_internal.h
diff -u php-src/ext/phar/phar_internal.h:1.111 
php-src/ext/phar/phar_internal.h:1.112
--- php-src/ext/phar/phar_internal.h:1.111      Thu May 15 16:09:21 2008
+++ php-src/ext/phar/phar_internal.h    Sat May 17 20:07:38 2008
@@ -17,7 +17,7 @@
   +----------------------------------------------------------------------+
 */
 
-/* $Id: phar_internal.h,v 1.111 2008/05/15 16:09:21 cellog Exp $ */
+/* $Id: phar_internal.h,v 1.112 2008/05/17 20:07:38 cellog Exp $ */
 
 #ifdef HAVE_CONFIG_H
 #include "config.h"
@@ -137,6 +137,8 @@
        HashTable   phar_alias_map;
        HashTable   phar_SERVER_mung_list;
        int         readonly;
+       int         has_zlib;
+       int         has_bz2;
        zend_bool   readonly_orig;
        zend_bool   require_hash_orig;
        int         request_init;
@@ -347,8 +349,6 @@
 #endif
 
 #ifndef PHAR_MAIN
-extern int phar_has_bz2;
-extern int phar_has_zlib;
 # if PHP_VERSION_ID >= 50300
 extern char *(*phar_save_resolve_path)(const char *filename, int filename_len 
TSRMLS_DC);
 # endif
http://cvs.php.net/viewvc.cgi/php-src/ext/phar/phar_object.c?r1=1.270&r2=1.271&diff_format=u
Index: php-src/ext/phar/phar_object.c
diff -u php-src/ext/phar/phar_object.c:1.270 
php-src/ext/phar/phar_object.c:1.271
--- php-src/ext/phar/phar_object.c:1.270        Thu May 15 23:46:32 2008
+++ php-src/ext/phar/phar_object.c      Sat May 17 20:07:38 2008
@@ -17,7 +17,7 @@
   +----------------------------------------------------------------------+
 */
 
-/* $Id: phar_object.c,v 1.270 2008/05/15 23:46:32 cellog Exp $ */
+/* $Id: phar_object.c,v 1.271 2008/05/17 20:07:38 cellog Exp $ */
 
 #include "phar_internal.h"
 #include "func_interceptors.h"
@@ -1012,23 +1012,24 @@
                return;
        }
 
+       phar_request_initialize(TSRMLS_C);
        switch (method) {
        case PHAR_ENT_COMPRESSED_GZ:
-               if (phar_has_zlib) {
+               if (PHAR_G(has_zlib)) {
                        RETURN_TRUE;
                } else {
                        RETURN_FALSE;
                }
 
        case PHAR_ENT_COMPRESSED_BZ2:
-               if (phar_has_bz2) {
+               if (PHAR_G(has_bz2)) {
                        RETURN_TRUE;
                } else {
                        RETURN_FALSE;
                }
 
        default:
-               if (phar_has_zlib || phar_has_bz2) {
+               if (PHAR_G(has_zlib) || PHAR_G(has_bz2)) {
                        RETURN_TRUE;
                } else {
                        RETURN_FALSE;
@@ -1227,10 +1228,11 @@
 {
        array_init(return_value);
 
-       if (phar_has_zlib) {
+       phar_request_initialize(TSRMLS_C);
+       if (PHAR_G(has_zlib)) {
                add_next_index_stringl(return_value, "GZ", 2, 1);
        }
-       if (phar_has_bz2) {
+       if (PHAR_G(has_bz2)) {
                add_next_index_stringl(return_value, "BZIP2", 5, 1);
        }
 }
@@ -2108,7 +2110,7 @@
                                        "Cannot compress entire archive with 
gzip, zip archives do not support whole-archive compression");
                                return;
                        }
-                       if (!phar_has_zlib) {
+                       if (!PHAR_G(has_zlib)) {
                                
zend_throw_exception_ex(spl_ce_BadMethodCallException, 0 TSRMLS_CC,
                                        "Cannot compress entire archive with 
gzip, enable ext/zlib in php.ini");
                                return;
@@ -2122,7 +2124,7 @@
                                        "Cannot compress entire archive with 
bz2, zip archives do not support whole-archive compression");
                                return;
                        }
-                       if (!phar_has_bz2) {
+                       if (!PHAR_G(has_bz2)) {
                                
zend_throw_exception_ex(spl_ce_BadMethodCallException, 0 TSRMLS_CC,
                                        "Cannot compress entire archive with 
bz2, enable ext/bz2 in php.ini");
                                return;
@@ -2206,7 +2208,7 @@
                                        "Cannot compress entire archive with 
gzip, zip archives do not support whole-archive compression");
                                return;
                        }
-                       if (!phar_has_zlib) {
+                       if (!PHAR_G(has_zlib)) {
                                
zend_throw_exception_ex(spl_ce_BadMethodCallException, 0 TSRMLS_CC,
                                        "Cannot compress entire archive with 
gzip, enable ext/zlib in php.ini");
                                return;
@@ -2220,7 +2222,7 @@
                                        "Cannot compress entire archive with 
bz2, zip archives do not support whole-archive compression");
                                return;
                        }
-                       if (!phar_has_bz2) {
+                       if (!PHAR_G(has_bz2)) {
                                
zend_throw_exception_ex(spl_ce_BadMethodCallException, 0 TSRMLS_CC,
                                        "Cannot compress entire archive with 
bz2, enable ext/bz2 in php.ini");
                                return;
@@ -2746,12 +2748,12 @@
        if (entry->is_deleted) {
                return ZEND_HASH_APPLY_KEEP;
        }
-       if (!phar_has_bz2) {
+       if (!PHAR_G(has_bz2)) {
                if (entry->flags & PHAR_ENT_COMPRESSED_BZ2) {
                        *(int *) argument = 0;
                }
        }
-       if (!phar_has_zlib) {
+       if (!PHAR_G(has_zlib)) {
                if (entry->flags & PHAR_ENT_COMPRESSED_GZ) {
                        *(int *) argument = 0;
                }
@@ -2810,7 +2812,7 @@
                        flags = PHAR_FILE_COMPRESSED_NONE;
                        break;
                case PHAR_ENT_COMPRESSED_GZ:
-                       if (!phar_has_zlib) {
+                       if (!PHAR_G(has_zlib)) {
                                
zend_throw_exception_ex(spl_ce_BadMethodCallException, 0 TSRMLS_CC,
                                        "Cannot compress entire archive with 
gzip, enable ext/zlib in php.ini");
                                return;
@@ -2819,7 +2821,7 @@
                        break;
        
                case PHAR_ENT_COMPRESSED_BZ2:
-                       if (!phar_has_bz2) {
+                       if (!PHAR_G(has_bz2)) {
                                
zend_throw_exception_ex(spl_ce_BadMethodCallException, 0 TSRMLS_CC,
                                        "Cannot compress entire archive with 
bz2, enable ext/bz2 in php.ini");
                                return;
@@ -2908,7 +2910,7 @@
 
        switch (method) {
                case PHAR_ENT_COMPRESSED_GZ:
-                       if (!phar_has_zlib) {
+                       if (!PHAR_G(has_zlib)) {
                                
zend_throw_exception_ex(spl_ce_BadMethodCallException, 0 TSRMLS_CC,
                                        "Cannot compress files within archive 
with gzip, enable ext/zlib in php.ini");
                                return;
@@ -2917,7 +2919,7 @@
                        break;
 
                case PHAR_ENT_COMPRESSED_BZ2:
-                       if (!phar_has_bz2) {
+                       if (!PHAR_G(has_bz2)) {
                                
zend_throw_exception_ex(spl_ce_BadMethodCallException, 0 TSRMLS_CC,
                                        "Cannot compress files within archive 
with bz2, enable ext/bz2 in php.ini");
                                return;
@@ -4256,7 +4258,7 @@
                                return;
                        }
                        if ((entry_obj->ent.entry->flags & 
PHAR_ENT_COMPRESSED_BZ2) != 0) {
-                               if (!phar_has_bz2) {
+                               if (!PHAR_G(has_bz2)) {
                                        
zend_throw_exception_ex(spl_ce_BadMethodCallException, 0 TSRMLS_CC,
                                                "Cannot compress with gzip 
compression, file is already compressed with bzip2 compression and bz2 
extension is not enabled, cannot decompress");
                                        return;
@@ -4269,7 +4271,7 @@
                                        return;
                                }
                        }
-                       if (!phar_has_zlib) {
+                       if (!PHAR_G(has_zlib)) {
                                
zend_throw_exception_ex(spl_ce_BadMethodCallException, 0 TSRMLS_CC,
                                        "Cannot compress with gzip compression, 
zlib extension is not enabled");
                                return;
@@ -4284,7 +4286,7 @@
                                return;
                        }
                        if ((entry_obj->ent.entry->flags & 
PHAR_ENT_COMPRESSED_GZ) != 0) {
-                               if (!phar_has_zlib) {
+                               if (!PHAR_G(has_zlib)) {
                                        
zend_throw_exception_ex(spl_ce_BadMethodCallException, 0 TSRMLS_CC,
                                                "Cannot compress with bzip2 
compression, file is already compressed with gzip compression and zlib 
extension is not enabled, cannot decompress");
                                        return;
@@ -4297,7 +4299,7 @@
                                        return;
                                }
                        }
-                       if (!phar_has_bz2) {
+                       if (!PHAR_G(has_bz2)) {
                                
zend_throw_exception_ex(spl_ce_BadMethodCallException, 0 TSRMLS_CC,
                                        "Cannot compress with bzip2 
compression, bz2 extension is not enabled");
                                return;
@@ -4350,12 +4352,12 @@
                        "Cannot compress deleted file");
                return;
        }
-       if ((entry_obj->ent.entry->flags & PHAR_ENT_COMPRESSED_GZ) != 0 && 
!phar_has_zlib) {
+       if ((entry_obj->ent.entry->flags & PHAR_ENT_COMPRESSED_GZ) != 0 && 
!PHAR_G(has_zlib)) {
                zend_throw_exception_ex(spl_ce_BadMethodCallException, 0 
TSRMLS_CC,
                        "Cannot decompress Gzip-compressed file, zlib extension 
is not enabled");
                return;
        }
-       if ((entry_obj->ent.entry->flags & PHAR_ENT_COMPRESSED_BZ2) != 0 && 
!phar_has_bz2) {
+       if ((entry_obj->ent.entry->flags & PHAR_ENT_COMPRESSED_BZ2) != 0 && 
!PHAR_G(has_bz2)) {
                zend_throw_exception_ex(spl_ce_BadMethodCallException, 0 
TSRMLS_CC,
                        "Cannot decompress Bzip2-compressed file, bz2 extension 
is not enabled");
                return;
http://cvs.php.net/viewvc.cgi/php-src/ext/phar/zip.c?r1=1.47&r2=1.48&diff_format=u
Index: php-src/ext/phar/zip.c
diff -u php-src/ext/phar/zip.c:1.47 php-src/ext/phar/zip.c:1.48
--- php-src/ext/phar/zip.c:1.47 Mon May 12 20:42:06 2008
+++ php-src/ext/phar/zip.c      Sat May 17 20:07:38 2008
@@ -326,14 +326,14 @@
                                break;
                        case PHAR_ZIP_COMP_DEFLATE :
                                entry.flags |= PHAR_ENT_COMPRESSED_GZ;
-                               if (!phar_has_zlib) {
+                               if (!PHAR_G(has_zlib)) {
                                        efree(entry.filename);
                                        PHAR_ZIP_FAIL("zlib extension is 
required");
                                }
                                break;
                        case PHAR_ZIP_COMP_BZIP2 :
                                entry.flags |= PHAR_ENT_COMPRESSED_BZ2;
-                               if (!phar_has_bz2) {
+                               if (!PHAR_G(has_bz2)) {
                                        efree(entry.filename);
                                        PHAR_ZIP_FAIL("bzip2 extension is 
required");
                                }

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

Reply via email to