php-internal-docs 8.4.8
Unofficial docs for php/php-src
Loading...
Searching...
No Matches
php_zip.h
Go to the documentation of this file.
1/*
2 +----------------------------------------------------------------------+
3 | Copyright (c) The PHP Group |
4 +----------------------------------------------------------------------+
5 | This source file is subject to version 3.01 of the PHP license, |
6 | that is bundled with this package in the file LICENSE, and is |
7 | available through the world-wide-web at the following url: |
8 | https://www.php.net/license/3_01.txt |
9 | If you did not receive a copy of the PHP license and are unable to |
10 | obtain it through the world-wide-web, please send a note to |
11 | license@php.net so we can mail you a copy immediately. |
12 +----------------------------------------------------------------------+
13 | Author: Pierre-Alain Joye <pajoye@php.net> |
14 +----------------------------------------------------------------------+
15*/
16
17
18#ifndef PHP_ZIP_H
19#define PHP_ZIP_H
20
22#define phpext_zip_ptr &zip_module_entry
23
24#ifdef ZTS
25#include "TSRM.h"
26#endif
27
28#include <zip.h>
29
30#ifndef ZIP_OVERWRITE
31#define ZIP_OVERWRITE ZIP_TRUNCATE
32#endif
33
34/* since 1.10.1 */
35#ifndef ZIP_LENGTH_TO_END
36#define ZIP_LENGTH_TO_END 0
37#endif
38
39/* Additionnal flags not from libzip */
40#define ZIP_FL_OPEN_FILE_NOW (1u<<30)
41
42#define PHP_ZIP_VERSION "1.22.6"
43
44#ifdef HAVE_LIBZIP_VERSION
45#define LIBZIP_VERSION_STR zip_libzip_version()
46#else
47#define LIBZIP_VERSION_STR LIBZIP_VERSION
48#endif
49
50#define ZIP_OPENBASEDIR_CHECKPATH(filename) php_check_open_basedir(filename)
51
52typedef struct _ze_zip_rsrc {
53 struct zip *za;
54 zip_uint64_t index_current;
55 zip_int64_t num_files;
57
59
60typedef struct _ze_zip_read_rsrc {
61 struct zip_file *zf;
62 struct zip_stat sb;
63 /* Used to check if the zip resource still exists,
64 * without holding a reference. This works because the IDs are unique. */
67
68/* Extends zend object */
69typedef struct _ze_zip_object {
70 struct zip *za;
71 char **buffers;
73 char *filename;
76 zip_int64_t last_id;
79#ifdef HAVE_PROGRESS_CALLBACK
80 zval progress_callback;
81#endif
82#ifdef HAVE_CANCEL_CALLBACK
83 zval cancel_callback;
84#endif
87
88static inline ze_zip_object *php_zip_fetch_object(zend_object *obj) {
89 return (ze_zip_object *)((char*)(obj) - XtOffsetOf(ze_zip_object, zo));
90}
91
92#define Z_ZIP_P(zv) php_zip_fetch_object(Z_OBJ_P((zv)))
93
94php_stream *php_stream_zip_opener(php_stream_wrapper *wrapper, const char *path, const char *mode, int options, zend_string **opened_path, php_stream_context *context STREAMS_DC);
95php_stream *php_stream_zip_open(struct zip *arch, struct zip_stat *sb, const char *mode, zip_flags_t flags STREAMS_DC);
96
98
99#define LIBZIP_ATLEAST(m,n,p) (((m<<16) + (n<<8) + p) <= ((LIBZIP_VERSION_MAJOR<<16) + (LIBZIP_VERSION_MINOR<<8) + LIBZIP_VERSION_MICRO))
100
101#endif /* PHP_ZIP_H */
char * mode
PHP_JSON_API size_t int options
Definition php_json.h:102
struct _php_stream php_stream
Definition php_streams.h:96
struct _php_stream_context php_stream_context
Definition php_streams.h:98
#define STREAMS_DC
Definition php_streams.h:53
struct _php_stream_wrapper php_stream_wrapper
Definition php_streams.h:97
zend_module_entry zip_module_entry
Definition php_zip.c:1160
struct _ze_zip_object ze_zip_object
php_stream * php_stream_zip_open(struct zip *arch, struct zip_stat *sb, const char *mode, zip_flags_t flags STREAMS_DC)
zip_rsrc * zip_rsrc_ptr
Definition php_zip.h:58
struct _ze_zip_rsrc zip_rsrc
struct _ze_zip_read_rsrc zip_read_rsrc
php_stream * php_stream_zip_opener(php_stream_wrapper *wrapper, const char *path, const char *mode, int options, zend_string **opened_path, php_stream_context *context STREAMS_DC)
const php_stream_wrapper php_stream_zip_wrapper
zip_int64_t last_id
Definition php_zip.h:76
int buffers_cnt
Definition php_zip.h:75
struct zip * za
Definition php_zip.h:70
char ** buffers
Definition php_zip.h:71
zend_object zo
Definition php_zip.h:85
int filename_len
Definition php_zip.h:74
char * filename
Definition php_zip.h:73
HashTable * prop_handler
Definition php_zip.h:72
struct zip_stat sb
Definition php_zip.h:62
zend_long zip_rsrc_handle
Definition php_zip.h:65
struct zip_file * zf
Definition php_zip.h:61
struct zip * za
Definition php_zip.h:53
zip_int64_t num_files
Definition php_zip.h:55
zip_uint64_t index_current
Definition php_zip.h:54
Definition dce.c:49
struct _zval_struct zval
int32_t zend_long
Definition zend_long.h:42
struct _zend_string zend_string
struct _zend_module_entry zend_module_entry
#define XtOffsetOf(s_type, field)
struct _zend_object zend_object
struct _zend_array HashTable
Definition zend_types.h:386