Permalink
Browse files

- sync with PECL HEAD

  • Loading branch information...
1 parent 3681756 commit b734bf4b97f9203eb7a7a6a7ef24286f2272bd08 @pierrejoye pierrejoye committed May 21, 2008
Showing with 1,329 additions and 1,071 deletions.
  1. +31 −2 ext/zip/config.m4
  2. +1 −2 ext/zip/config.w32
  3. +3 −0 ext/zip/examples/create.php
  4. +4 −0 ext/zip/examples/dir.php
  5. +4 −0 ext/zip/examples/extract.php
  6. +4 −0 ext/zip/examples/fopen.php
  7. BIN ext/zip/examples/test.zip
  8. +0 −136 ext/zip/lib/mkstemp.c
  9. +0 −3 ext/zip/lib/unistd.h
  10. +67 −51 ext/zip/lib/zip.h
  11. +5 −7 ext/zip/lib/zip_add.c
  12. +3 −6 ext/zip/lib/zip_add_dir.c
  13. +0 −45 ext/zip/lib/zip_alias.h
  14. +43 −49 ext/zip/lib/zip_close.c
  15. +3 −6 ext/zip/lib/zip_delete.c
  16. +21 −24 ext/zip/lib/zip_dirent.c
  17. +3 −6 ext/zip/lib/zip_entry_free.c
  18. +3 −6 ext/zip/lib/zip_entry_new.c
  19. +2 −6 ext/zip/lib/zip_err_str.c
  20. +8 −11 ext/zip/lib/zip_error.c
  21. +3 −6 ext/zip/lib/zip_error_clear.c
  22. +3 −6 ext/zip/lib/zip_error_get.c
  23. +3 −6 ext/zip/lib/zip_error_get_sys_type.c
  24. +8 −11 ext/zip/lib/zip_error_strerror.c
  25. +3 −6 ext/zip/lib/zip_error_to_str.c
  26. +10 −14 ext/zip/lib/zip_fclose.c
  27. +3 −6 ext/zip/lib/zip_file_error_clear.c
  28. +3 −6 ext/zip/lib/zip_file_error_get.c
  29. +4 −10 ext/zip/lib/zip_file_get_offset.c
  30. +3 −6 ext/zip/lib/zip_file_strerror.c
  31. +3 −6 ext/zip/lib/zip_fopen.c
  32. +5 −8 ext/zip/lib/zip_fopen_index.c
  33. +4 −7 ext/zip/lib/zip_fread.c
  34. +4 −9 ext/zip/lib/zip_free.c
  35. +13 −11 ext/zip/lib/zip_get_archive_comment.c
  36. +3 −6 ext/zip/lib/zip_get_file_comment.c
  37. +4 −7 ext/zip/lib/zip_get_name.c
  38. +3 −6 ext/zip/lib/zip_get_num_files.c
  39. +3 −6 ext/zip/lib/zip_memdup.c
  40. +10 −15 ext/zip/lib/zip_name_locate.c
  41. +5 −6 ext/zip/lib/zip_new.c
  42. +242 −141 ext/zip/lib/zip_open.c
  43. +3 −6 ext/zip/lib/zip_rename.c
  44. +12 −16 ext/zip/lib/zip_replace.c
  45. +4 −7 ext/zip/lib/zip_set_archive_comment.c
  46. +3 −6 ext/zip/lib/zip_set_file_comment.c
  47. +4 −6 ext/zip/lib/zip_set_name.c
  48. +5 −8 ext/zip/lib/zip_source_buffer.c
  49. +3 −10 ext/zip/lib/zip_source_file.c
  50. +3 −6 ext/zip/lib/zip_source_filep.c
  51. +3 −6 ext/zip/lib/zip_source_free.c
  52. +3 −6 ext/zip/lib/zip_source_function.c
  53. +3 −6 ext/zip/lib/zip_source_zip.c
  54. +3 −6 ext/zip/lib/zip_stat.c
  55. +4 −7 ext/zip/lib/zip_stat_index.c
  56. +3 −5 ext/zip/lib/zip_stat_init.c
  57. +3 −7 ext/zip/lib/zip_strerror.c
  58. +5 −7 ext/zip/lib/zip_unchange.c
  59. +5 −7 ext/zip/lib/zip_unchange_all.c
  60. +3 −5 ext/zip/lib/zip_unchange_archive.c
  61. +3 −3 ext/zip/lib/zip_unchange_data.c
  62. +9 −0 ext/zip/lib/zip_win32.h
  63. +67 −49 ext/zip/lib/zipint.h
  64. +0 −49 ext/zip/lib/zipint_alias.h
  65. +565 −125 ext/zip/php_zip.c
  66. +33 −2 ext/zip/php_zip.h
  67. +5 −17 ext/zip/tests/bug38943.phpt
  68. +28 −34 ext/zip/tests/bug7658.phpt
