1
0
mirror of https://github.com/php/php-src.git synced 2026-04-21 15:08:16 +02:00
Commit Graph

396 Commits

Author SHA1 Message Date
Christoph M. Becker 57a32c6a69 Merge branch 'PHP-7.4' into PHP-8.0
* PHP-7.4:
  Fix #77978: Dirname ending in colon unzips to wrong dir
2021-10-04 12:57:01 +02:00
Christoph M. Becker e0c0de003b Fix #77978: Dirname ending in colon unzips to wrong dir
When making the relative path, we must not stop on a `:\` sequence in
the middle of the filename.  This is only significant on Windows as it
may indicate an absolute filename, but this is already checked at the
beginning of the function.

Note that the bug and this patch affects all systems.  However, on
Windows the file is no longer extracted at all, since Windows NTSF does
not allow filenames containing colons.

Closes GH-7528.
2021-10-04 12:55:34 +02:00
Christoph M. Becker 5db6e35843 Merge branch 'PHP-7.4' into PHP-8.0
* PHP-7.4:
  Fix #81490: ZipArchive::extractTo() may leak memory
2021-09-30 15:42:40 +02:00
Christoph M. Becker 4d44271415 Fix #81490: ZipArchive::extractTo() may leak memory
We always need to free the CWD state.

Closes GH-7536.
2021-09-30 15:41:05 +02:00
Stanislav Malyshev cebff25d27 Merge branch 'PHP-7.4' into PHP-8.0
* PHP-7.4:
  Fix #81420: ZipArchive::extractTo extracts outside of destination
2021-09-20 21:35:43 -07:00
Stanislav Malyshev f92bae23ce Merge branch 'PHP-7.3' into PHP-7.4
* PHP-7.3:
  Fix #81420: ZipArchive::extractTo extracts outside of destination
2021-09-20 21:34:57 -07:00
Christoph M. Becker df2ceac25a Fix #81420: ZipArchive::extractTo extracts outside of destination
We need to properly detect and handle absolute paths in a portable way.
2021-09-20 21:29:24 -07:00
Remi Collet a6ffd8d1e9 Fix #80833 ZipArchive::getStream doesn't use setPassword 2021-09-01 15:49:46 +02:00
Nikita Popov 1c2e7b4ea0 Fix zip build 2021-05-07 22:42:31 +02:00
Christoph M. Becker ab3052ab26 Merge branch 'PHP-7.4' into PHP-8.0
* PHP-7.4:
  Fix #80863: ZipArchive::extractTo() ignores references
2021-05-07 19:21:58 +02:00
Christoph M. Becker 57918b1a1b Fix #80863: ZipArchive::extractTo() ignores references
We need to cater to references, when traversing the files to extract.
While we're at it, we move the `zval_file` declaration into a narrower
scope.

Closes GH-6959.
2021-05-07 19:15:29 +02:00
Christoph M. Becker 6adfb8c962 Fix #80648: Fix for bug 79296 should be based on runtime version
Instead of checking for actually affected libzip versions, we now always
`ZIP_TRUNCATE` empty files unless `ZIP_RDONLY` is set.

Closes GH-6625.
2021-01-20 16:20:13 +01:00
Christoph M. Becker e470f9b389 ZipArchive methods do not return NULL
Closes GH-6563.
2021-01-03 16:12:10 +01:00
Christoph M. Becker d65a520b1d Raise E_WARNING on PHP related errors
If Zip operations fails due to PHP error conditions before libzip even
has been called, there is no meaningful indication what failed; the
functions just return false, and the Zip status indicated that no error
did occur.  Therefore we raise `E_WARNING` in these cases.

Closes GH-6356.
2020-11-06 11:00:43 +01:00
Remi Collet e2509cf98a report about ZSTD compression availability 2020-11-06 09:58:08 +01:00
Remi Collet 8d7ca472e5 only display libzip both headers/library versions if they differ 2020-11-06 09:58:05 +01:00
Máté Kocsis c98d47696f Consolidate new union type ZPP macro names
They will now follow the canonical order of types. Older macros are
left intact due to maintaining BC.

Closes GH-6112
2020-09-11 11:00:18 +02:00
Máté Kocsis 3e800e997b Move custom type checks to ZPP
Closes GH-6034
2020-09-02 11:11:38 +02:00
George Peter Banyard fa8d9b1183 Improve type declarations for Zend APIs
Voidification of Zend API which always succeeded
Use bool argument types instead of int for boolean arguments
Use bool return type for functions which return true/false (1/0)
Use zend_result return type for functions which return SUCCESS/FAILURE as they don't follow normal boolean semantics

Closes GH-6002
2020-08-28 15:41:27 +02:00
George Peter Banyard 72383ccabb Promote warnings in ext/zip 2020-08-17 15:52:20 +02:00
Nikita Popov 84a080ef50 Avoid getThis() usages in zip extension
There isn't any magic going on here, we can just use ZEND_THIS
and assume it exists.
2020-08-06 11:28:35 +02:00
Remi Collet 42226fcf03 add ZipArchive::CM_XZ constant (in upcoming libzip 1.8.0) 2020-07-21 14:43:52 +02:00
George Peter Banyard 06da048622 Use HashTable directly instead of zval 2020-07-08 16:25:49 +02:00
Max Semenik 2b5de6f839 Remove proto comments from C files
Closes GH-5758
2020-07-06 21:13:34 +02:00
Nikita Popov 0280b83e11 Avoid some unnecessary uses of no_separation=0
For the rare cases where references are part of the API,
construct them explicitly. Otherwise do not allow separation.
2020-07-06 19:05:57 +02:00
Remi Collet cd3f42f17e [skip ci] typo 2020-06-08 08:02:48 +02:00
Remi Collet 06ff0e8721 move comment 2020-06-07 08:16:50 +02:00
Remi Collet a3bfd4a108 Fixed bug #79678 Build fails due to undeclared ZIP_RDONLY 2020-06-07 07:53:26 +02:00
Máté Kocsis 86d58e9fff Generate function entries for ext/zip
Closes GH-5601
2020-05-20 14:22:11 +02:00
George Peter Banyard 5f0128e1e0 Fix [-Wundef] warning in ZIP extension 2020-05-18 00:37:18 +02:00
Máté Kocsis bce8c8fb27 Promote warning to exception in ZipArchive::extractTo()
Closes GH-5516
2020-05-06 19:22:52 +02:00
Máté Kocsis daa5b26456 Fix UNKNOWN default values in ext/zip 2020-05-06 19:15:34 +02:00
Máté Kocsis 78dda268eb Fix ZPP order in ext/zip 2020-05-06 19:14:36 +02:00
Remi Collet 2dc8d39bae - add ZipArchive::EM_UNKNOWN constant - add ZipArchive::EM_TRAD_PKWARE constant - cleanup hack for libzip 1.3.1 (have only exist for a few days) - add ZipArchive::isCompressionMethodSupported() method (libzip 1.7.0) - add ZipArchive::isEncryptionMethodSupported() method (libzip 1.7.0) - bump version to 1.19.0-dev 2020-04-02 14:52:05 +02:00
Remi Collet 59e0674185 use a better setter for zip_error_t 2020-04-02 12:26:44 +02:00
Remi Collet 5fa17fbf94 Merge branch 'PHP-7.4'
* PHP-7.4:
  NEWS
  Fix #79424 ext/zip: don't use gl_pathc after call to globfree
2020-03-29 14:24:12 +02:00
Remi Collet 2292ef93d5 Merge branch 'PHP-7.3' into PHP-7.4
* PHP-7.3:
  Fix #79424 ext/zip: don't use gl_pathc after call to globfree
2020-03-29 14:23:03 +02:00
Max Rees 04920645f1 Fix #79424 ext/zip: don't use gl_pathc after call to globfree
This breaks on Linux with the musl libc, since it zeroes out gl_pathc during
globfree.
2020-03-29 14:22:31 +02:00
Remi Collet a4d12f46d1 ZipArchive::open(): Using empty file as ZipArchive is deprecated 2020-03-20 11:27:42 +01:00
Remi Collet 217ff8132e Merge branch 'PHP-7.4'
* PHP-7.4:
  unneeded after fix
  NEWS
  NEWS
  Fix Bug #79296 ZipArchive::open fails on empty file
2020-03-20 11:19:04 +01:00
Remi Collet 98687abb1d Merge branch 'PHP-7.3' into PHP-7.4
* PHP-7.3:
  NEWS
  Fix Bug #79296 ZipArchive::open fails on empty file
2020-03-20 11:16:38 +01:00
Remi Collet 8aab43c85d Fix Bug #79296 ZipArchive::open fails on empty file 2020-03-20 11:14:58 +01:00
Remi Collet 3b22e10535 Fix bug #77960 add compr. /encr. options for ZipArchive::addGlob and ZipArchive::addPattern
options parameter now accepts:
- comp_method
- comp_flags
- enc_method
- enc_password
2020-03-18 14:05:09 +01:00
Remi Collet f5c1359f57 proper fix 2020-03-09 09:29:34 +01:00
Remi Collet ef42a7afa5 fix use after free 2020-03-09 09:19:57 +01:00
Remi Collet ed998f8a0d Fix #50678 files extracted by ZipArchive class lost their original modified time 2020-03-09 07:09:50 +01:00
Remi Collet be14d4e135 better fix for #72374 2020-03-06 10:27:29 +01:00
Remi Collet 541eeace59 drop old constant with bad name, kept until now for BC 2020-03-05 13:46:34 +01:00
Remi Collet 6f53605275 - make status, statusSys properties and
ZipArchive::getStatusString() method   available after archive is closed
2020-03-05 10:57:26 +01:00
Remi Collet 0b21a89472 add lastId property to ZipArchive 2020-03-04 15:31:06 +01:00