From: Steph Fox Date: Fri, 25 Jan 2008 15:00:24 +0000 (+0000) Subject: Make all possible build combinations work under doze (external zip library) X-Git-Tag: RELEASE_2_0_0a1~783 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=61c3a60815015b8185c72a6fed7d78d881fcc2e7;p=php Make all possible build combinations work under doze (external zip library) --- diff --git a/ext/phar/config.w32 b/ext/phar/config.w32 index e99914a2ab..7d6bf11d34 100644 --- a/ext/phar/config.w32 +++ b/ext/phar/config.w32 @@ -4,15 +4,22 @@ ARG_ENABLE("phar", "enable 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"); + EXTENSION("phar", "dirstream.c func_interceptors.c phar.c phar_object.c phar_path_check.c stream.c tar.c zip.c"); if (PHP_PHAR_SHARED) { ADD_FLAG("CFLAGS_PHAR", "/D COMPILE_DL_PHAR "); } - if (HAVE_ZIP) { - AC_DEFINE('HAVE_PHAR_ZIP', 1); + if (PHP_ZIP_SHARED) { + if (PHP_PHAR_SHARED) { + ADD_FLAG("CFLAGS_PHAR", "/D COMPILE_DL_ZIP "); + } else { + ERROR("Phar cannot be built statically with shared Zip extension"); + } + } + if (PHP_ZIP != "no") { ADD_EXTENSION_DEP('phar', 'zip', true); + AC_DEFINE('HAVE_PHAR_ZIP', 1); } - ADD_EXTENSION_DEP('phar', 'zlib', true); ADD_EXTENSION_DEP('phar', 'bz2', true); ADD_EXTENSION_DEP('phar', 'spl', true); + ADD_EXTENSION_DEP('phar', 'zlib', true); } diff --git a/ext/phar/phar_internal.h b/ext/phar/phar_internal.h index 213125eec1..82be02c6a7 100755 --- a/ext/phar/phar_internal.h +++ b/ext/phar/phar_internal.h @@ -354,7 +354,9 @@ int phar_tar_flush(phar_archive_data *phar, char *user_stub, long len, char **er /* zip functions in zip.c */ int phar_open_zipfile(char *fname, int fname_len, char *alias, int alias_len, phar_archive_data** pphar, char **error TSRMLS_DC); int phar_open_or_create_zip(char *fname, int fname_len, char *alias, int alias_len, int options, phar_archive_data** pphar, char **error TSRMLS_DC); +#if HAVE_PHAR_ZIP int phar_zip_flush(phar_archive_data *archive, char *user_stub, long len, char **error TSRMLS_DC); +#endif #ifdef PHAR_MAIN static int phar_open_fp(php_stream* fp, char *fname, int fname_len, char *alias, int alias_len, int options, phar_archive_data** pphar, char **error TSRMLS_DC); diff --git a/ext/phar/phar_object.c b/ext/phar/phar_object.c index efa587b079..0f0c704d72 100755 --- a/ext/phar/phar_object.c +++ b/ext/phar/phar_object.c @@ -1348,7 +1348,6 @@ static void phar_convert_to_other(phar_archive_data *source, int convert, php_ui phar_archive_data phar = {0}; long offset = 0; char *error, *opened_path = NULL; - int fd, ziperror; /* set whole-archive compression from parameter */ phar.flags = flags; @@ -1359,6 +1358,8 @@ static void phar_convert_to_other(phar_archive_data *source, int convert, php_ui case 2 : phar.is_zip = 1; #if HAVE_PHAR_ZIP + int fd, ziperror; + if (!((fd = php_open_temporary_fd(NULL, "pharzip", &opened_path TSRMLS_CC)) >= 0)) { zend_throw_exception_ex(spl_ce_UnexpectedValueException, 0 TSRMLS_CC, "Cannot convert phar archive \"%s\", unable to open temporary zip archive", source->fname);