2067da
diff -up php-5.4.15/ext/zip/config.m4.systzip php-5.4.15/ext/zip/config.m4
2067da
--- php-5.4.15/ext/zip/config.m4.systzip	2013-05-08 07:41:20.000000000 +0200
2067da
+++ php-5.4.15/ext/zip/config.m4	2013-05-09 06:46:26.084673644 +0200
2067da
@@ -13,65 +13,116 @@ fi
2067da
 PHP_ARG_WITH(pcre-dir, pcre install prefix,
2067da
 [  --with-pcre-dir           ZIP: pcre install prefix], no, no)
2067da
 
2067da
+PHP_ARG_WITH(libzip, libzip,
2067da
+[ --with-libzip[=DIR]        ZIP: use libzip], no, no)
2067da
+
2067da
 if test "$PHP_ZIP" != "no"; then
2067da
+  if test "$PHP_LIBZIP" != "no"; then
2067da
+
2067da
+    AC_PATH_PROG(PKG_CONFIG, pkg-config, no)
2067da
+
2067da
+    dnl system libzip, depends on libzip
2067da
+    AC_MSG_CHECKING(for libzip)
2067da
+    if test -r $PHP_LIBZIP/include/zip.h; then
2067da
+      LIBZIP_CFLAGS="-I$PHP_LIBZIP/include"
2067da
+      LIBZIP_LIBDIR="$PHP_LIBZIP/$PHP_LIBDIR"
2067da
+      AC_MSG_RESULT(from option: found in $PHP_LIBZIP)
2067da
+
2067da
+    elif test -x "$PKG_CONFIG" && $PKG_CONFIG --exists libzip; then
2067da
+      LIBZIP_CFLAGS=`$PKG_CONFIG libzip --cflags`
2067da
+      LIBZIP_LIBDIR=`$PKG_CONFIG libzip --variable=libdir`
2067da
+      AC_MSG_RESULT(from pkgconfig: found in $LIBZIP_LIBDIR)
2067da
 
2067da
-  if test "$PHP_ZLIB_DIR" != "no" && test "$PHP_ZLIB_DIR" != "yes"; then
2067da
-    if test -f "$PHP_ZLIB_DIR/include/zlib/zlib.h"; then
2067da
-      PHP_ZLIB_DIR="$PHP_ZLIB_DIR"
2067da
-      PHP_ZLIB_INCDIR="$PHP_ZLIB_DIR/include/zlib"
2067da
-    elif test -f "$PHP_ZLIB_DIR/include/zlib.h"; then
2067da
-      PHP_ZLIB_DIR="$PHP_ZLIB_DIR"
2067da
-      PHP_ZLIB_INCDIR="$PHP_ZLIB_DIR/include"
2067da
     else
2067da
-      AC_MSG_ERROR([Can not find zlib headers under "$PHP_ZLIB_DIR"])
2067da
+      for i in /usr/local /usr; do
2067da
+        if test -r $i/include/zip.h; then
2067da
+          LIBZIP_CFLAGS="-I$i/include"
2067da
+          LIBZIP_LIBDIR="$i/$PHP_LIBDIR"
2067da
+          AC_MSG_RESULT(in default path: found in $i)
2067da
+          break
2067da
+        fi
2067da
+      done
2067da
     fi
2067da
+
2067da
+    if test -z "$LIBZIP_LIBDIR"; then
2067da
+      AC_MSG_RESULT(not found)
2067da
+      AC_MSG_ERROR(Please reinstall the libzip distribution)
2067da
+    fi
2067da
+
2067da
+    dnl Could not think of a simple way to check libzip for overwrite support
2067da
+    PHP_CHECK_LIBRARY(zip, zip_open,
2067da
+    [
2067da
+      PHP_ADD_LIBRARY_WITH_PATH(zip, $LIBZIP_LIBDIR, ZIP_SHARED_LIBADD)
2067da
+      AC_DEFINE(HAVE_LIBZIP,1,[ ])
2067da
+    ], [
2067da
+      AC_MSG_ERROR(could not find usable libzip)
2067da
+    ], [
2067da
+      -L$LIBZIP_LIBDIR
2067da
+    ])
2067da
+
2067da
+    AC_DEFINE(HAVE_ZIP,1,[ ]) 
2067da
+    PHP_NEW_EXTENSION(zip, php_zip.c zip_stream.c, $ext_shared,, $LIBZIP_CFLAGS)
2067da
+    PHP_SUBST(ZIP_SHARED_LIBADD)
2067da
   else
