Skip to content

Commit a979e9f

Browse files
committed
ext/zip: lifting libzip minimum support.
0.11 dates back from 2013 whereas 1.0.0 is from 2015. Thus, simplifying the extension removing unlikely old api code usage. centos 7 can always uses an alternative repository (e.g. remi's); solaris 10 can access the 1.5.2 release via OpenCSW. close phpGH-20355
1 parent 82249dc commit a979e9f

File tree

3 files changed

+9
-46
lines changed

3 files changed

+9
-46
lines changed

NEWS

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,5 +36,7 @@ PHP NEWS
3636
- Zip:
3737
. Fixed ZipArchive callback being called after executor has shut down.
3838
(ilutov)
39+
. Support minimum version for libzip dependency updated to 1.0.0.
40+
(David Carlier)
3941

4042
<<< NOTE: Insert NEWS from last stable release here prior to actual release! >>>

ext/zip/config.m4

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -4,18 +4,11 @@ PHP_ARG_WITH([zip],
44
[Include Zip read/write support])])
55

66
if test "$PHP_ZIP" != "no"; then
7-
PKG_CHECK_MODULES([LIBZIP], [libzip >= 0.11 libzip != 1.3.1 libzip != 1.7.0])
7+
PKG_CHECK_MODULES([LIBZIP], [libzip >= 1.0.0 libzip != 1.3.1 libzip != 1.7.0])
88

99
PHP_EVAL_INCLINE([$LIBZIP_CFLAGS])
1010
PHP_EVAL_LIBLINE([$LIBZIP_LIBS], [ZIP_SHARED_LIBADD])
1111

12-
PHP_CHECK_LIBRARY([zip], [zip_file_set_mtime],
13-
[AC_DEFINE([HAVE_SET_MTIME], [1],
14-
[Define to 1 if libzip library has the 'zip_file_set_mtime' function
15-
(available since 1.0.0).])],
16-
[AC_MSG_WARN([Libzip >= 1.0.0 needed for setting mtime])],
17-
[$LIBZIP_LIBS])
18-
1912
PHP_CHECK_LIBRARY([zip], [zip_file_set_encryption],
2013
[AC_DEFINE([HAVE_ENCRYPTION], [1],
2114
[Define to 1 if libzip library has encryption support (available since

ext/zip/php_zip.c

Lines changed: 6 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -496,17 +496,11 @@ static zend_long php_zip_status(ze_zip_object *obj) /* {{{ */
496496
int zep = obj->err_zip; /* saved err if closed */
497497

498498
if (obj->za) {
499-
#if LIBZIP_VERSION_MAJOR < 1
500-
int syp;
501-
502-
zip_error_get(obj->za, &zep, &syp);
503-
#else
504499
zip_error_t *err;
505500

506501
err = zip_get_error(obj->za);
507502
zep = zip_error_code_zip(err);
508503
zip_error_fini(err);
509-
#endif
510504
}
511505
return zep;
512506
}
@@ -523,17 +517,11 @@ static zend_long php_zip_status_sys(ze_zip_object *obj) /* {{{ */
523517
int syp = obj->err_sys; /* saved err if closed */
524518

525519
if (obj->za) {
526-
#if LIBZIP_VERSION_MAJOR < 1
527-
int zep;
528-
529-
zip_error_get(obj->za, &zep, &syp);
530-
#else
531520
zip_error_t *err;
532521

533522
err = zip_get_error(obj->za);
534523
syp = zip_error_code_system(err);
535524
zip_error_fini(err);
536-
#endif
537525
}
538526
return syp;
539527
}
@@ -1529,18 +1517,12 @@ PHP_METHOD(ZipArchive, close)
15291517
if (err) {
15301518
php_error_docref(NULL, E_WARNING, "%s", zip_strerror(intern));
15311519
/* Save error for property reader */
1532-
#if LIBZIP_VERSION_MAJOR < 1
1533-
zip_error_get(intern, &ze_obj->err_zip, &ze_obj->err_sys);
1534-
#else
1535-
{
1536-
zip_error_t *ziperr;
1537-
1538-
ziperr = zip_get_error(intern);
1539-
ze_obj->err_zip = zip_error_code_zip(ziperr);
1540-
ze_obj->err_sys = zip_error_code_system(ziperr);
1541-
zip_error_fini(ziperr);
1542-
}
1543-
#endif
1520+
zip_error_t *ziperr;
1521+
1522+
ziperr = zip_get_error(intern);
1523+
ze_obj->err_zip = zip_error_code_zip(ziperr);
1524+
ze_obj->err_sys = zip_error_code_system(ziperr);
1525+
zip_error_fini(ziperr);
15441526
zip_discard(intern);
15451527
} else {
15461528
ze_obj->err_zip = 0;
@@ -1601,10 +1583,6 @@ PHP_METHOD(ZipArchive, clearError)
16011583
PHP_METHOD(ZipArchive, getStatusString)
16021584
{
16031585
zval *self = ZEND_THIS;
1604-
#if LIBZIP_VERSION_MAJOR < 1
1605-
int zep, syp, len;
1606-
char error_string[128];
1607-
#endif
16081586
ze_zip_object *ze_obj;
16091587

16101588
if (zend_parse_parameters_none() == FAILURE) {
@@ -1613,15 +1591,6 @@ PHP_METHOD(ZipArchive, getStatusString)
16131591

16141592
ze_obj = Z_ZIP_P(self); /* not ZIP_FROM_OBJECT as we can use saved error after close */
16151593

1616-
#if LIBZIP_VERSION_MAJOR < 1
1617-
if (ze_obj->za) {
1618-
zip_error_get(ze_obj->za, &zep, &syp);
1619-
len = zip_error_to_str(error_string, 128, zep, syp);
1620-
} else {
1621-
len = zip_error_to_str(error_string, 128, ze_obj->err_zip, ze_obj->err_sys);
1622-
}
1623-
RETVAL_STRINGL(error_string, len);
1624-
#else
16251594
if (ze_obj->za) {
16261595
zip_error_t *err;
16271596

@@ -1636,7 +1605,6 @@ PHP_METHOD(ZipArchive, getStatusString)
16361605
RETVAL_STRING(zip_error_strerror(&err));
16371606
zip_error_fini(&err);
16381607
}
1639-
#endif
16401608
}
16411609
/* }}} */
16421610

0 commit comments

Comments
 (0)