Commit graph

429 commits

Author SHA1 Message Date
Remi Collet
14f10ec761
Merge branch 'PHP-8.2' into PHP-8.3
* PHP-8.2:
  NEWS
  NEWS
  fix GH-12661 (Inconsistency in ZipArchive::addGlob remove_path Option Behavior)
2023-11-14 14:57:14 +01:00
Remi Collet
ddb887ffc8
Merge branch 'PHP-8.1' into PHP-8.2
* PHP-8.1:
  NEWS
  fix GH-12661 (Inconsistency in ZipArchive::addGlob remove_path Option Behavior)
2023-11-14 14:56:29 +01:00
Remi Collet
6625226074
fix GH-12661 (Inconsistency in ZipArchive::addGlob remove_path Option Behavior) 2023-11-14 14:54:20 +01:00
Remi Collet
b406f7c67a
zip extension version 1.22.1
- add ZipArchive::FL_OPEN_FILE_NOW to open the file when added
  instead of waiting for archive to be closed
2023-06-29 15:21:15 +02:00
Remi Collet
b5638a1202
zip extension version 1.22.0 for libzip 1.10.0
- add new error macros (ER_DATA_LENGTH and ER_NOT_ALLOWED)
- add new archive global flags (ER_AFL_*)
- add ZipArchive::setArchiveFlag and ZipArchive::getArchiveFlag methods

