Skip to content

Commit 8d1a42f

Browse files
authored
ext/zip: Sync remaining parts for libzip >= 1.0.0 (#20365)
Follow up of GH-20355
1 parent 9300a50 commit 8d1a42f

File tree

6 files changed

+2
-24
lines changed

6 files changed

+2
-24
lines changed

ext/zip/config.w32

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ if (PHP_ZIP != "no") {
1717
}
1818

1919
AC_DEFINE('HAVE_ZIP', 1, "Define to 1 if the PHP extension 'zip' is available.");
20-
ADD_FLAG("CFLAGS_ZIP", "/D HAVE_SET_MTIME /D HAVE_ENCRYPTION /D HAVE_LIBZIP_VERSION /D HAVE_PROGRESS_CALLBACK /D HAVE_CANCEL_CALLBACK /D HAVE_METHOD_SUPPORTED /D LZMA_API_STATIC");
20+
ADD_FLAG("CFLAGS_ZIP", "/D HAVE_ENCRYPTION /D HAVE_LIBZIP_VERSION /D HAVE_PROGRESS_CALLBACK /D HAVE_CANCEL_CALLBACK /D HAVE_METHOD_SUPPORTED /D LZMA_API_STATIC");
2121
} else {
2222
WARNING("zip not enabled; libraries and headers not found");
2323
}

ext/zip/php_zip.c

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2424,7 +2424,6 @@ PHP_METHOD(ZipArchive, setCompressionIndex)
24242424
}
24252425
/* }}} */
24262426

2427-
#ifdef HAVE_SET_MTIME
24282427
/* {{{ Set the modification time of a file in zip, using its name */
24292428
PHP_METHOD(ZipArchive, setMtimeName)
24302429
{
@@ -2477,7 +2476,6 @@ PHP_METHOD(ZipArchive, setMtimeIndex)
24772476
(time_t)mtime, (zip_uint32_t)flags) == 0);
24782477
}
24792478
/* }}} */
2480-
#endif
24812479

24822480
/* {{{ Delete a file using its index */
24832481
PHP_METHOD(ZipArchive, deleteIndex)

ext/zip/php_zip.stub.php

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -704,13 +704,11 @@ public function setCommentIndex(int $index, string $comment): bool {}
704704
/** @tentative-return-type */
705705
public function setCommentName(string $name, string $comment): bool {}
706706

707-
#ifdef HAVE_SET_MTIME
708707
/** @tentative-return-type */
709708
public function setMtimeIndex(int $index, int $timestamp, int $flags = 0): bool {}
710709

711710
/** @tentative-return-type */
712711
public function setMtimeName(string $name, int $timestamp, int $flags = 0): bool {}
713-
#endif
714712

715713
/** @tentative-return-type */
716714
public function getCommentIndex(int $index, int $flags = 0): string|false {}

ext/zip/php_zip_arginfo.h

Lines changed: 1 addition & 7 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

ext/zip/tests/oo_setmtime.phpt

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,6 @@
22
setMtime
33
--EXTENSIONS--
44
zip
5-
--SKIPIF--
6-
<?php
7-
/* $Id$ */
8-
if (!method_exists('ZipArchive', 'setMtimeName')) die('skip libzip too old');
9-
?>
105
--INI--
116
date.timezone=UTC
127
--FILE--

ext/zip/zip_stream.c

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -49,18 +49,11 @@ static ssize_t php_zip_ops_read(php_stream *stream, char *buf, size_t count)
4949
if (self->zf) {
5050
n = zip_fread(self->zf, buf, count);
5151
if (n < 0) {
52-
#if LIBZIP_VERSION_MAJOR < 1
53-
int ze, se;
54-
zip_file_error_get(self->zf, &ze, &se);
55-
stream->eof = 1;
56-
php_error_docref(NULL, E_WARNING, "Zip stream error: %s", zip_file_strerror(self->zf));
57-
#else
5852
zip_error_t *err;
5953
err = zip_file_get_error(self->zf);
6054
stream->eof = 1;
6155
php_error_docref(NULL, E_WARNING, "Zip stream error: %s", zip_error_strerror(err));
6256
zip_error_fini(err);
63-
#endif
6457
return -1;
6558
}
6659
/* cast count to signed value to avoid possibly negative n

0 commit comments

Comments
 (0)