AC_MSG_CHECKING([for zip-based phar support])
if test "$PHP_PHAR_ZIP" != "yes"; then
AC_MSG_RESULT([yes])
- PHP_PHAR_SOURCES="$PHP_PHAR_SOURCES lib/zip_add.c lib/zip_error.c lib/zip_fclose.c \
- lib/zip_fread.c lib/zip_open.c lib/zip_source_filep.c \
- lib/zip_strerror.c lib/zip_close.c lib/zip_error_get.c \
- lib/zip_file_error_get.c lib/zip_free.c lib/zip_rename.c \
- lib/zip_source_free.c lib/zip_unchange_all.c lib/zip_delete.c \
- lib/zip_error_get_sys_type.c lib/zip_file_get_offset.c \
- lib/zip_get_name.c lib/zip_replace.c lib/zip_source_function.c \
- lib/zip_unchange.c lib/zip_dirent.c lib/zip_error_strerror.c \
- lib/zip_file_strerror.c lib/zip_get_num_files.c \
- lib/zip_set_name.c lib/zip_source_zip.c lib/zip_unchange_data.c \
- lib/zip_entry_free.c lib/zip_error_to_str.c lib/zip_fopen.c \
- lib/zip_name_locate.c lib/zip_source_buffer.c lib/zip_stat.c \
- lib/zip_entry_new.c lib/zip_err_str.c lib/zip_fopen_index.c \
- lib/zip_new.c lib/zip_source_file.c lib/zip_stat_index.c lib/zip_get_archive_comment.c \
- lib/zip_get_file_comment.c lib/zip_set_archive_comment.c lib/zip_set_file_comment.c \
- lib/zip_unchange_archive.c lib/zip_memdup.c lib/zip_stat_init.c lib/zip_add_dir.c \
- lib/zip_error_clear.c lib/zip_file_error_clear.c"
AC_DEFINE(HAVE_PHAR_ZIP,1,[ ])
- PHP_ADD_EXTENSION_DEP(phar, zip, false)
+ PHP_ADD_EXTENSION_DEP(phar, zip, true)
else
AC_MSG_RESULT([no])
fi
phar_has_gnupg = zend_hash_exists(&module_registry, "gnupg", sizeof("gnupg"));
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"));
phar_orig_compile_file = zend_compile_file;
zend_compile_file = phar_compile_file;
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
- php_info_print_table_row(2, "ZIP-based phar archives", "enabled");
+ 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)");
+ }
#else
php_info_print_table_row(2, "ZIP-based phar archives", "unavailable");
#endif
if (phar_has_zlib) {
php_info_print_table_row(2, "gzip compression", "enabled");
} else {
- php_info_print_table_row(2, "gzip compression", "disabled");
+ php_info_print_table_row(2, "gzip compression", "disabled (install ext/zlib)");
}
#else
php_info_print_table_row(2, "gzip compression", "unavailable");
PUTS("Phar based on pear/PHP_Archive, original concept by Davey Shafik.");
PUTS(!sapi_module.phpinfo_as_text?"<br />":"\n");
PUTS("Phar fully realized by Gregory Beaver and Marcus Boerger.");
+ PUTS(!sapi_module.phpinfo_as_text?"<br />":"\n");
PUTS("Portions of tar implementation Copyright (c) 2003-2007 Tim Kientzle.");
php_info_print_box_end();
*/
static zend_module_dep phar_deps[] = {
#if HAVE_PHAR_ZIP
- ZEND_MOD_REQUIRED_EX("zip", ">=", "1.8.11")
+ ZEND_MOD_OPTIONAL_EX("zip", ">=", "1.8.11")
#endif
#if HAVE_ZLIB
ZEND_MOD_OPTIONAL("zlib")
int phar_has_bz2;
int phar_has_gnupg;
int phar_has_zlib;
+int phar_has_zip;
#ifdef ZTS
# include "TSRM.h"
zend_throw_exception_ex(phar_ce_PharException, 0 TSRMLS_CC, "Cannot modify permissions for file \"%s\" in phar \"%s\", write operations are prohibited", entry_obj->ent.entry->filename, entry_obj->ent.entry->phar->fname);
return;
}
-#if HAVE_ZIP
+#if HAVE_PHAR_ZIP
if (entry_obj->ent.entry->is_zip) {
zend_throw_exception_ex(phar_ce_PharException, 0 TSRMLS_CC, "Cannot modify permissions for file \"%s\" in phar \"%s\", not supported for zip-based phars", entry_obj->ent.entry->filename, entry_obj->ent.entry->phar->fname);
return;
*error = NULL;
}
+ if (!phar_has_zip) {
+ spprintf(error, 4096, "phar zip error: cannot open zip-based phar \"%s\", ext/zip is not enabled", fname);
+ return FAILURE;
+ }
+
zip = zip_open(fname, 0, &ziperror);
if (!zip) {
if (error) {
}
return SUCCESS;
#else
- spprintf(error, 4096, "Error: Cannot open zip-based phar \"%s\"", fname);
+ spprintf(error, 4096, "phar zip error: Cannot open zip-based phar \"%s\", phar not compiled with zip enabled", fname);
return FAILURE;
#endif
}
return ret;
}
+ if (!phar_has_zip) {
+ if (error) {
+ spprintf(error, 4096, "phar zip error: phar \"%s\" cannot be created as zip-based phar, zip-based phars are disabled (enable ext/zip)", fname);
+ }
+ return FAILURE;
+ }
if (phar->is_brandnew) {
int *errorp = NULL;
phar->is_zip = 1;
return FAILURE;
#else
if (error) {
- spprintf(error, 4096, "phar zip error: phar \"%s\" cannot be created as zip-based phar, zip-based phars are disabled", fname);
+ spprintf(error, 4096, "phar zip error: phar \"%s\" cannot be created as zip-based phar, zip-based phars are disabled and cannot be enabled", fname);
}
return FAILURE;
#endif /* #if HAVE_PHAR_ZIP */