cvs: pecl /phar phar.c phar_internal.h

From: Date: Thu, 17 Jan 2008 05:52:17 +0000
Subject: cvs: pecl /phar phar.c phar_internal.h
Groups: php.pecl.cvs 
Request: Send a blank email to pecl-cvs+get-9534@lists.php.net to get a copy of this message
cellog Thu Jan 17 05:52:17 2008 UTC Modified files: /pecl/phar phar.c phar_internal.h Log: do fancy-shmancy zip dependency validation because ZEND_MOD_OPTIONAL_EX doesn't do any version validation http://cvs.php.net/viewvc.cgi/pecl/phar/phar.c?r1=1.274&r2=1.275&diff_format=u Index: pecl/phar/phar.c diff -u pecl/phar/phar.c:1.274 pecl/phar/phar.c:1.275 --- pecl/phar/phar.c:1.274 Thu Jan 17 03:59:06 2008 +++ pecl/phar/phar.c Thu Jan 17 05:52:17 2008 @@ -17,7 +17,7 @@ +----------------------------------------------------------------------+ */ -/* $Id: phar.c,v 1.274 2008/01/17 03:59:06 cellog Exp $ */ +/* $Id: phar.c,v 1.275 2008/01/17 05:52:17 cellog Exp $ */ #define PHAR_MAIN 1 #include "phar_internal.h" @@ -3191,12 +3191,24 @@ PHP_MINIT_FUNCTION(phar) /* {{{ */ { + zend_module_entry *test; + 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_has_zip = zend_hash_exists(&module_registry, "zip", sizeof("zip")); + if (SUCCESS == zend_hash_find(&module_registry, "zip", sizeof("zip"), (void **) &test)) { + if (strlen(test->version) == sizeof("1.8.11")-1 && !strncmp(test->version, "1.8.11", sizeof("1.8.11")-1)) { + phar_has_zip = 1; + } else { + phar_has_zip = 0; + } + phar_zip_ver = test->version; + } else { + phar_has_zip = 0; + phar_zip_ver = NULL; + } phar_orig_compile_file = zend_compile_file; zend_compile_file = phar_compile_file; @@ -3273,14 +3285,21 @@ php_info_print_table_header(2, "Phar: PHP Archive support", "enabled"); php_info_print_table_row(2, "Phar EXT version", PHAR_EXT_VERSION_STR); php_info_print_table_row(2, "Phar API version", PHAR_API_VERSION_STR); - php_info_print_table_row(2, "CVS revision", "$Revision: 1.274 $"); + php_info_print_table_row(2, "CVS revision", "$Revision: 1.275 $"); php_info_print_table_row(2, "Phar-based phar archives", "enabled"); php_info_print_table_row(2, "Tar-based phar archives", "enabled"); #if HAVE_PHAR_ZIP if (phar_has_zip) { php_info_print_table_row(2, "ZIP-based phar archives", "enabled"); } else { - php_info_print_table_row(2, "ZIP-based phar archives", "disabled (install pecl/zip)"); + if (phar_zip_ver) { + char *tmp; + spprintf(&tmp, 0, "disabled (pecl/zip version %s installed, we need zip >= 1.8.11)", phar_zip_ver); + php_info_print_table_row(2, "ZIP-based phar archives", tmp); + efree(tmp); + } else { + php_info_print_table_row(2, "ZIP-based phar archives", "disabled (install pecl/zip)"); + } } #else php_info_print_table_row(2, "ZIP-based phar archives", "unavailable"); @@ -3313,7 +3332,7 @@ */ static zend_module_dep phar_deps[] = { #if HAVE_PHAR_ZIP - ZEND_MOD_OPTIONAL_EX("zip", ">=", "1.8.11") + ZEND_MOD_OPTIONAL("zip") #endif ZEND_MOD_OPTIONAL("zlib") ZEND_MOD_OPTIONAL("bz2") http://cvs.php.net/viewvc.cgi/pecl/phar/phar_internal.h?r1=1.64&r2=1.65&diff_format=u Index: pecl/phar/phar_internal.h diff -u pecl/phar/phar_internal.h:1.64 pecl/phar/phar_internal.h:1.65 --- pecl/phar/phar_internal.h:1.64 Thu Jan 17 03:19:29 2008 +++ pecl/phar/phar_internal.h Thu Jan 17 05:52:17 2008 @@ -17,7 +17,7 @@ +----------------------------------------------------------------------+ */ -/* $Id: phar_internal.h,v 1.64 2008/01/17 03:19:29 cellog Exp $ */ +/* $Id: phar_internal.h,v 1.65 2008/01/17 05:52:17 cellog Exp $ */ #ifdef HAVE_CONFIG_H #include "config.h" @@ -171,6 +171,7 @@ int phar_has_bz2; int phar_has_zlib; int phar_has_zip; +char *phar_zip_ver; #ifdef ZTS # include "TSRM.h"

« previous php.pecl.cvs (#9534) next »