summaryrefslogtreecommitdiffstats
path: root/7cf5099820367e314d2bb34a289e376e248539c6.patch
diff options
context:
space:
mode:
Diffstat (limited to '7cf5099820367e314d2bb34a289e376e248539c6.patch')
-rw-r--r--7cf5099820367e314d2bb34a289e376e248539c6.patch151
1 files changed, 151 insertions, 0 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;