From: Greg Beaver Date: Thu, 17 Jan 2008 03:59:07 +0000 (+0000) Subject: remove HAVE_ZIP defines just as we removed HAVE_BZ2 defines and for the same reason X-Git-Tag: RELEASE_2_0_0a1~868 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=9a59e606578889b2a763fc75c7d6d29964371a1f;p=php remove HAVE_ZIP defines just as we removed HAVE_BZ2 defines and for the same reason update outdated description of phar in config.m4 make zip extension mandatory on windows for compiling purposes --- diff --git a/ext/phar/config.m4 b/ext/phar/config.m4 index 0db01c3337..79286b5de9 100644 --- a/ext/phar/config.m4 +++ b/ext/phar/config.m4 @@ -1,7 +1,7 @@ dnl $Id$ dnl config.m4 for extension phar -PHP_ARG_ENABLE(phar, for phar support/phar zlib support, +PHP_ARG_ENABLE(phar, for phar archive support, [ --enable-phar Enable phar support]) if test "$PHP_PHAR" != "no"; then diff --git a/ext/phar/config.w32 b/ext/phar/config.w32 index 7c25c4ed47..79a4e43e75 100644 --- a/ext/phar/config.w32 +++ b/ext/phar/config.w32 @@ -2,10 +2,10 @@ // vim:ft=javascript ARG_ENABLE("phar", "enable phar support", "no"); -ARG_WITH("phar-zip", "for zip-based phar support", "no"); if (PHP_PHAR != "no") { EXTENSION("phar", "tar.c zip.c stream.c dirstream.c func_interceptors.c phar.c phar_object.c phar_path_check.c"); + ADD_EXTENSION_DEP('phar', 'zip'); if (PHP_ZIP_SHARED) { ADD_FLAG("CFLAGS_PHAR", "/D COMPILE_DL_ZIP "); } @@ -13,7 +13,6 @@ if (PHP_PHAR != "no") { ADD_FLAG("CFLAGS_PHAR", "/D COMPILE_DL_PHAR "); } if (PHP_ZIP != "no") { - ADD_EXTENSION_DEP('phar', 'zip', true); AC_DEFINE('HAVE_PHAR_ZIP', 1); } ADD_EXTENSION_DEP('phar', 'zlib', true); diff --git a/ext/phar/phar.c b/ext/phar/phar.c index a6899b09b9..00b9a7477e 100644 --- a/ext/phar/phar.c +++ b/ext/phar/phar.c @@ -1363,13 +1363,6 @@ int phar_open_file(php_stream *fp, char *fname, int fname_len, char *alias, int offset += entry.compressed_filesize; switch (entry.flags & PHAR_ENT_COMPRESSION_MASK) { case PHAR_ENT_COMPRESSED_GZ: -#if !HAVE_ZLIB - if (entry.metadata) { - zval_ptr_dtor(&entry.metadata); - } - efree(entry.filename); - MAPPHAR_FAIL("zlib extension is required for gz compressed .phar file \"%s\""); -#else if (!phar_has_zlib) { if (entry.metadata) { zval_ptr_dtor(&entry.metadata); @@ -1377,7 +1370,6 @@ int phar_open_file(php_stream *fp, char *fname, int fname_len, char *alias, int efree(entry.filename); MAPPHAR_FAIL("zlib extension is required for gz compressed .phar file \"%s\""); } -#endif break; case PHAR_ENT_COMPRESSED_BZ2: if (!phar_has_bz2) { @@ -1651,9 +1643,6 @@ static int phar_open_fp(php_stream* fp, char *fname, int fname_len, char *alias, test = '\1'; pos = buffer+tokenlen; if (!memcmp(pos, gz_magic, 3)) { -#if !HAVE_ZLIB - MAPPHAR_ALLOC_FAIL("unable to decompress gzipped phar archive \"%s\" to temporary file, zlib disabled in phar compilation") -#else char err = 0; php_stream_filter *filter; php_stream *temp; @@ -1703,7 +1692,6 @@ static int phar_open_fp(php_stream* fp, char *fname, int fname_len, char *alias, /* now, start over */ test = '\0'; -#endif continue; } else if (!memcmp(pos, bz_magic, 3)) { php_stream_filter *filter; @@ -3297,15 +3285,11 @@ PHP_MINFO_FUNCTION(phar) /* {{{ */ #else php_info_print_table_row(2, "ZIP-based phar archives", "unavailable"); #endif -#if HAVE_ZLIB if (phar_has_zlib) { php_info_print_table_row(2, "gzip compression", "enabled"); } else { php_info_print_table_row(2, "gzip compression", "disabled (install ext/zlib)"); } -#else - php_info_print_table_row(2, "gzip compression", "unavailable"); -#endif if (phar_has_bz2) { php_info_print_table_row(2, "bzip2 compression", "enabled"); } else { @@ -3331,9 +3315,7 @@ static zend_module_dep phar_deps[] = { #if HAVE_PHAR_ZIP ZEND_MOD_OPTIONAL_EX("zip", ">=", "1.8.11") #endif -#if HAVE_ZLIB ZEND_MOD_OPTIONAL("zlib") -#endif ZEND_MOD_OPTIONAL("bz2") #if HAVE_SPL ZEND_MOD_REQUIRED("spl") diff --git a/ext/phar/phar_object.c b/ext/phar/phar_object.c index 4e331fd8ce..8448ffb55d 100755 --- a/ext/phar/phar_object.c +++ b/ext/phar/phar_object.c @@ -813,15 +813,11 @@ PHP_METHOD(Phar, canCompress) switch (method) { case PHAR_ENT_COMPRESSED_GZ: -#if HAVE_ZLIB if (phar_has_zlib) { RETURN_TRUE; } else { RETURN_FALSE; } -#else - RETURN_FALSE; -#endif case PHAR_ENT_COMPRESSED_BZ2: if (phar_has_bz2) { @@ -981,11 +977,9 @@ PHP_METHOD(Phar, getSupportedCompression) { array_init(return_value); -#if HAVE_ZLIB if (phar_has_zlib) { add_next_index_stringl(return_value, "GZ", 2, 1); } -#endif if (phar_has_bz2) { add_next_index_stringl(return_value, "BZIP2", 5, 1); } @@ -1693,7 +1687,6 @@ PHP_METHOD(Phar, convertToTar) flags = PHAR_FILE_COMPRESSED_NONE; break; case PHAR_ENT_COMPRESSED_GZ: -#if HAVE_ZLIB if (!phar_has_zlib) { zend_throw_exception_ex(spl_ce_BadMethodCallException, 0 TSRMLS_CC, "Cannot compress entire archive with gzip, enable ext/zlib in php.ini"); @@ -1701,10 +1694,6 @@ PHP_METHOD(Phar, convertToTar) } flags = PHAR_FILE_COMPRESSED_GZ; break; -#else - zend_throw_exception_ex(spl_ce_BadMethodCallException, 0 TSRMLS_CC, - "Cannot compress entire archive with gzip, support unavailable"); -#endif case PHAR_ENT_COMPRESSED_BZ2: if (!phar_has_bz2) { @@ -1852,7 +1841,6 @@ PHP_METHOD(Phar, convertToPhar) flags = PHAR_FILE_COMPRESSED_NONE; break; case PHAR_ENT_COMPRESSED_GZ: -#if HAVE_ZLIB if (!phar_has_zlib) { zend_throw_exception_ex(spl_ce_BadMethodCallException, 0 TSRMLS_CC, "Cannot compress entire archive with gzip, enable ext/zlib in php.ini"); @@ -1860,10 +1848,6 @@ PHP_METHOD(Phar, convertToPhar) } flags = PHAR_FILE_COMPRESSED_GZ; break; -#else - zend_throw_exception_ex(spl_ce_BadMethodCallException, 0 TSRMLS_CC, - "Cannot compress entire archive with gzip, support unavailable"); -#endif case PHAR_ENT_COMPRESSED_BZ2: if (!phar_has_bz2) { @@ -2274,17 +2258,11 @@ static int phar_test_compression(void *pDest, void *argument TSRMLS_DC) /* {{{ * *(int *) argument = 0; } } -#if !HAVE_ZLIB - if (entry->flags & PHAR_ENT_COMPRESSED_GZ) { - *(int *) argument = 0; - } -#else if (!phar_has_zlib) { if (entry->flags & PHAR_ENT_COMPRESSED_GZ) { *(int *) argument = 0; } } -#endif return ZEND_HASH_APPLY_KEEP; } /* }}} */ @@ -2309,9 +2287,7 @@ static int pharobj_cancompress(HashTable *manifest TSRMLS_DC) /* {{{ */ */ PHP_METHOD(Phar, compressAllFilesGZ) { -#if HAVE_ZLIB char *error; -#endif PHAR_ARCHIVE_OBJECT(); if (PHAR_G(readonly)) { @@ -2319,7 +2295,6 @@ PHP_METHOD(Phar, compressAllFilesGZ) "Phar is readonly, cannot change compression"); return; } -#if HAVE_ZLIB if (!phar_has_zlib) { zend_throw_exception_ex(spl_ce_BadMethodCallException, 0 TSRMLS_CC, "Cannot compress with Gzip compression, zlib extension is not enabled"); @@ -2343,10 +2318,6 @@ PHP_METHOD(Phar, compressAllFilesGZ) zend_throw_exception_ex(spl_ce_BadMethodCallException, 0 TSRMLS_CC, error); efree(error); } -#else - zend_throw_exception_ex(spl_ce_BadMethodCallException, 0 TSRMLS_CC, - "Cannot compress with Gzip compression, zlib extension is not enabled"); -#endif } /* }}} */ @@ -3222,7 +3193,6 @@ PHP_METHOD(PharFileInfo, delMetadata) */ PHP_METHOD(PharFileInfo, setCompressedGZ) { -#if HAVE_ZLIB char *error; PHAR_ENTRY_OBJECT(); @@ -3267,10 +3237,6 @@ PHP_METHOD(PharFileInfo, setCompressedGZ) efree(error); } RETURN_TRUE; -#else - zend_throw_exception_ex(spl_ce_BadMethodCallException, 0 TSRMLS_CC, - "Cannot compress with Gzip compression, zlib extension is not enabled"); -#endif } /* }}} */ @@ -3358,19 +3324,11 @@ PHP_METHOD(PharFileInfo, setUncompressed) "Cannot compress deleted file"); return; } -#if !HAVE_ZLIB - if (entry_obj->ent.entry->flags & PHAR_ENT_COMPRESSED_GZ) { - zend_throw_exception_ex(spl_ce_BadMethodCallException, 0 TSRMLS_CC, - "Cannot uncompress Gzip-compressed file, zlib extension is not enabled"); - return; - } -#else if (!phar_has_zlib) { zend_throw_exception_ex(spl_ce_BadMethodCallException, 0 TSRMLS_CC, "Cannot uncompress Gzip-compressed file, zlib extension is not enabled"); return; } -#endif if (!phar_has_bz2) { zend_throw_exception_ex(spl_ce_BadMethodCallException, 0 TSRMLS_CC, "Cannot uncompress Bzip2-compressed file, bz2 extension is not enabled");