View
@@ -3,13 +3,16 @@ dnl $Id$
dnl
PHP_ARG_ENABLE(zip, for zip archive read/writesupport,
-[ --enable-zip Include Zip read/write support])
+[ --enable-zip Include Zip read/write support.])
if test -z "$PHP_ZLIB_DIR"; then
PHP_ARG_WITH(zlib-dir, for the location of libz,
-[ --with-zlib-dir[=DIR] ZIP: Set the path to libz install prefix], no, no)
+[ --with-zlib-dir[=DIR] zip: Set the path to libz install prefix.], no, no)
fi
+PHP_ARG_WITH(pcre-dir, pcre install prefix,
+[ --with-pcre-dir FILTER: pcre install prefix], no, no)
+
if test "$PHP_ZIP" != "no"; then
if test "$PHP_ZLIB_DIR" != "no" && test "$PHP_ZLIB_DIR" != "yes"; then
@@ -44,6 +47,32 @@ if test "$PHP_ZIP" != "no"; then
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,[
+#include <main/php_config.h>
+#if defined(HAVE_BUNDLED_PCRE) && !defined(COMPILE_DL_PCRE)
+yes
+#endif
+ ],[
+ 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
+ ])
+ ])
+ 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 \
View
@@ -1,10 +1,9 @@
// $Id$
// vim:ft=javascript
-ARG_ENABLE("zip", "ZIP support", "no");
+ARG_ENABLE("zip", "ZIP support", "yes");
if (PHP_ZIP != "no") {
-
if (CHECK_HEADER_ADD_INCLUDE("zlib.h", "CFLAGS_ZIP", "..\\zlib;" + php_usual_include_suspects + ";" + PHP_ZIP)) {
if (PHP_ZLIB_SHARED) {
CHECK_LIB("zlib.lib", "zip", PHP_ZIP);
@@ -1,5 +1,8 @@
<?php
error_reporting(E_ALL);
+if (!extension_loaded('zip')) {
+ dl('zip.so');
+}
$thisdir = dirname(__FILE__);
unlink("./test112.zip");
$zip = new ZipArchive();
View
@@ -1,4 +1,8 @@
<?php
+if (!extension_loaded('zip')) {
+ dl('zip.so');
+}
+
$za = new ZipArchive();
$za->open('test_with_comment.zip');
@@ -1,4 +1,8 @@
<?php
+if (!extension_loaded('zip')) {
+ dl('zip.so');
+}
+
$zip = new ZipArchive();
echo $zip->filename . "\n";
@@ -1,4 +1,8 @@
<?php
+if (!extension_loaded('zip')) {
+ dl('zip.so');
+}
+
$fp = fopen('zip://' . dirname(__FILE__) . '/test.zip#test', 'r');
if (!$fp) {
View
Binary file not shown.
View
@@ -1,136 +0,0 @@
-/* $NiH: mkstemp.c,v 1.3 2006/04/23 14:51:45 wiz Exp $ */
-
-/* Adapted from NetBSB libc by Dieter Baron */
-
-/* NetBSD: gettemp.c,v 1.13 2003/12/05 00:57:36 uebayasi Exp */
-
-/*
- * Copyright (c) 1987, 1993
- * The Regents of the University of California. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. Neither the name of the University nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- */
-
-#include <sys/types.h>
-#include <sys/stat.h>
-
-#include <assert.h>
-#include <ctype.h>
-#include <errno.h>
-#include <fcntl.h>
-#include <stdio.h>
-#include <stdlib.h>
-#include <unistd.h>
-
-
-int
-_zip_mkstemp(char *path)
-{
- int fd;
- char *start, *trv;
- struct stat sbuf;
- pid_t pid;
-
- /* To guarantee multiple calls generate unique names even if
- the file is not created. 676 different possibilities with 7
- or more X's, 26 with 6 or less. */
- static char xtra[2] = "aa";
- int xcnt = 0;
-
- pid = getpid();
-
- /* Move to end of path and count trailing X's. */
- for (trv = path; *trv; ++trv)
- if (*trv == 'X')
- xcnt++;
- else
- xcnt = 0;
-
- /* Use at least one from xtra. Use 2 if more than 6 X's. */
- if (*(trv - 1) == 'X')
- *--trv = xtra[0];
- if (xcnt > 6 && *(trv - 1) == 'X')
- *--trv = xtra[1];
-
- /* Set remaining X's to pid digits with 0's to the left. */
- while (*--trv == 'X') {
- *trv = (pid % 10) + '0';
- pid /= 10;
- }
-
- /* update xtra for next call. */
- if (xtra[0] != 'z')
- xtra[0]++;
- else {
- xtra[0] = 'a';
- if (xtra[1] != 'z')
- xtra[1]++;
- else
- xtra[1] = 'a';
- }
-
- /*
- * check the target directory; if you have six X's and it
- * doesn't exist this runs for a *very* long time.
- */
- for (start = trv + 1;; --trv) {
- if (trv <= path)
- break;
- if (*trv == '/') {
- *trv = '\0';
- if (stat(path, &sbuf))
- return (0);
- if (!S_ISDIR(sbuf.st_mode)) {
- errno = ENOTDIR;
- return (0);
- }
- *trv = '/';
- break;
- }
- }
-
- for (;;) {
- if ((fd = open(path, O_CREAT | O_EXCL | O_RDWR, 0600)) >= 0)
- return (1);
- if (errno != EEXIST)
- return (0);
-
- /* tricky little algorithm for backward compatibility */
- for (trv = start;;) {
- if (!*trv)
- return (0);
- if (*trv == 'z')
- *trv++ = 'a';
- else {
- if (isdigit((unsigned char)*trv))
- *trv = 'a';
- else
- ++*trv;
- break;
- }
- }
- }
- /*NOTREACHED*/
-}
View
@@ -1,3 +0,0 @@
-#ifndef _MSC_VER
-#include <unistd.h>
-#endif
Oops, something went wrong.

0 comments on commit b734bf4

Please sign in to comment.