summaryrefslogtreecommitdiff
path: root/ext/zip/zip_stream.c
diff options
context:
space:
mode:
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