summaryrefslogtreecommitdiff
path: root/ext/zip/zip_stream.c
diff options
context:
space:
mode:
authorRemi Collet <remi@fedoraproject.org>2015-05-06 14:43:47 +0200
committerRemi Collet <remi@php.net>2015-05-06 15:16:43 +0200
commit3638ac2300bc7464b30cf26bf3c7be5beea82503 (patch)
tree0c7681238139d6c91e18518898c418fb64cd1adf /ext/zip/zip_stream.c
parent9e0cc7a1d926c1364a834177cadea431cd8b39a7 (diff)
downloadphp-git-3638ac2300bc7464b30cf26bf3c7be5beea82503.tar.gz
don't use deprecated libzip call
Diffstat (limited to 'ext/zip/zip_stream.c')
-rw-r--r--ext/zip/zip_stream.c8
1 files changed, 8 insertions, 0 deletions
diff --git a/ext/zip/zip_stream.c b/ext/zip/zip_stream.c
index 18707eed27..3ae3e34f13 100644
--- a/ext/zip/zip_stream.c
+++ b/ext/zip/zip_stream.c
@@ -52,10 +52,18 @@ static size_t php_zip_ops_read(php_stream *stream, char *buf, size_t count)
if (self->za && self->zf) {
n = zip_fread(self->zf, buf, count);
if (n < 0) {
+#if LIBZIP_VERSION_MAJOR < 1
int ze, se;
zip_file_error_get(self->zf, &ze, &se);
stream->eof = 1;
php_error_docref(NULL, E_WARNING, "Zip stream error: %s", zip_file_strerror(self->zf));
+#else
+ zip_error_t *err;
+ err = zip_file_get_error(self->zf);
+ stream->eof = 1;
+ php_error_docref(NULL TSRMLS_CC, E_WARNING, "Zip stream error: %s", zip_error_strerror(err));
+ zip_error_fini(err);
+#endif
return 0;
}
/* cast count to signed value to avoid possibly negative n