update to 5.4.0RC7, zip extension is back, thanks to spot
This commit is contained in:
parent
1ac87eb4c1
commit
5cabf701d4
1
.gitignore
vendored
1
.gitignore
vendored
@ -2,3 +2,4 @@ php.spec~
|
|||||||
/php-5.3.7.tar.bz2
|
/php-5.3.7.tar.bz2
|
||||||
/php-5.3.8.tar.bz2
|
/php-5.3.8.tar.bz2
|
||||||
/php-5.4.0RC6.tar.bz2
|
/php-5.4.0RC6.tar.bz2
|
||||||
|
/php-5.4.0RC7.tar.bz2
|
||||||
|
523
php-5.4.0-system-libzip.patch
Normal file
523
php-5.4.0-system-libzip.patch
Normal file
@ -0,0 +1,523 @@
|
|||||||
|
diff -up php-5.4.0RC6/ext/zip/config.m4.systzip php-5.4.0RC6/ext/zip/config.m4
|
||||||
|
--- php-5.4.0RC6/ext/zip/config.m4.systzip 2008-08-08 11:47:15.000000000 +0200
|
||||||
|
+++ php-5.4.0RC6/ext/zip/config.m4 2012-01-27 16:29:51.644828525 +0100
|
||||||
|
@@ -13,88 +13,129 @@ fi
|
||||||
|
PHP_ARG_WITH(pcre-dir, pcre install prefix,
|
||||||
|
[ --with-pcre-dir ZIP: pcre install prefix], no, no)
|
||||||
|
|
||||||
|
-if test "$PHP_ZIP" != "no"; then
|
||||||
|
+PHP_ARG_WITH(libzip, libzip,
|
||||||
|
+[ --with-libzip[=DIR] ZIP: use libzip], no, no)
|
||||||
|
|
||||||
|
- if test "$PHP_ZLIB_DIR" != "no" && test "$PHP_ZLIB_DIR" != "yes"; then
|
||||||
|
- if test -f "$PHP_ZLIB_DIR/include/zlib/zlib.h"; then
|
||||||
|
- PHP_ZLIB_DIR="$PHP_ZLIB_DIR"
|
||||||
|
- PHP_ZLIB_INCDIR="$PHP_ZLIB_DIR/include/zlib"
|
||||||
|
- elif test -f "$PHP_ZLIB_DIR/include/zlib.h"; then
|
||||||
|
- PHP_ZLIB_DIR="$PHP_ZLIB_DIR"
|
||||||
|
- PHP_ZLIB_INCDIR="$PHP_ZLIB_DIR/include"
|
||||||
|
+if test "$PHP_ZIP" != "no"; then
|
||||||
|
+ if test "$PHP_LIBZIP" != "no"; then
|
||||||
|
+ dnl system libzip, depends on libzip
|
||||||
|
+ if test -r $PHP_LIBZIP/include/zip.h; then
|
||||||
|
+ LIBZIP_DIR=$PHP_LIBZIP
|
||||||
|
else
|
||||||
|
- AC_MSG_ERROR([Can not find zlib headers under "$PHP_ZLIB_DIR"])
|
||||||
|
+ AC_MSG_CHECKING(for libzip in default path)
|
||||||
|
+ for i in /usr/local /usr; do
|
||||||
|
+ if test -r $i/include/zip.h; then
|
||||||
|
+ LIBZIP_DIR=$i
|
||||||
|
+ AC_MSG_RESULT(found in $i)
|
||||||
|
+ break
|
||||||
|
+ fi
|
||||||
|
+ done
|
||||||
|
+ fi
|
||||||
|
+
|
||||||
|
+ if test -z "$LIBZIP_DIR"; then
|
||||||
|
+ AC_MSG_RESULT(not found)
|
||||||
|
+ AC_MSG_ERROR(Please reinstall the libzip distribution)
|
||||||
|
fi
|
||||||
|
+
|
||||||
|
+ dnl Could not think of a simple way to check libzip for overwrite support
|
||||||
|
+ PHP_CHECK_LIBRARY(zip, zip_open,
|
||||||
|
+ [
|
||||||
|
+ PHP_ADD_INCLUDE($LIBZIP_DIR/include)
|
||||||
|
+ PHP_ADD_LIBRARY_WITH_PATH(zip, $LIBZIP_DIR/$PHP_LIBDIR, ZIP_SHARED_LIBADD)
|
||||||
|
+ AC_DEFINE(HAVE_LIBZIP,1,[ ])
|
||||||
|
+ ], [
|
||||||
|
+ AC_MSG_ERROR(could not find usable libzip)
|
||||||
|
+ ], [
|
||||||
|
+ -L$LIBZIP_DIR/$PHP_LIBDIR
|
||||||
|
+ ])
|
||||||
|
+
|
||||||
|
+ AC_DEFINE(HAVE_ZIP,1,[ ])
|
||||||
|
+ PHP_NEW_EXTENSION(zip, php_zip.c zip_stream.c, $ext_shared)
|
||||||
|
+ PHP_SUBST(ZIP_SHARED_LIBADD)
|
||||||
|
else
|
||||||
|
- for i in /usr/local /usr; do
|
||||||
|
- if test -f "$i/include/zlib/zlib.h"; then
|
||||||
|
- PHP_ZLIB_DIR="$i"
|
||||||
|
- PHP_ZLIB_INCDIR="$i/include/zlib"
|
||||||
|
- elif test -f "$i/include/zlib.h"; then
|
||||||
|
- PHP_ZLIB_DIR="$i"
|
||||||
|
- PHP_ZLIB_INCDIR="$i/include"
|
||||||
|
+
|
||||||
|
+ dnl bundled libzip, depends on zlib
|
||||||
|
+ if test "$PHP_ZLIB_DIR" != "no" && test "$PHP_ZLIB_DIR" != "yes"; then
|
||||||
|
+ if test -f "$PHP_ZLIB_DIR/include/zlib/zlib.h"; then
|
||||||
|
+ PHP_ZLIB_DIR="$PHP_ZLIB_DIR"
|
||||||
|
+ PHP_ZLIB_INCDIR="$PHP_ZLIB_DIR/include/zlib"
|
||||||
|
+ elif test -f "$PHP_ZLIB_DIR/include/zlib.h"; then
|
||||||
|
+ PHP_ZLIB_DIR="$PHP_ZLIB_DIR"
|
||||||
|
+ PHP_ZLIB_INCDIR="$PHP_ZLIB_DIR/include"
|
||||||
|
+ else
|
||||||
|
+ AC_MSG_ERROR([Can not find zlib headers under "$PHP_ZLIB_DIR"])
|
||||||
|
fi
|
||||||
|
- done
|
||||||
|
- fi
|
||||||
|
+ else
|
||||||
|
+ for i in /usr/local /usr; do
|
||||||
|
+ if test -f "$i/include/zlib/zlib.h"; then
|
||||||
|
+ PHP_ZLIB_DIR="$i"
|
||||||
|
+ PHP_ZLIB_INCDIR="$i/include/zlib"
|
||||||
|
+ elif test -f "$i/include/zlib.h"; then
|
||||||
|
+ PHP_ZLIB_DIR="$i"
|
||||||
|
+ PHP_ZLIB_INCDIR="$i/include"
|
||||||
|
+ fi
|
||||||
|
+ done
|
||||||
|
+ fi
|
||||||
|
|
||||||
|
- dnl # zlib
|
||||||
|
- AC_MSG_CHECKING([for the location of zlib])
|
||||||
|
- if test "$PHP_ZLIB_DIR" = "no"; then
|
||||||
|
- AC_MSG_ERROR([zip support requires ZLIB. Use --with-zlib-dir=<DIR> to specify prefix where ZLIB include and library are located])
|
||||||
|
- else
|
||||||
|
- AC_MSG_RESULT([$PHP_ZLIB_DIR])
|
||||||
|
- PHP_ADD_LIBRARY_WITH_PATH(z, $PHP_ZLIB_DIR/$PHP_LIBDIR, ZIP_SHARED_LIBADD)
|
||||||
|
- PHP_ADD_INCLUDE($PHP_ZLIB_INCDIR)
|
||||||
|
- fi
|
||||||
|
+ dnl # zlib
|
||||||
|
+ AC_MSG_CHECKING([for the location of zlib])
|
||||||
|
+ if test "$PHP_ZLIB_DIR" = "no"; then
|
||||||
|
+ AC_MSG_ERROR([zip support requires ZLIB. Use --with-zlib-dir=<DIR> to specify prefix where ZLIB include and library are located])
|
||||||
|
+ else
|
||||||
|
+ AC_MSG_RESULT([$PHP_ZLIB_DIR])
|
||||||
|
+ PHP_ADD_LIBRARY_WITH_PATH(z, $PHP_ZLIB_DIR/$PHP_LIBDIR, ZIP_SHARED_LIBADD)
|
||||||
|
+ PHP_ADD_INCLUDE($PHP_ZLIB_INCDIR)
|
||||||
|
+ fi
|
||||||
|
|
||||||
|
- dnl This is PECL build, check if bundled PCRE library is used
|
||||||
|
- old_CPPFLAGS=$CPPFLAGS
|
||||||
|
- CPPFLAGS=$INCLUDES
|
||||||
|
- AC_EGREP_CPP(yes,[
|
||||||
|
+ dnl This is PECL build, check if bundled PCRE library is used
|
||||||
|
+ old_CPPFLAGS=$CPPFLAGS
|
||||||
|
+ CPPFLAGS=$INCLUDES
|
||||||
|
+ AC_EGREP_CPP(yes,[
|
||||||
|
#include <main/php_config.h>
|
||||||
|
#if defined(HAVE_BUNDLED_PCRE) && !defined(COMPILE_DL_PCRE)
|
||||||
|
yes
|
||||||
|
#endif
|
||||||
|
- ],[
|
||||||
|
- PHP_PCRE_REGEX=yes
|
||||||
|
- ],[
|
||||||
|
- AC_EGREP_CPP(yes,[
|
||||||
|
+ ],[
|
||||||
|
+ PHP_PCRE_REGEX=yes
|
||||||
|
+ ],[
|
||||||
|
+ AC_EGREP_CPP(yes,[
|
||||||
|
#include <main/php_config.h>
|
||||||
|
#if defined(HAVE_PCRE) && !defined(COMPILE_DL_PCRE)
|
||||||
|
yes
|
||||||
|
#endif
|
||||||
|
- ],[
|
||||||
|
- PHP_PCRE_REGEX=pecl
|
||||||
|
- ],[
|
||||||
|
- PHP_PCRE_REGEX=no
|
||||||
|
+ ],[
|
||||||
|
+ PHP_PCRE_REGEX=pecl
|
||||||
|
+ ],[
|
||||||
|
+ PHP_PCRE_REGEX=no
|
||||||
|
+ ])
|
||||||
|
])
|
||||||
|
- ])
|
||||||
|
- CPPFLAGS=$old_CPPFLAGS
|
||||||
|
+ CPPFLAGS=$old_CPPFLAGS
|
||||||
|
|
||||||
|
- PHP_ZIP_SOURCES="$PHP_ZIP_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_filerange_crc.c lib/zip_file_strerror.c lib/zip_get_num_files.c \
|
||||||
|
- lib/zip_get_archive_flag.c lib/zip_set_archive_flag.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_get_archive_comment.c lib/zip_get_file_comment.c \
|
||||||
|
- lib/zip_new.c lib/zip_source_file.c lib/zip_stat_index.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_ZIP,1,[ ])
|
||||||
|
- PHP_NEW_EXTENSION(zip, php_zip.c zip_stream.c $PHP_ZIP_SOURCES, $ext_shared)
|
||||||
|
- PHP_ADD_BUILD_DIR($ext_builddir/lib, 1)
|
||||||
|
- PHP_SUBST(ZIP_SHARED_LIBADD)
|
||||||
|
+ PHP_ZIP_SOURCES="$PHP_ZIP_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_filerange_crc.c lib/zip_file_strerror.c lib/zip_get_num_files.c \
|
||||||
|
+ lib/zip_get_archive_flag.c lib/zip_set_archive_flag.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_get_archive_comment.c lib/zip_get_file_comment.c \
|
||||||
|
+ lib/zip_new.c lib/zip_source_file.c lib/zip_stat_index.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_ZIP,1,[ ])
|
||||||
|
+ PHP_NEW_EXTENSION(zip, php_zip.c zip_stream.c $PHP_ZIP_SOURCES, $ext_shared)
|
||||||
|
+ PHP_ADD_BUILD_DIR($ext_builddir/lib, 1)
|
||||||
|
+ PHP_SUBST(ZIP_SHARED_LIBADD)
|
||||||
|
+ fi
|
||||||
|
|
||||||
|
dnl so we always include the known-good working hack.
|
||||||
|
PHP_ADD_MAKEFILE_FRAGMENT
|
||||||
|
diff -up php-5.4.0RC6/ext/zip/php_zip.c.systzip php-5.4.0RC6/ext/zip/php_zip.c
|
||||||
|
--- php-5.4.0RC6/ext/zip/php_zip.c.systzip 2012-01-01 14:15:04.000000000 +0100
|
||||||
|
+++ php-5.4.0RC6/ext/zip/php_zip.c 2012-01-27 16:36:31.815846485 +0100
|
||||||
|
@@ -29,8 +29,232 @@
|
||||||
|
#include "ext/standard/php_string.h"
|
||||||
|
#include "ext/pcre/php_pcre.h"
|
||||||
|
#include "php_zip.h"
|
||||||
|
+#if defined(HAVE_LIBZIP)
|
||||||
|
+#include <zip.h>
|
||||||
|
+
|
||||||
|
+/* Copied from libzip 0.10 */
|
||||||
|
+
|
||||||
|
+/* state of change of a file in zip archive */
|
||||||
|
+
|
||||||
|
+enum zip_state { ZIP_ST_UNCHANGED, ZIP_ST_DELETED, ZIP_ST_REPLACED,
|
||||||
|
+ ZIP_ST_ADDED, ZIP_ST_RENAMED };
|
||||||
|
+
|
||||||
|
+/* error source for layered sources */
|
||||||
|
+
|
||||||
|
+enum zip_les { ZIP_LES_NONE, ZIP_LES_UPPER, ZIP_LES_LOWER, ZIP_LES_INVAL };
|
||||||
|
+
|
||||||
|
+typedef zip_int64_t (*zip_source_layered_callback)(struct zip_source *, void *,
|
||||||
|
+ void *, zip_uint64_t,
|
||||||
|
+ enum zip_source_cmd);
|
||||||
|
+
|
||||||
|
+struct zip_error {
|
||||||
|
+ int zip_err; /* libzip error code (ZIP_ER_*) */
|
||||||
|
+ int sys_err; /* copy of errno (E*) or zlib error code */
|
||||||
|
+ char *str; /* string representation or NULL */
|
||||||
|
+};
|
||||||
|
+
|
||||||
|
+/* zip archive, part of API */
|
||||||
|
+
|
||||||
|
+struct zip {
|
||||||
|
+ char *zn; /* file name */
|
||||||
|
+ FILE *zp; /* file */
|
||||||
|
+ struct zip_error error; /* error information */
|
||||||
|
+
|
||||||
|
+ unsigned int flags; /* archive global flags */
|
||||||
|
+ unsigned int ch_flags; /* changed archive global flags */
|
||||||
|
+
|
||||||
|
+ char *default_password; /* password used when no other supplied */
|
||||||
|
+
|
||||||
|
+ struct zip_cdir *cdir; /* central directory */
|
||||||
|
+ char *ch_comment; /* changed archive comment */
|
||||||
|
+ int ch_comment_len; /* length of changed zip archive
|
||||||
|
+ * comment, -1 if unchanged */
|
||||||
|
+ zip_uint64_t nentry; /* number of entries */
|
||||||
|
+ zip_uint64_t nentry_alloc; /* number of entries allocated */
|
||||||
|
+ struct zip_entry *entry; /* entries */
|
||||||
|
+ int nfile; /* number of opened files within archive */
|
||||||
|
+ int nfile_alloc; /* number of files allocated */
|
||||||
|
+ struct zip_file **file; /* opened files within archive */
|
||||||
|
+};
|
||||||
|
+
|
||||||
|
+/* file in zip archive, part of API */
|
||||||
|
+
|
||||||
|
+struct zip_file {
|
||||||
|
+ struct zip *za; /* zip archive containing this file */
|
||||||
|
+ struct zip_error error; /* error information */
|
||||||
|
+ int eof;
|
||||||
|
+ struct zip_source *src; /* data source */
|
||||||
|
+};
|
||||||
|
+
|
||||||
|
+/* zip archive directory entry (central or local) */
|
||||||
|
+
|
||||||
|
+struct zip_dirent {
|
||||||
|
+ unsigned short version_madeby; /* (c) version of creator */
|
||||||
|
+ unsigned short version_needed; /* (cl) version needed to extract */
|
||||||
|
+ unsigned short bitflags; /* (cl) general purpose bit flag */
|
||||||
|
+ unsigned short comp_method; /* (cl) compression method used */
|
||||||
|
+ time_t last_mod; /* (cl) time of last modification */
|
||||||
|
+ unsigned int crc; /* (cl) CRC-32 of uncompressed data */
|
||||||
|
+ unsigned int comp_size; /* (cl) size of commpressed data */
|
||||||
|
+ unsigned int uncomp_size; /* (cl) size of uncommpressed data */
|
||||||
|
+ char *filename; /* (cl) file name (NUL-terminated) */
|
||||||
|
+ unsigned short filename_len; /* (cl) length of filename (w/o NUL) */
|
||||||
|
+ char *extrafield; /* (cl) extra field */
|
||||||
|
+ unsigned short extrafield_len; /* (cl) length of extra field */
|
||||||
|
+ char *comment; /* (c) file comment */
|
||||||
|
+ unsigned short comment_len; /* (c) length of file comment */
|
||||||
|
+ unsigned short disk_number; /* (c) disk number start */
|
||||||
|
+ unsigned short int_attrib; /* (c) internal file attributes */
|
||||||
|
+ unsigned int ext_attrib; /* (c) external file attributes */
|
||||||
|
+ unsigned int offset; /* (c) offset of local header */
|
||||||
|
+};
|
||||||
|
+
|
||||||
|
+/* zip archive central directory */
|
||||||
|
+
|
||||||
|
+struct zip_cdir {
|
||||||
|
+ struct zip_dirent *entry; /* directory entries */
|
||||||
|
+ int nentry; /* number of entries */
|
||||||
|
+
|
||||||
|
+ unsigned int size; /* size of central direcotry */
|
||||||
|
+ unsigned int offset; /* offset of central directory in file */
|
||||||
|
+ char *comment; /* zip archive comment */
|
||||||
|
+ unsigned short comment_len; /* length of zip archive comment */
|
||||||
|
+};
|
||||||
|
+
|
||||||
|
+struct zip_source {
|
||||||
|
+ struct zip_source *src;
|
||||||
|
+ union {
|
||||||
|
+ zip_source_callback f;
|
||||||
|
+ zip_source_layered_callback l;
|
||||||
|
+ } cb;
|
||||||
|
+ void *ud;
|
||||||
|
+ enum zip_les error_source;
|
||||||
|
+ int is_open;
|
||||||
|
+};
|
||||||
|
+
|
||||||
|
+/* entry in zip archive directory */
|
||||||
|
+
|
||||||
|
+struct zip_entry {
|
||||||
|
+ enum zip_state state;
|
||||||
|
+ struct zip_source *source;
|
||||||
|
+ char *ch_filename;
|
||||||
|
+ char *ch_extra;
|
||||||
|
+ int ch_extra_len;
|
||||||
|
+ char *ch_comment;
|
||||||
|
+ int ch_comment_len;
|
||||||
|
+};
|
||||||
|
+
|
||||||
|
+void _zip_dirent_finalize(struct zip_dirent *zde)
|
||||||
|
+{
|
||||||
|
+ free(zde->filename);
|
||||||
|
+ zde->filename = NULL;
|
||||||
|
+ free(zde->extrafield);
|
||||||
|
+ zde->extrafield = NULL;
|
||||||
|
+ free(zde->comment);
|
||||||
|
+ zde->comment = NULL;
|
||||||
|
+}
|
||||||
|
+
|
||||||
|
+void _zip_cdir_free(struct zip_cdir *cd)
|
||||||
|
+{
|
||||||
|
+ int i;
|
||||||
|
+
|
||||||
|
+ if (!cd)
|
||||||
|
+ return;
|
||||||
|
+
|
||||||
|
+ for (i=0; i<cd->nentry; i++)
|
||||||
|
+ _zip_dirent_finalize(cd->entry+i);
|
||||||
|
+ free(cd->comment);
|
||||||
|
+ free(cd->entry);
|
||||||
|
+ free(cd);
|
||||||
|
+}
|
||||||
|
+
|
||||||
|
+void _zip_error_fini(struct zip_error *err)
|
||||||
|
+{
|
||||||
|
+ free(err->str);
|
||||||
|
+ err->str = NULL;
|
||||||
|
+}
|
||||||
|
+
|
||||||
|
+void _zip_error_init(struct zip_error *err)
|
||||||
|
+{
|
||||||
|
+ err->zip_err = ZIP_ER_OK;
|
||||||
|
+ err->sys_err = 0;
|
||||||
|
+ err->str = NULL;
|
||||||
|
+}
|
||||||
|
+
|
||||||
|
+void _zip_unchange_data(struct zip_entry *ze)
|
||||||
|
+{
|
||||||
|
+ if (ze->source) {
|
||||||
|
+ zip_source_free(ze->source);
|
||||||
|
+ ze->source = NULL;
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
+ ze->state = ze->ch_filename ? ZIP_ST_RENAMED : ZIP_ST_UNCHANGED;
|
||||||
|
+}
|
||||||
|
+
|
||||||
|
+void _zip_entry_free(struct zip_entry *ze)
|
||||||
|
+{
|
||||||
|
+ free(ze->ch_filename);
|
||||||
|
+ ze->ch_filename = NULL;
|
||||||
|
+ free(ze->ch_extra);
|
||||||
|
+ ze->ch_extra = NULL;
|
||||||
|
+ ze->ch_extra_len = -1;
|
||||||
|
+ free(ze->ch_comment);
|
||||||
|
+ ze->ch_comment = NULL;
|
||||||
|
+ ze->ch_comment_len = -1;
|
||||||
|
+
|
||||||
|
+ _zip_unchange_data(ze);
|
||||||
|
+}
|
||||||
|
+
|
||||||
|
+void
|
||||||
|
+_zip_error_set(struct zip_error *err, int ze, int se)
|
||||||
|
+{
|
||||||
|
+ if (err) {
|
||||||
|
+ err->zip_err = ze;
|
||||||
|
+ err->sys_err = se;
|
||||||
|
+ }
|
||||||
|
+}
|
||||||
|
+
|
||||||
|
+void _zip_free(struct zip *za)
|
||||||
|
+{
|
||||||
|
+ int i;
|
||||||
|
+
|
||||||
|
+ if (za == NULL)
|
||||||
|
+ return;
|
||||||
|
+
|
||||||
|
+ if (za->zn)
|
||||||
|
+ free(za->zn);
|
||||||
|
+
|
||||||
|
+ if (za->zp)
|
||||||
|
+ fclose(za->zp);
|
||||||
|
+
|
||||||
|
+ free(za->default_password);
|
||||||
|
+ _zip_cdir_free(za->cdir);
|
||||||
|
+ free(za->ch_comment);
|
||||||
|
+
|
||||||
|
+ if (za->entry) {
|
||||||
|
+ for (i=0; i<za->nentry; i++) {
|
||||||
|
+ _zip_entry_free(za->entry+i);
|
||||||
|
+ }
|
||||||
|
+ free(za->entry);
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
+ for (i=0; i<za->nfile; i++) {
|
||||||
|
+ if (za->file[i]->error.zip_err == ZIP_ER_OK) {
|
||||||
|
+ _zip_error_set(&za->file[i]->error, ZIP_ER_ZIPCLOSED, 0);
|
||||||
|
+ za->file[i]->za = NULL;
|
||||||
|
+ }
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
+ free(za->file);
|
||||||
|
+ free(za);
|
||||||
|
+ return;
|
||||||
|
+}
|
||||||
|
+
|
||||||
|
+
|
||||||
|
+#else
|
||||||
|
#include "lib/zip.h"
|
||||||
|
#include "lib/zipint.h"
|
||||||
|
+#endif
|
||||||
|
|
||||||
|
/* zip_open is a macro for renaming libzip zipopen, so we need to use PHP_NAMED_FUNCTION */
|
||||||
|
static PHP_NAMED_FUNCTION(zif_zip_open);
|
||||||
|
@@ -1619,6 +1843,10 @@ static ZIPARCHIVE_METHOD(addEmptyDir)
|
||||||
|
}
|
||||||
|
|
||||||
|
idx = zip_stat(intern, s, 0, &sb);
|
||||||
|
+ /* We don't care about the NOENT status error here. */
|
||||||
|
+ if (intern->error.zip_err == ZIP_ER_NOENT) {
|
||||||
|
+ _zip_error_set(&intern->error, ZIP_ER_OK, 0);
|
||||||
|
+ }
|
||||||
|
if (idx >= 0) {
|
||||||
|
RETVAL_FALSE;
|
||||||
|
} else {
|
||||||
|
@@ -1841,6 +2069,10 @@ static ZIPARCHIVE_METHOD(addFromString)
|
||||||
|
}
|
||||||
|
|
||||||
|
cur_idx = zip_name_locate(intern, (const char *)name, 0);
|
||||||
|
+ /* We don't care about the NOENT status error here. */
|
||||||
|
+ if (intern->error.zip_err == ZIP_ER_NOENT) {
|
||||||
|
+ _zip_error_set(&intern->error, ZIP_ER_OK, 0);
|
||||||
|
+ }
|
||||||
|
/* TODO: fix _zip_replace */
|
||||||
|
if (cur_idx >= 0) {
|
||||||
|
if (zip_delete(intern, cur_idx) == -1) {
|
||||||
|
@@ -2863,7 +3095,11 @@ static PHP_MINFO_FUNCTION(zip)
|
||||||
|
php_info_print_table_row(2, "Zip", "enabled");
|
||||||
|
php_info_print_table_row(2, "Extension Version","$Id: php_zip.c 321634 2012-01-01 13:15:04Z felipe $");
|
||||||
|
php_info_print_table_row(2, "Zip version", PHP_ZIP_VERSION_STRING);
|
||||||
|
- php_info_print_table_row(2, "Libzip version", "0.9.0");
|
||||||
|
+#if defined(HAVE_LIBZIP)
|
||||||
|
+ php_info_print_table_row(2, "Compiled against libzip version", LIBZIP_VERSION);
|
||||||
|
+#else
|
||||||
|
+ php_info_print_table_row(2, "Bundled libzip version", "0.9.0");
|
||||||
|
+#endif
|
||||||
|
|
||||||
|
php_info_print_table_end();
|
||||||
|
}
|
||||||
|
diff -up php-5.4.0RC6/ext/zip/php_zip.h.systzip php-5.4.0RC6/ext/zip/php_zip.h
|
||||||
|
--- php-5.4.0RC6/ext/zip/php_zip.h.systzip 2012-01-01 14:15:04.000000000 +0100
|
||||||
|
+++ php-5.4.0RC6/ext/zip/php_zip.h 2012-01-27 16:29:51.646828525 +0100
|
||||||
|
@@ -28,7 +28,11 @@ extern zend_module_entry zip_module_entr
|
||||||
|
#include "TSRM.h"
|
||||||
|
#endif
|
||||||
|
|
||||||
|
+#if defined(HAVE_LIBZIP)
|
||||||
|
+#include <zip.h>
|
||||||
|
+#else
|
||||||
|
#include "lib/zip.h"
|
||||||
|
+#endif
|
||||||
|
|
||||||
|
#define PHP_ZIP_VERSION_STRING "1.9.1"
|
||||||
|
|
||||||
|
diff -up php-5.4.0RC6/ext/zip/zip_stream.c.systzip php-5.4.0RC6/ext/zip/zip_stream.c
|
||||||
|
--- php-5.4.0RC6/ext/zip/zip_stream.c.systzip 2011-02-01 15:43:52.000000000 +0100
|
||||||
|
+++ php-5.4.0RC6/ext/zip/zip_stream.c 2012-01-27 16:29:51.647828525 +0100
|
||||||
|
@@ -6,7 +6,11 @@
|
||||||
|
#if HAVE_ZIP
|
||||||
|
#ifdef ZEND_ENGINE_2
|
||||||
|
|
||||||
|
+#if defined(HAVE_LIBZIP)
|
||||||
|
+#include <zip.h>
|
||||||
|
+#else
|
||||||
|
#include "lib/zip.h"
|
||||||
|
+#endif
|
||||||
|
|
||||||
|
#include "php_streams.h"
|
||||||
|
#include "ext/standard/file.h"
|
||||||
|
diff -up php-5.4.0RC6/ext/zip/tests/bug38943.phpt.systzip php-5.4.0RC6/ext/zip/tests/bug38943.phpt
|
||||||
|
--- php-5.4.0RC6/ext/zip/tests/bug38943.phpt.systzip 2012-01-27 17:12:40.717943831 +0100
|
||||||
|
+++ php-5.4.0RC6/ext/zip/tests/bug38943.phpt 2012-01-27 17:14:53.645949787 +0100
|
||||||
|
@@ -27,7 +27,7 @@ array(1) {
|
||||||
|
[0]=>
|
||||||
|
int(1)
|
||||||
|
}
|
||||||
|
-object(myZip)#1 (%d) {
|
||||||
|
+object(myZip)#%d (%d) {
|
||||||
|
["test":"myZip":private]=>
|
||||||
|
int(0)
|
||||||
|
["testp"]=>
|
||||||
|
diff -up php-5.4.0RC6/ext/zip/tests/pecl12414.phpt.systzip php-5.4.0RC6/ext/zip/tests/pecl12414.phpt
|
||||||
|
--- php-5.4.0RC6/ext/zip/tests/pecl12414.phpt.systzip 2012-01-27 17:18:29.077959450 +0100
|
||||||
|
+++ php-5.4.0RC6/ext/zip/tests/pecl12414.phpt 2012-01-27 17:19:02.679960964 +0100
|
||||||
|
@@ -5,6 +5,8 @@ Bug #12414 ( extracting files from damag
|
||||||
|
/*$ */
|
||||||
|
if(!extension_loaded('zip')) die('skip');
|
||||||
|
?>
|
||||||
|
+--XFAIL--
|
||||||
|
+Doesn't work with system libzip (zip_readfile could not read from ...)
|
||||||
|
--FILE--
|
||||||
|
<?php
|
||||||
|
$filename = 'MYLOGOV2.GFX';
|
@ -5,6 +5,7 @@ After=syslog.target network.target
|
|||||||
[Service]
|
[Service]
|
||||||
Type=forking
|
Type=forking
|
||||||
PIDFile=/var/run/php-fpm/php-fpm.pid
|
PIDFile=/var/run/php-fpm/php-fpm.pid
|
||||||
|
EnvironmentFile=/etc/sysconfig/php-fpm
|
||||||
ExecStart=/usr/sbin/php-fpm
|
ExecStart=/usr/sbin/php-fpm
|
||||||
ExecReload=/bin/kill -USR2 $MAINPID
|
ExecReload=/bin/kill -USR2 $MAINPID
|
||||||
|
|
||||||
|
2
php-fpm.sysconfig
Normal file
2
php-fpm.sysconfig
Normal file
@ -0,0 +1,2 @@
|
|||||||
|
# Additional environment file for php-fpm
|
||||||
|
|
44
php.spec
44
php.spec
@ -9,7 +9,7 @@
|
|||||||
%global zipver 1.9.1
|
%global zipver 1.9.1
|
||||||
%global jsonver 1.2.1
|
%global jsonver 1.2.1
|
||||||
# For PHP Release Candidate version
|
# For PHP Release Candidate version
|
||||||
%global rcver RC6
|
%global rcver RC7
|
||||||
|
|
||||||
%global httpd_mmn %(cat %{_includedir}/httpd/.mmn || echo missing-httpd-devel)
|
%global httpd_mmn %(cat %{_includedir}/httpd/.mmn || echo missing-httpd-devel)
|
||||||
%global mysql_sock %(mysql_config --socket || echo /var/lib/mysql/mysql.sock)
|
%global mysql_sock %(mysql_config --socket || echo /var/lib/mysql/mysql.sock)
|
||||||
@ -33,14 +33,20 @@
|
|||||||
%global isasuffix %nil
|
%global isasuffix %nil
|
||||||
%endif
|
%endif
|
||||||
|
|
||||||
# Flip these to 1 and zip respectively to enable zip support again
|
%if 0%{?fedora} >= 17
|
||||||
%global with_zip 0
|
%global with_zip 1
|
||||||
%global zipmod %nil
|
%global with_libzip 1
|
||||||
|
%global zipmod zip
|
||||||
|
%else
|
||||||
|
%global with_zip 0
|
||||||
|
%global with_libzip 0
|
||||||
|
%global zipmod %nil
|
||||||
|
%endif
|
||||||
|
|
||||||
Summary: PHP scripting language for creating dynamic web sites
|
Summary: PHP scripting language for creating dynamic web sites
|
||||||
Name: php
|
Name: php
|
||||||
Version: 5.4.0
|
Version: 5.4.0
|
||||||
Release: 0.2.%{rcver}%{?dist}
|
Release: 0.3.%{rcver}%{?dist}
|
||||||
License: PHP
|
License: PHP
|
||||||
Group: Development/Languages
|
Group: Development/Languages
|
||||||
URL: http://www.php.net/
|
URL: http://www.php.net/
|
||||||
@ -53,6 +59,7 @@ Source4: php-fpm.conf
|
|||||||
Source5: php-fpm-www.conf
|
Source5: php-fpm-www.conf
|
||||||
Source6: php-fpm.service
|
Source6: php-fpm.service
|
||||||
Source7: php-fpm.logrotate
|
Source7: php-fpm.logrotate
|
||||||
|
Source8: php-fpm.sysconfig
|
||||||
|
|
||||||
# Build fixes
|
# Build fixes
|
||||||
Patch5: php-5.2.0-includedir.patch
|
Patch5: php-5.2.0-includedir.patch
|
||||||
@ -67,6 +74,8 @@ Patch41: php-5.4.0-easter.patch
|
|||||||
Patch42: php-5.3.1-systzdata-v7.patch
|
Patch42: php-5.3.1-systzdata-v7.patch
|
||||||
# See http://bugs.php.net/53436
|
# See http://bugs.php.net/53436
|
||||||
Patch43: php-5.4.0-phpize.patch
|
Patch43: php-5.4.0-phpize.patch
|
||||||
|
# Use system libzip instead of bundled one
|
||||||
|
Patch44: php-5.4.0-system-libzip.patch
|
||||||
|
|
||||||
# Fixes for tests
|
# Fixes for tests
|
||||||
|
|
||||||
@ -82,6 +91,9 @@ BuildRequires: pcre-devel >= 6.6
|
|||||||
BuildRequires: bzip2, perl, libtool >= 1.4.3, gcc-c++
|
BuildRequires: bzip2, perl, libtool >= 1.4.3, gcc-c++
|
||||||
BuildRequires: libtool-ltdl-devel
|
BuildRequires: libtool-ltdl-devel
|
||||||
BuildRequires: bison
|
BuildRequires: bison
|
||||||
|
%if %{with_libzip}
|
||||||
|
BuildRequires: libzip-devel >= 0.10
|
||||||
|
%endif
|
||||||
|
|
||||||
Obsoletes: php-dbg, php3, phpfi, stronghold-php, php-zts < 5.3.7
|
Obsoletes: php-dbg, php3, phpfi, stronghold-php, php-zts < 5.3.7
|
||||||
Provides: php-zts = %{version}-%{release}
|
Provides: php-zts = %{version}-%{release}
|
||||||
@ -557,6 +569,9 @@ support for using the enchant library to PHP.
|
|||||||
%patch41 -p1 -b .easter
|
%patch41 -p1 -b .easter
|
||||||
%patch42 -p1 -b .systzdata
|
%patch42 -p1 -b .systzdata
|
||||||
%patch43 -p1 -b .headers
|
%patch43 -p1 -b .headers
|
||||||
|
%if %{with_libzip}
|
||||||
|
%patch44 -p1 -b .systzip
|
||||||
|
%endif
|
||||||
|
|
||||||
# Prevent %%doc confusion over LICENSE files
|
# Prevent %%doc confusion over LICENSE files
|
||||||
cp Zend/LICENSE Zend/ZEND_LICENSE
|
cp Zend/LICENSE Zend/ZEND_LICENSE
|
||||||
@ -758,6 +773,9 @@ build --enable-force-cgi-redirect \
|
|||||||
--enable-json=shared \
|
--enable-json=shared \
|
||||||
%if %{with_zip}
|
%if %{with_zip}
|
||||||
--enable-zip=shared \
|
--enable-zip=shared \
|
||||||
|
%endif
|
||||||
|
%if %{with_libzip}
|
||||||
|
--with-libzip \
|
||||||
%endif
|
%endif
|
||||||
--without-readline \
|
--without-readline \
|
||||||
--with-libedit \
|
--with-libedit \
|
||||||
@ -858,6 +876,9 @@ build --enable-force-cgi-redirect \
|
|||||||
--enable-json=shared \
|
--enable-json=shared \
|
||||||
%if %{with_zip}
|
%if %{with_zip}
|
||||||
--enable-zip=shared \
|
--enable-zip=shared \
|
||||||
|
%endif
|
||||||
|
%if %{with_libzip}
|
||||||
|
--with-libzip \
|
||||||
%endif
|
%endif
|
||||||
--without-readline \
|
--without-readline \
|
||||||
--with-libedit \
|
--with-libedit \
|
||||||
@ -1007,8 +1028,10 @@ install -m 644 %{SOURCE6} $RPM_BUILD_ROOT%{_unitdir}/
|
|||||||
# LogRotate
|
# LogRotate
|
||||||
install -m 755 -d $RPM_BUILD_ROOT%{_sysconfdir}/logrotate.d
|
install -m 755 -d $RPM_BUILD_ROOT%{_sysconfdir}/logrotate.d
|
||||||
install -m 644 %{SOURCE7} $RPM_BUILD_ROOT%{_sysconfdir}/logrotate.d/php-fpm
|
install -m 644 %{SOURCE7} $RPM_BUILD_ROOT%{_sysconfdir}/logrotate.d/php-fpm
|
||||||
|
# Environment file
|
||||||
|
install -m 755 -d $RPM_BUILD_ROOT%{_sysconfdir}/sysconfig
|
||||||
|
install -m 644 %{SOURCE8} $RPM_BUILD_ROOT%{_sysconfdir}/sysconfig/php-fpm
|
||||||
%endif
|
%endif
|
||||||
|
|
||||||
# Fix the link
|
# Fix the link
|
||||||
(cd $RPM_BUILD_ROOT%{_bindir}; ln -sfn phar.phar phar)
|
(cd $RPM_BUILD_ROOT%{_bindir}; ln -sfn phar.phar phar)
|
||||||
|
|
||||||
@ -1142,7 +1165,7 @@ fi
|
|||||||
|
|
||||||
%files common -f files.common
|
%files common -f files.common
|
||||||
%defattr(-,root,root)
|
%defattr(-,root,root)
|
||||||
%doc CODING_STANDARDS CREDITS EXTENSIONS INSTALL LICENSE NEWS README*
|
%doc CODING_STANDARDS CREDITS EXTENSIONS LICENSE NEWS README*
|
||||||
%doc Zend/ZEND_* TSRM_LICENSE regex_COPYRIGHT
|
%doc Zend/ZEND_* TSRM_LICENSE regex_COPYRIGHT
|
||||||
%doc php.ini-*
|
%doc php.ini-*
|
||||||
%config(noreplace) %{_sysconfdir}/php.ini
|
%config(noreplace) %{_sysconfdir}/php.ini
|
||||||
@ -1174,6 +1197,7 @@ fi
|
|||||||
%config(noreplace) %{_sysconfdir}/php-fpm.conf
|
%config(noreplace) %{_sysconfdir}/php-fpm.conf
|
||||||
%config(noreplace) %{_sysconfdir}/php-fpm.d/www.conf
|
%config(noreplace) %{_sysconfdir}/php-fpm.d/www.conf
|
||||||
%config(noreplace) %{_sysconfdir}/logrotate.d/php-fpm
|
%config(noreplace) %{_sysconfdir}/logrotate.d/php-fpm
|
||||||
|
%config(noreplace) %{_sysconfdir}/sysconfig/php-fpm
|
||||||
%config(noreplace) %{_sysconfdir}/tmpfiles.d/php-fpm.conf
|
%config(noreplace) %{_sysconfdir}/tmpfiles.d/php-fpm.conf
|
||||||
%{_unitdir}/php-fpm.service
|
%{_unitdir}/php-fpm.service
|
||||||
%{_sbindir}/php-fpm
|
%{_sbindir}/php-fpm
|
||||||
@ -1233,6 +1257,12 @@ fi
|
|||||||
|
|
||||||
|
|
||||||
%changelog
|
%changelog
|
||||||
|
* Sat Feb 04 2012 Remi Collet <remi@fedoraproject.org> 5.4.0-0.3.RC7
|
||||||
|
- update to PHP 5.4.0RC7
|
||||||
|
- provides env file for php-fpm (#784770)
|
||||||
|
- add patch to use system libzip (thanks to spot)
|
||||||
|
- don't provide INSTALL file
|
||||||
|
|
||||||
* Wed Jan 25 2012 Remi Collet <remi@fedoraproject.org> 5.4.0-0.2.RC6
|
* Wed Jan 25 2012 Remi Collet <remi@fedoraproject.org> 5.4.0-0.2.RC6
|
||||||
- all binaries in /usr/bin with zts prefix
|
- all binaries in /usr/bin with zts prefix
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user