Skip to content

Commit 707280b

Browse files
committed
Merge branch 'PHP-8.4'
2 parents 1ff4854 + d68ae84 commit 707280b

File tree

5 files changed

+100
-60
lines changed

5 files changed

+100
-60
lines changed

cmake/cmake/modules/Findlibzip.cmake

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -26,9 +26,9 @@ This module defines the following imported targets:
2626
2727
* `libzip_INCLUDE_DIR` - Directory containing package library headers.
2828
* `libzip_LIBRARY` - The path to the package library.
29-
* `HAVE_SET_MTIME`
30-
* `HAVE_ENCRYPTION`
31-
* `HAVE_LIBZIP_VERSION`
29+
* `libzip_HAVE_ENCRYPTION`
30+
* `libzip_HAVE_LIBZIP_VERSION`
31+
* `libzip_HAVE_SET_MTIME`
3232
3333
## Examples
3434
@@ -110,25 +110,25 @@ block(PROPAGATE libzip_VERSION)
110110
set(CMAKE_REQUIRED_QUIET TRUE)
111111

112112
# zip_file_set_mtime is available with libzip 1.0.0.
113-
check_symbol_exists(zip_file_set_mtime zip.h HAVE_SET_MTIME)
113+
check_symbol_exists(zip_file_set_mtime zip.h libzip_HAVE_SET_MTIME)
114114

115-
if(NOT HAVE_SET_MTIME)
115+
if(NOT libzip_HAVE_SET_MTIME)
116116
set(libzip_VERSION 0.11)
117117
else()
118118
set(libzip_VERSION 1.0)
119119
endif()
120120

121121
# zip_file_set_encryption is available in libzip 1.2.0.
122-
check_symbol_exists(zip_file_set_encryption zip.h HAVE_ENCRYPTION)
122+
check_symbol_exists(zip_file_set_encryption zip.h libzip_HAVE_ENCRYPTION)
123123

124-
if(HAVE_ENCRYPTION)
124+
if(libzip_HAVE_ENCRYPTION)
125125
set(libzip_VERSION 1.2.0)
126126
endif()
127127

128128
# zip_libzip_version is available in libzip 1.3.1.
129-
check_symbol_exists(zip_libzip_version zip.h HAVE_LIBZIP_VERSION)
129+
check_symbol_exists(zip_libzip_version zip.h libzip_HAVE_LIBZIP_VERSION)
130130

131-
if(HAVE_LIBZIP_VERSION)
131+
if(libzip_HAVE_LIBZIP_VERSION)
132132
set(libzip_VERSION 1.3.1)
133133
endif()
134134
cmake_pop_check_state()

cmake/ext/zip/CMakeLists.txt

Lines changed: 31 additions & 45 deletions
Original file line numberDiff line numberDiff line change
@@ -27,9 +27,7 @@ project(
2727
LANGUAGES C
2828
)
2929

30-
include(CheckSymbolExists)
3130
include(CMakeDependentOption)
32-
include(CMakePushCheckState)
3331
include(FeatureSummary)
3432

3533
option(PHP_EXT_ZIP "Enable the zip extension")
@@ -111,54 +109,42 @@ endif()
111109
# TODO: When downloading and building libzip from source additional deps are
112110
# required.
113111

