summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRemi Collet <remi@remirepo.net>2019-07-23 16:21:13 +0200
committerRemi Collet <remi@remirepo.net>2019-07-23 16:21:13 +0200
commit799e5d1ecf0d54c3ddf5826235a66c47646a4b7b (patch)
treecc53d35d12f2e49cf415d2f0f8a54e3f7a21dff0
parent928f5d179a7d83404ad28ae9429c470b673f5b35 (diff)
rebuild
-rw-r--r--7cf5099820367e314d2bb34a289e376e248539c6.patch151
-rw-r--r--php-pecl-zip.spec10
2 files changed, 157 insertions, 4 deletions
diff --git a/7cf5099820367e314d2bb34a289e376e248539c6.patch b/7cf5099820367e314d2bb34a289e376e248539c6.patch
new file mode 100644
index 0000000..d90bfd2
--- /dev/null
+++ b/7cf5099820367e314d2bb34a289e376e248539c6.patch
@@ -0,0 +1,151 @@
+From 7cf5099820367e314d2bb34a289e376e248539c6 Mon Sep 17 00:00:00 2001
+From: Remi Collet <remi@remirepo.net>
+Date: Tue, 23 Jul 2019 16:14:57 +0200
+Subject: [PATCH] sync changes from php-src
+
+---
+ php74/php_zip.c | 44 ++++++++++++++++++++++++++++----------------
+ php74/php_zip.h | 4 ----
+ php74/zip_stream.c | 10 +++++-----
+ 3 files changed, 33 insertions(+), 25 deletions(-)
+
+diff --git a/php74/php_zip.c b/php74/php_zip.c
+index df3eade..fabd30e 100644
+--- a/php74/php_zip.c
++++ b/php74/php_zip.c
+@@ -677,19 +677,6 @@ int php_zip_pcre(zend_string *regexp, char *path, int path_len, zval *return_val
+ break;
+ }
+
+- snprintf(fullpath, MAXPATHLEN, "%s%c%s", path, DEFAULT_SLASH, ZSTR_VAL(namelist[i]));
+-
+- if (0 != VCWD_STAT(fullpath, &s)) {
+- php_error_docref(NULL, E_WARNING, "Cannot read <%s>", fullpath);
+- zend_string_release_ex(namelist[i], 0);
+- continue;
+- }
+-
+- if (S_IFDIR == (s.st_mode & S_IFMT)) {
+- zend_string_release_ex(namelist[i], 0);
+- continue;
+- }
+-
+ match_data = php_pcre_create_match_data(capture_count, re);
+ if (!match_data) {
+ /* Allocation failed, but can proceed to the next pattern. */
+@@ -704,6 +691,19 @@ int php_zip_pcre(zend_string *regexp, char *path, int path_len, zval *return_val
+ continue;
+ }
+
++ snprintf(fullpath, MAXPATHLEN, "%s%c%s", path, DEFAULT_SLASH, ZSTR_VAL(namelist[i]));
++
++ if (0 != VCWD_STAT(fullpath, &s)) {
++ php_error_docref(NULL, E_WARNING, "Cannot read <%s>", fullpath);
++ zend_string_release_ex(namelist[i], 0);
++ continue;
++ }
++
++ if (S_IFDIR == (s.st_mode & S_IFMT)) {
++ zend_string_release_ex(namelist[i], 0);
++ continue;
++ }
++
+ add_next_index_string(return_value, fullpath);
+ zend_string_release_ex(namelist[i], 0);
+ }
+@@ -873,7 +873,11 @@ static zval *php_zip_get_property_ptr_ptr(zval *object, zval *member, int type,
+ zip_prop_handler *hnd = NULL;
+
+ if (Z_TYPE_P(member) != IS_STRING) {
+- ZVAL_STR(&tmp_member, zval_get_string_func(member));
++ zend_string *str = zval_try_get_string_func(member);
++ if (UNEXPECTED(!str)) {
++ return NULL;
++ }
++ ZVAL_STR(&tmp_member, str);
+ member = &tmp_member;
+ cache_slot = NULL;
+ }
+@@ -904,7 +908,11 @@ static zval *php_zip_read_property(zval *object, zval *member, int type, void **
+ zip_prop_handler *hnd = NULL;
+
+ if (Z_TYPE_P(member) != IS_STRING) {
+- ZVAL_STR(&tmp_member, zval_get_string_func(member));
++ zend_string *str = zval_try_get_string_func(member);
++ if (UNEXPECTED(!str)) {
++ return &EG(uninitialized_zval);
++ }
++ ZVAL_STR(&tmp_member, str);
+ member = &tmp_member;
+ cache_slot = NULL;
+ }
+@@ -940,7 +948,11 @@ static int php_zip_has_property(zval *object, zval *member, int type, void **cac
+ int retval = 0;
+
+ if (Z_TYPE_P(member) != IS_STRING) {
+- ZVAL_STR(&tmp_member, zval_get_string_func(member));
++ zend_string *str = zval_try_get_string_func(member);
++ if (UNEXPECTED(!str)) {
++ return 0;
++ }
++ ZVAL_STR(&tmp_member, str);
+ member = &tmp_member;
+ cache_slot = NULL;
+ }
+diff --git a/php74/php_zip.h b/php74/php_zip.h
+index 191be54..0ac9189 100644
+--- a/php74/php_zip.h
++++ b/php74/php_zip.h
+@@ -27,11 +27,7 @@ extern zend_module_entry zip_module_entry;
+ #include "TSRM.h"
+ #endif
+
+-#if defined(HAVE_LIBZIP)
+ #include <zip.h>
+-#else
+-#include "lib/zip.h"
+-#endif
+
+ #ifndef ZIP_OVERWRITE
+ #define ZIP_OVERWRITE ZIP_TRUNCATE
+diff --git a/php74/zip_stream.c b/php74/zip_stream.c
+index f24a91f..bce62f5 100644
+--- a/php74/zip_stream.c
++++ b/php74/zip_stream.c
+@@ -45,7 +45,7 @@ struct php_zip_stream_data_t {
+
+
+ /* {{{ php_zip_ops_read */
+-static size_t php_zip_ops_read(php_stream *stream, char *buf, size_t count)
++static ssize_t php_zip_ops_read(php_stream *stream, char *buf, size_t count)
+ {
+ ssize_t n = 0;
+ STREAM_DATA_FROM_STREAM();
+@@ -65,7 +65,7 @@ static size_t php_zip_ops_read(php_stream *stream, char *buf, size_t count)
+ php_error_docref(NULL, E_WARNING, "Zip stream error: %s", zip_error_strerror(err));
+ zip_error_fini(err);
+ #endif
+- return 0;
++ return -1;
+ }
+ /* cast count to signed value to avoid possibly negative n
+ * being cast to unsigned value */
+@@ -75,15 +75,15 @@ static size_t php_zip_ops_read(php_stream *stream, char *buf, size_t count)
+ self->cursor += n;
+ }
+ }
+- return (n < 1 ? 0 : (size_t)n);
++ return n;
+ }
+ /* }}} */
+
+ /* {{{ php_zip_ops_write */
+-static size_t php_zip_ops_write(php_stream *stream, const char *buf, size_t count)
++static ssize_t php_zip_ops_write(php_stream *stream, const char *buf, size_t count)
+ {
+ if (!stream) {
+- return 0;
++ return -1;
+ }
+
+ return count;
diff --git a/php-pecl-zip.spec b/php-pecl-zip.spec
index 9c229ff..c74cb54 100644
--- a/php-pecl-zip.spec
+++ b/php-pecl-zip.spec
@@ -32,7 +32,7 @@ Summary: A ZIP archive management extension
Summary(fr): Une extension de gestion des ZIP
Name: %{?scl_prefix}php-pecl-zip
Version: 1.15.4
-Release: 5%{?dist}%{!?scl:%{!?nophptag:%(%{__php} -r 'echo ".".PHP_MAJOR_VERSION.".".PHP_MINOR_VERSION;')}}
+Release: 6%{?dist}%{!?scl:%{!?nophptag:%(%{__php} -r 'echo ".".PHP_MAJOR_VERSION.".".PHP_MINOR_VERSION;')}}
License: PHP
Group: Development/Languages
URL: http://pecl.php.net/package/zip
@@ -40,6 +40,7 @@ URL: http://pecl.php.net/package/zip
Source: http://pecl.php.net/get/%{pecl_name}-%{version}%{?prever}.tgz
Patch0: https://github.com/pierrejoye/php_zip/commit/cd42728d67ca5146e7903e00e7593e216c80fecb.patch
+Patch1: https://github.com/pierrejoye/php_zip/commit/7cf5099820367e314d2bb34a289e376e248539c6.patch
BuildRequires: %{?dtsprefix}gcc
BuildRequires: %{?scl_prefix}php-devel
@@ -90,11 +91,11 @@ Obsoletes: php72u-pecl-%{pecl_name} <= %{version}
Obsoletes: php72w-pecl-%{pecl_name} <= %{version}
%endif
%if "%{php_version}" > "7.3"
-Obsoletes: php73-pecl-%{pecl_name} <= %{version}
+Obsoletes: php73-pecl-%{pecl_name} <= %{version}
Obsoletes: php73w-pecl-%{pecl_name} <= %{version}
%endif
%if "%{php_version}" > "7.4"
-Obsoletes: php74-pecl-%{pecl_name} <= %{version}
+Obsoletes: php74-pecl-%{pecl_name} <= %{version}
Obsoletes: php74w-pecl-%{pecl_name} <= %{version}
%endif
%endif
@@ -132,6 +133,7 @@ sed -e 's/role="test"/role="src"/' \
cd NTS
%patch0 -p1
+%patch1 -p1
# Sanity check, really often broken
extver=$(sed -n '/#define PHP_ZIP_VERSION/{s/.* "//;s/".*$//;p}' php5/php_zip.h)
@@ -263,7 +265,7 @@ fi
%changelog
-* Tue Jul 23 2019 Remi Collet <remi@remirepo.net> - 1.15.4-5
+* Tue Jul 23 2019 Remi Collet <remi@remirepo.net> - 1.15.4-6
- rebuild for 7.4.0beta1
* Wed May 29 2019 Remi Collet <remi@remirepo.net> - 1.15.4-4