New methods are available since libzip 0.11,
but really usable with new global flags
2023-06-26 16:39:22 +02:00
Máté Kocsis
7936c8085e
Fix GH-8329 Print true/false instead of bool in error and debug messages (#8385) 2023-01-23 10:52:14 +01:00
Máté Kocsis
c153ec877f
Merge branch 'PHP-8.2'
* PHP-8.2:
  Improve string class constant code generation
2022-09-26 23:13:31 +02:00
Máté Kocsis
e4f2376919
Improve string class constant code generation (#9577)
Using strlen() will make sure that non-constant values can also be used.
2022-09-26 23:12:34 +02:00
Remi Collet
59894c7bf1
Merge branch 'PHP-8.2'
* PHP-8.2:
  zip version bump to 1.21.1
  remove LIBZIP_VERSION constant def from stub
2022-09-15 16:42:13 +02:00
Remi Collet
946cdb8ad1
remove LIBZIP_VERSION constant def from stub 2022-09-15 16:41:22 +02:00
Bob Weinand
a01dd9feda Revert "Port all internally used classes to use default_object_handlers"
This reverts commit 94ee4f9834.

The commit was a bit too late to be included in PHP 8.2 RC1. Given it's a massive ABI break, we decide to postpone the change to PHP 8.3.
2022-09-14 11:13:23 +02:00
Bob Weinand
94ee4f9834 Port all internally used classes to use default_object_handlers
Signed-off-by: Bob Weinand <bobwei9@hotmail.com>
2022-08-31 16:45:27 +02:00
Máté Kocsis
0c4c9fb93b
Declare et/zip constants in stubs (#9146) 2022-08-16 10:18:24 +02:00
Remi Collet
a46e87aa12
Merge branch 'PHP-8.1'
* PHP-8.1:
  NEWS
  NEWS
  Fix GH-8781 ZipArchive::close deletes zip file without updating stat cache
2022-06-15 15:39:39 +02:00
Remi Collet
c76374d26f
Merge branch 'PHP-8.0' into PHP-8.1
* PHP-8.0:
  NEWS
  Fix GH-8781 ZipArchive::close deletes zip file without updating stat cache
2022-06-15 15:39:00 +02:00
Remi Collet
390538af2e
Fix GH-8781 ZipArchive::close deletes zip file without updating stat cache 2022-06-15 15:37:27 +02:00
Pierrick Charron
1bcd8d394a
Update gen_stub to support #if around classes 2022-06-13 16:34:12 -04:00
Tim Düsterhus
1a4401d40a Mark parameter in ext/zip as sensitive 2022-06-13 11:09:12 +02:00
George Peter Banyard
2ecd46f48f
Initialise zend_stat_t to fix MSAN build 2022-05-22 16:06:27 +01:00
Dmitry Stogov
90b7bde615 Use more compact representation for packed arrays.
- for packed arrays we store just an array of zvals without keys.
- the elements of packed array are accessible throuf as ht->arPacked[i]
  instead of ht->arData[i]
- in addition to general ZEND_HASH_FOREACH_* macros, we introduced similar
  familied for packed (ZEND_HASH_PACKED_FORECH_*) and real hashes
  (ZEND_HASH_MAP_FOREACH_*)
- introduced an additional family of macros to access elements of array
  (packed or real hashes) ZEND_ARRAY_ELEMET_SIZE, ZEND_ARRAY_ELEMET_EX,
  ZEND_ARRAY_ELEMET, ZEND_ARRAY_NEXT_ELEMENT, ZEND_ARRAY_PREV_ELEMENT
- zend_hash_minmax() prototype was changed to compare only values

Because of smaller data set, this patch may show performance improvement
on some apps and benchmarks that use packed arrays. (~1% on PHP-Parser)

TODO:
    - sapi/phpdbg needs special support for packed arrays (WATCH_ON_BUCKET).
    - zend_hash_sort_ex() may require converting packed arrays to hash.
2021-11-03 15:18:26 +03:00
Nikita Popov
dc4cfb1ccb Don't accept flags in ZipArchive::getStream()
Per discussion on e489e2d388
this method should not accept $flags, so un-alias it from
getStreamName().
2021-10-12 09:29:08 +02:00
Remi Collet
e9b96ae5da
Add ZipArchive::clearError, getStreamIndex and getStreamName methods
public function clearError(): void {}
    public function getStreamIndex(int $index, int $flags = 0) {}
    public function getStreamName(string $name, int $flags = 0) {}

ZipArchive::getStream is kept for BC

See https://github.com/pierrejoye/php_zip/issues/20
2021-10-11 15:39:35 +02:00
Christoph M. Becker
9faa11d346
Merge branch 'PHP-8.0' into PHP-8.1
* PHP-8.0:
  Fix #77978: Dirname ending in colon unzips to wrong dir
2021-10-04 12:58:38 +02:00
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
80860baeb1
Merge branch 'PHP-8.0' into PHP-8.1
* PHP-8.0:
  Fix #81490: ZipArchive::extractTo() may leak memory
2021-09-30 15:45:16 +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
Dmitry Stogov
443b196033 Merge branch 'PHP-8.0' into PHP-8.1
* PHP-8.0:
  JIT x86: Fixed register clobbering in code produced for "$x[$y] %= $z".
  Fix #81420: ZipArchive::extractTo extracts outside of destination
2021-09-21 10:48:59 +03: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
d515979b34
Merge branch 'PHP-8.0' into PHP-8.1
* PHP-8.0:
  NEWS + bump zip version
  Fix #80833 ZipArchive::getStream doesn't use setPassword
2021-09-01 15:51:37 +02:00
Remi Collet
a6ffd8d1e9
Fix #80833 ZipArchive::getStream doesn't use setPassword 2021-09-01 15:49:46 +02:00
Nikita Popov
ca8247654c Merge branch 'PHP-8.0'
* PHP-8.0:
  Fix zip build
2021-05-07 22:42:50 +02:00
Nikita Popov
1c2e7b4ea0 Fix zip build 2021-05-07 22:42:31 +02:00
Christoph M. Becker
cc86f70de9
Merge branch 'PHP-8.0'
* PHP-8.0:
  Fix #80863: ZipArchive::extractTo() ignores references
2021-05-07 19:22:51 +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
KsaR
01b3fc03c3
Update http->https in license (#6945)
1. Update: http://www.php.net/license/3_01.txt to https, as there is anyway server header "Location:" to https.
2. Update few license 3.0 to 3.01 as 3.0 states "php 5.1.1, 4.1.1, and earlier".
3. In some license comments is "at through the world-wide-web" while most is without "at", so deleted.
4. fixed indentation in some files before |
2021-05-06 12:16:35 +02:00
Máté Kocsis
b567a9d173
Use typed properties in ext/zip
Closes GH-6881
2021-04-26 13:21:17 +02:00
Dmitry Stogov
13e4ce386b Improve SPL directory and stat() cache using zend_srting* instead of char* 2021-02-26 02:28:46 +03:00
Máté Kocsis
4c6533c257
Generate class entries from stubs for com, standard, xmlreader, xmlwriter, xsl, zip, Zend
Closes GH-6706
2021-02-22 15:24:03 +01: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
Nikita Popov
3e01f5afb1 Replace zend_bool uses with bool
We're starting to see a mix between uses of zend_bool and bool.
Replace all usages with the standard bool type everywhere.

Of course, zend_bool is retained as an alias.
2021-01-15 12:33:06 +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