114-
if(TARGET libzip::zip)
115-
cmake_push_check_state(RESET)
116-
set(CMAKE_REQUIRED_LIBRARIES libzip::zip)
117-
118-
check_symbol_exists(zip_file_set_mtime zip.h HAVE_SET_MTIME)
119-
120-
if(NOT HAVE_SET_MTIME)
121-
message(
122-
WARNING
123-
"ext/zip will not have support for setting mtime "
124-
"(Libzip >= 1.0.0 is needed for setting mtime)"
125-
)
126-
endif()
127-
128-
check_symbol_exists(zip_file_set_encryption zip.h HAVE_ENCRYPTION)
129-
130-
if(NOT HAVE_ENCRYPTION)
131-
message(
132-
WARNING
133-
"ext/zip will not have encryption support "
134-
"(Libzip >= 1.2.0 is needed for encryption support)"
135-
)
136-
endif()
137-
138-
check_symbol_exists(
139-
zip_libzip_version
140-
zip.h
141-
HAVE_LIBZIP_VERSION
112+
if(libzip_FOUND)
113+
if(libzip_VERSION VERSION_GREATER_EQUAL 1.0.0)
114+
set(HAVE_SET_MTIME TRUE)
115+
else()
116+
message(
117+
WARNING
118+
"ext/zip will not have support for setting mtime "
119+
"(Libzip >= 1.0.0 is needed for setting mtime)"
142120
)
121+
endif()
143122

144-
check_symbol_exists(
145-
zip_register_progress_callback_with_state
146-
zip.h
147-
HAVE_PROGRESS_CALLBACK
123+
if(libzip_VERSION VERSION_GREATER_EQUAL 1.2.0)
124+
set(HAVE_ENCRYPTION TRUE)
125+
else()
126+
message(
127+
WARNING
128+
"ext/zip will not have encryption support "
129+
"(Libzip >= 1.2.0 is needed for encryption support)"
148130
)
131+
endif()
149132

150-
check_symbol_exists(
151-
zip_register_cancel_callback_with_state
152-
zip.h
153-
HAVE_CANCEL_CALLBACK
154-
)
133+
if(libzip_VERSION VERSION_GREATER_EQUAL 1.3.0)
134+
set(HAVE_PROGRESS_CALLBACK TRUE)
135+
endif()
155136

156-
check_symbol_exists(
157-
zip_compression_method_supported
158-
zip.h
159-
HAVE_METHOD_SUPPORTED
160-
)
161-
cmake_pop_check_state()
137+
if(libzip_VERSION VERSION_GREATER_EQUAL 1.3.1)
138+
set(HAVE_LIBZIP_VERSION TRUE)
139+
endif()
140+
141+
if(libzip_VERSION VERSION_GREATER_EQUAL 1.6.0)
142+
set(HAVE_CANCEL_CALLBACK TRUE)
143+
endif()
144+
145+
if(libzip_VERSION VERSION_GREATER_EQUAL 1.7.0)
146+
set(HAVE_METHOD_SUPPORTED TRUE)
147+
endif()
162148
endif()
163149

164150
set(HAVE_ZIP TRUE)

patches/8.3/tests.patch

Lines changed: 20 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,14 +2,32 @@ From: Peter Kokot <[email protected]>
22
Subject: Fix tests
33

44
- ext/zip
5-
When PHP is compiled and built agains libzip that doesn't have AES
5+
When PHP is compiled and built against libzip that doesn't have AES
66
support enabled (if all encryption options are set to OFF in CMake),
77
ZipArchive::EM_AES_256 and ZipArchive::EM_AES_192 aren't supported.
8+
ZipArchive::registerProgressCallback() is only available when using
9+
libzip 1.3.0 or newer.
810
---
11+
ext/zip/tests/gh18431.phpt | 4 ++++
912
ext/zip/tests/oo_addglob2.phpt | 6 ++++++
1013
ext/zip/tests/oo_encryption.phpt | 6 ++++++
11-
2 files changed, 12 insertions(+)
14+
3 files changed, 16 insertions(+)
1215

16+
diff --git a/ext/zip/tests/gh18431.phpt b/ext/zip/tests/gh18431.phpt
17+
index d4eb89c36c6..dcd7db6f400 100644
18+
--- a/ext/zip/tests/gh18431.phpt
19+
+++ b/ext/zip/tests/gh18431.phpt
20+
@@ -2,6 +2,10 @@
21+
GH-18431 (Registering ZIP progress callback twice doesn't work)
22+
--EXTENSIONS--
23+
zip
24+
+--SKIPIF--
25+
+<?php
26+
+if (!method_exists('ZipArchive', 'registerProgressCallback')) die('skip libzip too old');
27+
+?>
28+
--FILE--
29+
<?php
30+
$file = __DIR__ . '/gh18431.zip';
1331
diff --git a/ext/zip/tests/oo_addglob2.phpt b/ext/zip/tests/oo_addglob2.phpt
1432
index 517c0b7fd7f..1432d704de5 100644
1533
--- a/ext/zip/tests/oo_addglob2.phpt

patches/8.4/tests.patch

Lines changed: 20 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,14 +6,17 @@ Subject: Fix tests
66
example, php-src/php-build relative paths need to be adjusted.
77

88
- ext/zip
9-
When PHP is compiled and built agains libzip that doesn't have AES
9+
When PHP is compiled and built against libzip that doesn't have AES
1010
support enabled (if all encryption options are set to OFF in CMake),
1111
ZipArchive::EM_AES_256 and ZipArchive::EM_AES_192 aren't supported.
12+
ZipArchive::registerProgressCallback() is only available when using
13+
libzip 1.3.0 or newer.
1214
---
1315
ext/dom/tests/dom_xinclude.phpt | 4 ++--
16+
ext/zip/tests/gh18431.phpt | 4 ++++
1417
ext/zip/tests/oo_addglob2.phpt | 6 ++++++
1518
ext/zip/tests/oo_encryption.phpt | 6 ++++++
16-
3 files changed, 14 insertions(+), 2 deletions(-)
19+
4 files changed, 18 insertions(+), 2 deletions(-)
1720

1821
diff --git a/ext/dom/tests/dom_xinclude.phpt b/ext/dom/tests/dom_xinclude.phpt
1922
index 0dfeb2dfb4a..410431de877 100644
@@ -32,6 +35,21 @@ index 0dfeb2dfb4a..410431de877 100644
3235
<title>The Pearl</title>
3336
<author>John Steinbeck</author>
3437
</book>
38+
diff --git a/ext/zip/tests/gh18431.phpt b/ext/zip/tests/gh18431.phpt
39+
index d4eb89c36c6..dcd7db6f400 100644
40+
--- a/ext/zip/tests/gh18431.phpt
41+
+++ b/ext/zip/tests/gh18431.phpt
42+
@@ -2,6 +2,10 @@
43+
GH-18431 (Registering ZIP progress callback twice doesn't work)
44+
--EXTENSIONS--
45+
zip
46+
+--SKIPIF--
47+
+<?php
48+
+if (!method_exists('ZipArchive', 'registerProgressCallback')) die('skip libzip too old');
49+
+?>
50+
--FILE--
51+
<?php
52+
$file = __DIR__ . '/gh18431.zip';
3553
diff --git a/ext/zip/tests/oo_addglob2.phpt b/ext/zip/tests/oo_addglob2.phpt
3654
index 517c0b7fd7f..1432d704de5 100644
3755
--- a/ext/zip/tests/oo_addglob2.phpt

patches/8.5/tests.patch

Lines changed: 20 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,14 +6,17 @@ Subject: Fix tests
66
example, php-src/php-build relative paths need to be adjusted.
77

88
- ext/zip
9-
When PHP is compiled and built agains libzip that doesn't have AES
9+
When PHP is compiled and built against libzip that doesn't have AES
1010
support enabled (if all encryption options are set to OFF in CMake),
1111
ZipArchive::EM_AES_256 and ZipArchive::EM_AES_192 aren't supported.
12+
ZipArchive::registerProgressCallback() is only available when using
13+
libzip 1.3.0 or newer.
1214
---
1315
ext/dom/tests/dom_xinclude.phpt | 4 ++--
16+
ext/zip/tests/gh18431.phpt | 4 ++++
1417
ext/zip/tests/oo_addglob2.phpt | 6 ++++++
1518
ext/zip/tests/oo_encryption.phpt | 6 ++++++
16-
3 files changed, 14 insertions(+), 2 deletions(-)
19+
4 files changed, 18 insertions(+), 2 deletions(-)
1720

1821
diff --git a/ext/dom/tests/dom_xinclude.phpt b/ext/dom/tests/dom_xinclude.phpt
1922
index 0dfeb2dfb4a..410431de877 100644
@@ -32,6 +35,21 @@ index 0dfeb2dfb4a..410431de877 100644
3235
<title>The Pearl</title>
3336
<author>John Steinbeck</author>
3437
</book>
38+
diff --git a/ext/zip/tests/gh18431.phpt b/ext/zip/tests/gh18431.phpt
39+
index d4eb89c36c6..dcd7db6f400 100644
40+
--- a/ext/zip/tests/gh18431.phpt
41+
+++ b/ext/zip/tests/gh18431.phpt
42+
@@ -2,6 +2,10 @@
43+
GH-18431 (Registering ZIP progress callback twice doesn't work)
44+
--EXTENSIONS--
45+
zip
46+
+--SKIPIF--
47+
+<?php
48+
+if (!method_exists('ZipArchive', 'registerProgressCallback')) die('skip libzip too old');
49+
+?>
50+
--FILE--
51+
<?php
52+
$file = __DIR__ . '/gh18431.zip';
3553
diff --git a/ext/zip/tests/oo_addglob2.phpt b/ext/zip/tests/oo_addglob2.phpt
3654
index 517c0b7fd7f..1432d704de5 100644
3755
--- a/ext/zip/tests/oo_addglob2.phpt

0 commit comments

Comments
 (0)