2067da
-    for i in /usr/local /usr; do
2067da
-      if test -f "$i/include/zlib/zlib.h"; then
2067da
-        PHP_ZLIB_DIR="$i"
2067da
-        PHP_ZLIB_INCDIR="$i/include/zlib"
2067da
-      elif test -f "$i/include/zlib.h"; then
2067da
-        PHP_ZLIB_DIR="$i"
2067da
-        PHP_ZLIB_INCDIR="$i/include"
2067da
+
2067da
+  dnl bundled libzip, depends on zlib
2067da
+    if test "$PHP_ZLIB_DIR" != "no" && test "$PHP_ZLIB_DIR" != "yes"; then
2067da
+      if test -f "$PHP_ZLIB_DIR/include/zlib/zlib.h"; then
2067da
+        PHP_ZLIB_DIR="$PHP_ZLIB_DIR"
2067da
+        PHP_ZLIB_INCDIR="$PHP_ZLIB_DIR/include/zlib"
2067da
+      elif test -f "$PHP_ZLIB_DIR/include/zlib.h"; then
2067da
+        PHP_ZLIB_DIR="$PHP_ZLIB_DIR"
2067da
+        PHP_ZLIB_INCDIR="$PHP_ZLIB_DIR/include"
2067da
+      else
2067da
+        AC_MSG_ERROR([Can not find zlib headers under "$PHP_ZLIB_DIR"])
2067da
       fi
2067da
-    done
2067da
-  fi
2067da
+    else
2067da
+      for i in /usr/local /usr; do
2067da
+        if test -f "$i/include/zlib/zlib.h"; then
2067da
+          PHP_ZLIB_DIR="$i"
2067da
+          PHP_ZLIB_INCDIR="$i/include/zlib"
2067da
+        elif test -f "$i/include/zlib.h"; then
2067da
+          PHP_ZLIB_DIR="$i"
2067da
+          PHP_ZLIB_INCDIR="$i/include"
2067da
+        fi
2067da
+      done
2067da
+    fi
2067da
 
2067da
-  dnl # zlib
2067da
-  AC_MSG_CHECKING([for the location of zlib])
2067da
-  if test "$PHP_ZLIB_DIR" = "no"; then
2067da
-    AC_MSG_ERROR([zip support requires ZLIB. Use --with-zlib-dir=<DIR> to specify prefix where ZLIB include and library are located])
2067da
-  else
2067da
-    AC_MSG_RESULT([$PHP_ZLIB_DIR])
2067da
-    PHP_ADD_LIBRARY_WITH_PATH(z, $PHP_ZLIB_DIR/$PHP_LIBDIR, ZIP_SHARED_LIBADD)
2067da
-    PHP_ADD_INCLUDE($PHP_ZLIB_INCDIR)
2067da
-  fi
2067da
+    dnl # zlib
2067da
+    AC_MSG_CHECKING([for the location of zlib])
2067da
+    if test "$PHP_ZLIB_DIR" = "no"; then
2067da
+      AC_MSG_ERROR([zip support requires ZLIB. Use --with-zlib-dir=<DIR> to specify prefix where ZLIB include and library are located])
2067da
+    else
2067da
+      AC_MSG_RESULT([$PHP_ZLIB_DIR])
2067da
+      PHP_ADD_LIBRARY_WITH_PATH(z, $PHP_ZLIB_DIR/$PHP_LIBDIR, ZIP_SHARED_LIBADD)
2067da
+      PHP_ADD_INCLUDE($PHP_ZLIB_INCDIR)
2067da
+    fi
2067da
 
2067da
-  dnl This is PECL build, check if bundled PCRE library is used
2067da
-  old_CPPFLAGS=$CPPFLAGS
2067da
-  CPPFLAGS=$INCLUDES
2067da
-  AC_EGREP_CPP(yes,[
2067da
+    dnl This is PECL build, check if bundled PCRE library is used
2067da
+    old_CPPFLAGS=$CPPFLAGS
2067da
+    CPPFLAGS=$INCLUDES
2067da
+    AC_EGREP_CPP(yes,[
2067da
 #include <main/php_config.h>
2067da
 #if defined(HAVE_BUNDLED_PCRE) && !defined(COMPILE_DL_PCRE)
2067da
 yes
2067da
 #endif
2067da
-  ],[
2067da
-    PHP_PCRE_REGEX=yes
2067da
-  ],[
2067da
-    AC_EGREP_CPP(yes,[
2067da
+    ],[
2067da
+      PHP_PCRE_REGEX=yes
2067da
+    ],[
2067da
+      AC_EGREP_CPP(yes,[
2067da
 #include <main/php_config.h>
2067da
 #if defined(HAVE_PCRE) && !defined(COMPILE_DL_PCRE)
2067da
 yes
2067da
 #endif
2067da
-    ],[
2067da
-      PHP_PCRE_REGEX=pecl
2067da
-    ],[
2067da
-      PHP_PCRE_REGEX=no
2067da
+      ],[
2067da
+        PHP_PCRE_REGEX=pecl
2067da
+      ],[
2067da
+        PHP_PCRE_REGEX=no
2067da
+      ])
2067da
     ])
2067da
-  ])
2067da
-  CPPFLAGS=$old_CPPFLAGS
2067da
+    CPPFLAGS=$old_CPPFLAGS
2067da
 
2067da
-  PHP_ZIP_SOURCES="$PHP_ZIP_SOURCES lib/zip_add.c lib/zip_error.c lib/zip_fclose.c \
2067da
+    PHP_ZIP_SOURCES="$PHP_ZIP_SOURCES lib/zip_add.c lib/zip_error.c lib/zip_fclose.c \
2067da
                          lib/zip_fread.c lib/zip_open.c lib/zip_source_filep.c  \
2067da
                          lib/zip_strerror.c lib/zip_close.c lib/zip_error_get.c \
2067da
                          lib/zip_file_error_get.c lib/zip_free.c lib/zip_rename.c \
2067da
@@ -98,10 +149,11 @@ yes
2067da
 						 lib/zip_source_open.c lib/zip_source_pkware.c lib/zip_source_pop.c \
2067da
 						 lib/zip_source_read.c lib/zip_source_stat.c"
2067da
 
2067da
-  AC_DEFINE(HAVE_ZIP,1,[ ])
2067da
-  PHP_NEW_EXTENSION(zip, php_zip.c zip_stream.c $PHP_ZIP_SOURCES, $ext_shared)
2067da
-  PHP_ADD_BUILD_DIR($ext_builddir/lib, 1)
2067da
-  PHP_SUBST(ZIP_SHARED_LIBADD)
2067da
+    AC_DEFINE(HAVE_ZIP,1,[ ])
2067da
+    PHP_NEW_EXTENSION(zip, php_zip.c zip_stream.c $PHP_ZIP_SOURCES, $ext_shared)
2067da
+    PHP_ADD_BUILD_DIR($ext_builddir/lib, 1)
2067da
+    PHP_SUBST(ZIP_SHARED_LIBADD)
2067da
+  fi
2067da
 
2067da
   dnl so we always include the known-good working hack.
2067da
   PHP_ADD_MAKEFILE_FRAGMENT
2067da
diff -up php-5.4.15/ext/zip/php_zip.c.systzip php-5.4.15/ext/zip/php_zip.c
2067da
--- php-5.4.15/ext/zip/php_zip.c.systzip	2013-05-08 07:41:20.000000000 +0200
2067da
+++ php-5.4.15/ext/zip/php_zip.c	2013-05-09 06:50:33.286058049 +0200
2067da
@@ -30,8 +30,232 @@
2067da
 #include "ext/pcre/php_pcre.h"
2067da
 #include "ext/standard/php_filestat.h"
2067da
 #include "php_zip.h"
2067da
+#if defined(HAVE_LIBZIP)
2067da
+#include <zip.h>
2067da
+
2067da
+/* Copied from libzip 0.10 */
2067da
+
2067da
+/* state of change of a file in zip archive */
2067da
+
2067da
+enum zip_state { ZIP_ST_UNCHANGED, ZIP_ST_DELETED, ZIP_ST_REPLACED,
2067da
+                 ZIP_ST_ADDED, ZIP_ST_RENAMED };
2067da
+
2067da
+/* error source for layered sources */
2067da
+
2067da
+enum zip_les { ZIP_LES_NONE, ZIP_LES_UPPER, ZIP_LES_LOWER, ZIP_LES_INVAL };
2067da
+
2067da
+typedef zip_int64_t (*zip_source_layered_callback)(struct zip_source *, void *,
2067da
+                                                   void *, zip_uint64_t,
2067da
+                                                   enum zip_source_cmd);
2067da
+
2067da
+struct zip_error {
2067da
+    int zip_err;        /* libzip error code (ZIP_ER_*) */
2067da
+    int sys_err;        /* copy of errno (E*) or zlib error code */
2067da
+    char *str;          /* string representation or NULL */
2067da
+};
2067da
+
2067da
+/* zip archive, part of API */
2067da
+
2067da
+struct zip {
2067da
+    char *zn;                   /* file name */
2067da
+    FILE *zp;                   /* file */
2067da
+    struct zip_error error;     /* error information */
2067da
+
2067da
+    unsigned int flags;         /* archive global flags */
2067da
+    unsigned int ch_flags;	/* changed archive global flags */
2067da
+
2067da
+    char *default_password;     /* password used when no other supplied */
2067da
+
2067da
+    struct zip_cdir *cdir;	/* central directory */
2067da
+    char *ch_comment;           /* changed archive comment */
2067da
+    int ch_comment_len;         /* length of changed zip archive
2067da
+                                 * comment, -1 if unchanged */
2067da
+    zip_uint64_t nentry;        /* number of entries */
2067da
+    zip_uint64_t nentry_alloc;  /* number of entries allocated */
2067da
+    struct zip_entry *entry;    /* entries */
2067da
+    int nfile;                  /* number of opened files within archive */
2067da
+    int nfile_alloc;            /* number of files allocated */
2067da
+    struct zip_file **file;     /* opened files within archive */
2067da
+};
2067da
+
2067da
+/* file in zip archive, part of API */
2067da
+
2067da
+struct zip_file {
2067da
+    struct zip *za;             /* zip archive containing this file */
2067da
+    struct zip_error error;     /* error information */
2067da
+    int eof;
2067da
+    struct zip_source *src;     /* data source */
2067da
+};
2067da
+
2067da
+/* zip archive directory entry (central or local) */
2067da
+
2067da
+struct zip_dirent {
2067da
+    unsigned short version_madeby;	/* (c)  version of creator */
2067da
+    unsigned short version_needed;	/* (cl) version needed to extract */
2067da
+    unsigned short bitflags;            /* (cl) general purpose bit flag */
2067da
+    unsigned short comp_method;         /* (cl) compression method used */
2067da
+    time_t last_mod;                    /* (cl) time of last modification */
2067da
+    unsigned int crc;                   /* (cl) CRC-32 of uncompressed data */
2067da
+    unsigned int comp_size;             /* (cl) size of commpressed data */
2067da
+    unsigned int uncomp_size;           /* (cl) size of uncommpressed data */
2067da
+    char *filename;                     /* (cl) file name (NUL-terminated) */
2067da
+    unsigned short filename_len;        /* (cl) length of filename (w/o NUL) */
2067da
+    char *extrafield;                   /* (cl) extra field */
2067da
+    unsigned short extrafield_len;	/* (cl) length of extra field */
2067da
+    char *comment;                      /* (c)  file comment */
2067da
+    unsigned short comment_len;         /* (c)  length of file comment */
2067da
+    unsigned short disk_number;         /* (c)  disk number start */
2067da
+    unsigned short int_attrib;          /* (c)  internal file attributes */
2067da
+    unsigned int ext_attrib;            /* (c)  external file attributes */
2067da
+    unsigned int offset;                /* (c)  offset of local header  */
2067da
+};
2067da
+
2067da
+/* zip archive central directory */
2067da
+
2067da
+struct zip_cdir {
2067da
+    struct zip_dirent *entry;   /* directory entries */
2067da
+    int nentry;                 /* number of entries */
2067da
+
2067da
+    unsigned int size;          /* size of central direcotry */
2067da
+    unsigned int offset;        /* offset of central directory in file */
2067da
+    char *comment;              /* zip archive comment */
2067da
+    unsigned short comment_len; /* length of zip archive comment */
2067da
+};
2067da
+
2067da
+struct zip_source {
2067da
+    struct zip_source *src;
2067da
+    union {
2067da
+	zip_source_callback f;
2067da
+        zip_source_layered_callback l;
2067da
+    } cb;
2067da
+    void *ud;
2067da
+    enum zip_les error_source;
2067da
+    int is_open;
2067da
+};
2067da
+
2067da
+/* entry in zip archive directory */
2067da
+
2067da
+struct zip_entry {
2067da
+    enum zip_state state;
2067da
+    struct zip_source *source;
2067da
+    char *ch_filename;
2067da
+    char *ch_extra;
2067da
+    int ch_extra_len;
2067da
+    char *ch_comment;
2067da
+    int ch_comment_len;
2067da
+};
2067da
+
2067da
+void _zip_dirent_finalize(struct zip_dirent *zde)
2067da
+{
2067da
+    free(zde->filename);
2067da
+    zde->filename = NULL;
2067da
+    free(zde->extrafield);
2067da
+    zde->extrafield = NULL;
2067da
+    free(zde->comment);
2067da
+    zde->comment = NULL;
2067da
+}
2067da
+
2067da
+void _zip_cdir_free(struct zip_cdir *cd)
2067da
+{
2067da
+    int i;
2067da
+
2067da
+    if (!cd)
2067da
+        return;
2067da
+
2067da
+    for (i=0; i<cd->nentry; i++)
2067da
+        _zip_dirent_finalize(cd->entry+i);
2067da
+    free(cd->comment);
2067da
+    free(cd->entry);
2067da
+    free(cd);
2067da
+}
2067da
+
2067da
+void _zip_error_fini(struct zip_error *err)
2067da
+{
2067da
+    free(err->str);
2067da
+    err->str = NULL;
2067da
+}
2067da
+
2067da
+void _zip_error_init(struct zip_error *err)
2067da
+{
2067da
+    err->zip_err = ZIP_ER_OK;
2067da
+    err->sys_err = 0;
2067da
+    err->str = NULL;
2067da
+}
2067da
+
2067da
+void _zip_unchange_data(struct zip_entry *ze)
2067da
+{
2067da
+    if (ze->source) {
2067da
+        zip_source_free(ze->source);
2067da
+        ze->source = NULL;
2067da
+    }
2067da
+
2067da
+    ze->state = ze->ch_filename ? ZIP_ST_RENAMED : ZIP_ST_UNCHANGED;
2067da
+}
2067da
+
2067da
+void _zip_entry_free(struct zip_entry *ze)
2067da
+{
2067da
+    free(ze->ch_filename);
2067da
+    ze->ch_filename = NULL;
2067da
+    free(ze->ch_extra);
2067da
+    ze->ch_extra = NULL;
2067da
+    ze->ch_extra_len = -1;
2067da
+    free(ze->ch_comment);
2067da
+    ze->ch_comment = NULL;
2067da
+    ze->ch_comment_len = -1;
2067da
+
2067da
+    _zip_unchange_data(ze);
2067da
+}
2067da
+
2067da
+void
2067da
+_zip_error_set(struct zip_error *err, int ze, int se)
2067da
+{
2067da
+    if (err) {
2067da
+	err->zip_err = ze;
2067da
+        err->sys_err = se;
2067da
+    }
2067da
+}
2067da
+
2067da
+void _zip_free(struct zip *za)
2067da
+{
2067da
+    int i;
2067da
+
2067da
+    if (za == NULL)
2067da
+        return;
2067da
+
2067da
+    if (za->zn)
2067da
+        free(za->zn);
2067da
+
2067da
+    if (za->zp)
2067da
+       	fclose(za->zp);
2067da
+
2067da
+    free(za->default_password);
2067da
+    _zip_cdir_free(za->cdir);
2067da
+    free(za->ch_comment);
2067da
+
2067da
+    if (za->entry) {
2067da
+        for (i=0; i<za->nentry; i++) {
2067da
+            _zip_entry_free(za->entry+i);
2067da
+        }
2067da
+        free(za->entry);
2067da
+    }
2067da
+
2067da
+    for (i=0; i<za->nfile; i++) {
2067da
+        if (za->file[i]->error.zip_err == ZIP_ER_OK) {
2067da
+            _zip_error_set(&za->file[i]->error, ZIP_ER_ZIPCLOSED, 0);
2067da
+            za->file[i]->za = NULL;
2067da
+        }
2067da
+    }
2067da
+
2067da
+    free(za->file);
2067da
+    free(za);
2067da
+    return;
2067da
+} 
2067da
+
2067da
+
2067da
+#else
2067da
 #include "lib/zip.h"
2067da
 #include "lib/zipint.h"
2067da
+#endif
2067da
 
2067da
 /* zip_open is a macro for renaming libzip zipopen, so we need to use PHP_NAMED_FUNCTION */
2067da
 static PHP_NAMED_FUNCTION(zif_zip_open);
2067da
@@ -1631,6 +1855,10 @@ static ZIPARCHIVE_METHOD(addEmptyDir)
2067da
 	}
2067da
 
2067da
 	idx = zip_stat(intern, s, 0, &sb);
2067da
+	/* We don't care about the NOENT status	error here. */
2067da
+	if (intern->error.zip_err == ZIP_ER_NOENT) {
2067da
+		_zip_error_set(&intern->error, ZIP_ER_OK, 0);
2067da
+	}
2067da
 	if (idx >= 0) {
2067da
 		RETVAL_FALSE;
2067da
 	} else {
2067da
@@ -1853,6 +2081,10 @@ static ZIPARCHIVE_METHOD(addFromString)
2067da
 	}
2067da
 
2067da
 	cur_idx = zip_name_locate(intern, (const char *)name, 0);
2067da
+	/* We don't care about the NOENT status error here. */
2067da
+	if (intern->error.zip_err == ZIP_ER_NOENT) {
2067da
+		_zip_error_set(&intern->error, ZIP_ER_OK, 0);
2067da
+	}
2067da
 	/* TODO: fix  _zip_replace */
2067da
 	if (cur_idx >= 0) {
2067da
 		if (zip_delete(intern, cur_idx) == -1) {
2067da
@@ -2877,5 +3109,9 @@ static PHP_MINFO_FUNCTION(zip)
2067da
 	php_info_print_table_row(2, "Zip version", PHP_ZIP_VERSION_STRING);
2067da
-	php_info_print_table_row(2, "Libzip version", LIBZIP_VERSION);
2067da
+#if defined(HAVE_LIBZIP)
2067da
+	php_info_print_table_row(2, "Compiled against libzip version", LIBZIP_VERSION);
2067da
+#else
2067da
+	php_info_print_table_row(2, "Bundled libzip version", LIBZIP_VERSION);
2067da
+#endif
2067da
 
2067da
 	php_info_print_table_end();
2067da
 }
2067da
diff -up php-5.4.15/ext/zip/php_zip.h.systzip php-5.4.15/ext/zip/php_zip.h
2067da
--- php-5.4.15/ext/zip/php_zip.h.systzip	2013-05-08 07:41:20.000000000 +0200
2067da
+++ php-5.4.15/ext/zip/php_zip.h	2013-05-09 06:46:26.086673656 +0200
2067da
@@ -28,7 +28,11 @@ extern zend_module_entry zip_module_entr
2067da
 #include "TSRM.h"
2067da
 #endif
2067da
 
2067da
+#if defined(HAVE_LIBZIP)
2067da
+#include <zip.h>
2067da
+#else
2067da
 #include "lib/zip.h"
2067da
+#endif
2067da
 
2067da
 #define PHP_ZIP_VERSION_STRING "1.11.0"
2067da
 
2067da
diff -up php-5.4.15/ext/zip/tests/bug38943.phpt.systzip php-5.4.15/ext/zip/tests/bug38943.phpt
2067da
--- php-5.4.15/ext/zip/tests/bug38943.phpt.systzip	2013-05-08 07:41:20.000000000 +0200
2067da
+++ php-5.4.15/ext/zip/tests/bug38943.phpt	2013-05-09 06:46:26.088673667 +0200
2067da
@@ -27,7 +27,7 @@ array(1) {
2067da
   [0]=>
2067da
   int(1)
2067da
 }
2067da
-object(myZip)#1 (%d) {
2067da
+object(myZip)#%d (%d) {
2067da
   ["test":"myZip":private]=>
2067da
   int(0)
2067da
   ["testp"]=>
2067da
diff -up php-5.4.15/ext/zip/tests/pecl12414.phpt.systzip php-5.4.15/ext/zip/tests/pecl12414.phpt
2067da
--- php-5.4.15/ext/zip/tests/pecl12414.phpt.systzip	2013-05-08 07:41:20.000000000 +0200
2067da
+++ php-5.4.15/ext/zip/tests/pecl12414.phpt	2013-05-09 06:46:26.088673667 +0200
2067da
@@ -5,6 +5,8 @@ Bug #12414 ( extracting files from damag
2067da
 /*$ */
2067da
 if(!extension_loaded('zip')) die('skip');
2067da
  ?>
2067da
+--XFAIL--
2067da
+Doesn't work with system libzip (zip_readfile could not read from ...)
2067da
 --FILE--
2067da
 
2067da
 $filename = 'MYLOGOV2.GFX';
2067da
diff -up php-5.4.15/ext/zip/zip_stream.c.systzip php-5.4.15/ext/zip/zip_stream.c
2067da
--- php-5.4.15/ext/zip/zip_stream.c.systzip	2013-05-08 07:41:20.000000000 +0200
2067da
+++ php-5.4.15/ext/zip/zip_stream.c	2013-05-09 06:46:26.088673667 +0200
2067da
@@ -6,7 +6,11 @@
2067da
 #if HAVE_ZIP
2067da
 #ifdef ZEND_ENGINE_2
2067da
 
2067da
+#if defined(HAVE_LIBZIP)
2067da
+#include <zip.h>
2067da
+#else
2067da
 #include "lib/zip.h"
2067da
+#endif
2067da
 
2067da
 #include "php_streams.h"
2067da
 #include "ext/standard/file.h"