php-internal-docs 8.4.8
Unofficial docs for php/php-src
Loading...
Searching...
No Matches
php_zip.c File Reference
#include "php.h"
#include "ext/standard/info.h"
#include "ext/standard/file.h"
#include "ext/standard/php_string.h"
#include "ext/pcre/php_pcre.h"
#include "ext/standard/php_filestat.h"
#include "zend_attributes.h"
#include "zend_interfaces.h"
#include "php_zip.h"
#include "php_zip_arginfo.h"

Go to the source code of this file.

Data Structures

struct  zip_options
 
struct  _zip_prop_handler
 

Macros

#define le_zip_dir_name   "Zip Directory"
 
#define le_zip_entry_name   "Zip Entry"
 
#define PHP_ZIP_STAT_INDEX(za, index, flags, sb)
 
#define PHP_ZIP_STAT_PATH(za, path, path_len, flags, sb)
 
#define PHP_ZIP_SET_FILE_COMMENT(za, index, comment, comment_len)
 
#define add_ascii_assoc_string   add_assoc_string
 
#define add_ascii_assoc_long   add_assoc_long
 
#define CWD_STATE_ALLOC(l)
 
#define CWD_STATE_FREE(s)
 
#define ZIP_FROM_OBJECT(intern, object)
 
#define RETURN_SB(sb)
 

Typedefs

typedef zend_long(* zip_read_int_t) (ze_zip_object *obj)
 
typedef char *(* zip_read_const_char_t) (ze_zip_object *obj, int *len)
 
typedef struct _zip_prop_handler zip_prop_handler
 

Functions

int php_zip_glob (char *pattern, int pattern_len, zend_long flags, zval *return_value)
 
int php_zip_pcre (zend_string *regexp, char *path, int path_len, zval *return_value)
 
 PHP_FUNCTION (zip_open)
 
 PHP_FUNCTION (zip_close)
 
 PHP_FUNCTION (zip_read)
 
 PHP_FUNCTION (zip_entry_open)
 
 PHP_FUNCTION (zip_entry_close)
 
 PHP_FUNCTION (zip_entry_read)
 
 PHP_FUNCTION (zip_entry_name)
 
 PHP_FUNCTION (zip_entry_compressedsize)
 
 PHP_FUNCTION (zip_entry_filesize)
 
 PHP_FUNCTION (zip_entry_compressionmethod)
 
 PHP_METHOD (ZipArchive, open)
 
 PHP_METHOD (ZipArchive, setPassword)
 
 PHP_METHOD (ZipArchive, close)
 
 PHP_METHOD (ZipArchive, count)
 
 PHP_METHOD (ZipArchive, clearError)
 
 PHP_METHOD (ZipArchive, getStatusString)
 
 PHP_METHOD (ZipArchive, addEmptyDir)
 
 PHP_METHOD (ZipArchive, addGlob)
 
 PHP_METHOD (ZipArchive, addPattern)
 
 PHP_METHOD (ZipArchive, addFile)
 
 PHP_METHOD (ZipArchive, replaceFile)
 
 PHP_METHOD (ZipArchive, addFromString)
 
 PHP_METHOD (ZipArchive, statName)
 
 PHP_METHOD (ZipArchive, statIndex)
 
 PHP_METHOD (ZipArchive, locateName)
 
 PHP_METHOD (ZipArchive, getNameIndex)
 
 PHP_METHOD (ZipArchive, setArchiveComment)
 
 PHP_METHOD (ZipArchive, getArchiveComment)
 
 PHP_METHOD (ZipArchive, setArchiveFlag)
 
 PHP_METHOD (ZipArchive, getArchiveFlag)
 
 PHP_METHOD (ZipArchive, setCommentName)
 
 PHP_METHOD (ZipArchive, setCommentIndex)
 
 PHP_METHOD (ZipArchive, getCommentName)
 
 PHP_METHOD (ZipArchive, getCommentIndex)
 
 PHP_METHOD (ZipArchive, setCompressionName)
 
 PHP_METHOD (ZipArchive, setCompressionIndex)
 
 PHP_METHOD (ZipArchive, deleteIndex)
 
 PHP_METHOD (ZipArchive, deleteName)
 
 PHP_METHOD (ZipArchive, renameIndex)
 
 PHP_METHOD (ZipArchive, renameName)
 
 PHP_METHOD (ZipArchive, unchangeIndex)
 
 PHP_METHOD (ZipArchive, unchangeName)
 
 PHP_METHOD (ZipArchive, unchangeAll)
 
 PHP_METHOD (ZipArchive, unchangeArchive)
 
 PHP_METHOD (ZipArchive, extractTo)
 
 PHP_METHOD (ZipArchive, getFromName)
 
 PHP_METHOD (ZipArchive, getFromIndex)
 
 PHP_METHOD (ZipArchive, getStreamName)
 
 PHP_METHOD (ZipArchive, getStreamIndex)
 
 PHP_METHOD (ZipArchive, getStream)
 

Variables

zend_module_entry zip_module_entry
 

Macro Definition Documentation

◆ add_ascii_assoc_long

#define add_ascii_assoc_long   add_assoc_long

Definition at line 81 of file php_zip.c.

◆ add_ascii_assoc_string

#define add_ascii_assoc_string   add_assoc_string

Definition at line 80 of file php_zip.c.

◆ CWD_STATE_ALLOC

#define CWD_STATE_ALLOC ( l)
Value:
#define emalloc(size)
Definition zend_alloc.h:151

Definition at line 120 of file php_zip.c.

◆ CWD_STATE_FREE

#define CWD_STATE_FREE ( s)
Value:
char s[4]
Definition cdf.c:77
#define efree(ptr)
Definition zend_alloc.h:155

Definition at line 121 of file php_zip.c.

◆ le_zip_dir_name

#define le_zip_dir_name   "Zip Directory"

Definition at line 43 of file php_zip.c.

◆ le_zip_entry_name

#define le_zip_entry_name   "Zip Entry"

Definition at line 45 of file php_zip.c.

◆ PHP_ZIP_SET_FILE_COMMENT

#define PHP_ZIP_SET_FILE_COMMENT ( za,
index,
comment,
comment_len )
Value:
if (comment_len == 0) { \
/* Passing NULL remove the existing comment */ \
if (zip_file_set_comment(za, index, NULL, 0, 0) < 0) { \
} \
} else if (zip_file_set_comment(za, index, comment, comment_len, 0) < 0) { \
} \
#define NULL
Definition gdcache.h:45
#define RETURN_FALSE
Definition zend_API.h:1058
#define RETURN_TRUE
Definition zend_API.h:1059

Definition at line 68 of file php_zip.c.

◆ PHP_ZIP_STAT_INDEX

#define PHP_ZIP_STAT_INDEX ( za,
index,
flags,
sb )
Value:
if (zip_stat_index(za, index, flags, &sb) != 0) { \
}

Definition at line 49 of file php_zip.c.

◆ PHP_ZIP_STAT_PATH

#define PHP_ZIP_STAT_PATH ( za,
path,
path_len,
flags,
sb )
Value:
if (path_len == 0) { \
zend_argument_must_not_be_empty_error(1); \
RETURN_THROWS(); \
} \
if (zip_stat(za, path, flags, &sb) != 0) { \
}

Definition at line 57 of file php_zip.c.

◆ RETURN_SB

#define RETURN_SB ( sb)
Value:
{ \
array_init(return_value); \
add_ascii_assoc_string(return_value, "name", (char *)(sb)->name); \
add_ascii_assoc_long(return_value, "index", (zend_long) (sb)->index); \
add_ascii_assoc_long(return_value, "crc", (zend_long) (sb)->crc); \
add_ascii_assoc_long(return_value, "size", (zend_long) (sb)->size); \
add_ascii_assoc_long(return_value, "mtime", (zend_long) (sb)->mtime); \
add_ascii_assoc_long(return_value, "comp_size", (zend_long) (sb)->comp_size); \
add_ascii_assoc_long(return_value, "comp_method", (zend_long) (sb)->comp_method); \
}
new_type size
Definition ffi.c:4365
int32_t zend_long
Definition zend_long.h:42
zval * return_value
zend_string * name

Definition at line 492 of file php_zip.c.

◆ ZIP_FROM_OBJECT

#define ZIP_FROM_OBJECT ( intern,
object )
Value:
{ \
ze_zip_object *obj = Z_ZIP_P(object); \
intern = obj->za; \
if (!intern) { \
zend_value_error("Invalid or uninitialized Zip object"); \
RETURN_THROWS(); \
} \
}
struct _ze_zip_object ze_zip_object
#define Z_ZIP_P(zv)
Definition php_zip.h:92
struct zip * za
Definition php_zip.h:70

Definition at line 466 of file php_zip.c.

Typedef Documentation

◆ zip_prop_handler

◆ zip_read_const_char_t

typedef char *(* zip_read_const_char_t) (ze_zip_object *obj, int *len)

Definition at line 835 of file php_zip.c.

◆ zip_read_int_t

typedef zend_long(* zip_read_int_t) (ze_zip_object *obj)

Definition at line 834 of file php_zip.c.

Function Documentation

◆ PHP_FUNCTION() [1/10]

PHP_FUNCTION ( zip_close )

Definition at line 1222 of file php_zip.c.

◆ PHP_FUNCTION() [2/10]

PHP_FUNCTION ( zip_entry_close )

Definition at line 1318 of file php_zip.c.

◆ PHP_FUNCTION() [3/10]

PHP_FUNCTION ( zip_entry_compressedsize )

Definition at line 1437 of file php_zip.c.

◆ PHP_FUNCTION() [4/10]

PHP_FUNCTION ( zip_entry_compressionmethod )

Definition at line 1451 of file php_zip.c.

◆ PHP_FUNCTION() [5/10]

PHP_FUNCTION ( zip_entry_filesize )

Definition at line 1444 of file php_zip.c.

◆ PHP_FUNCTION() [6/10]

PHP_FUNCTION ( zip_entry_name )

Definition at line 1430 of file php_zip.c.

◆ PHP_FUNCTION() [7/10]

PHP_FUNCTION ( zip_entry_open )

Definition at line 1288 of file php_zip.c.

◆ PHP_FUNCTION() [8/10]

PHP_FUNCTION ( zip_entry_read )

Definition at line 1337 of file php_zip.c.

◆ PHP_FUNCTION() [9/10]

PHP_FUNCTION ( zip_open )

Definition at line 1181 of file php_zip.c.

◆ PHP_FUNCTION() [10/10]

PHP_FUNCTION ( zip_read )

Definition at line 1241 of file php_zip.c.

◆ PHP_METHOD() [1/40]

PHP_METHOD ( ZipArchive ,
addEmptyDir  )

Definition at line 1696 of file php_zip.c.

◆ PHP_METHOD() [2/40]

PHP_METHOD ( ZipArchive ,
addFile  )

Definition at line 1873 of file php_zip.c.

◆ PHP_METHOD() [3/40]

PHP_METHOD ( ZipArchive ,
addFromString  )

Definition at line 1940 of file php_zip.c.

◆ PHP_METHOD() [4/40]

PHP_METHOD ( ZipArchive ,
addGlob  )

Definition at line 1859 of file php_zip.c.

◆ PHP_METHOD() [5/40]

PHP_METHOD ( ZipArchive ,
addPattern  )

Definition at line 1866 of file php_zip.c.

◆ PHP_METHOD() [6/40]

PHP_METHOD ( ZipArchive ,
clearError  )

Definition at line 1633 of file php_zip.c.

◆ PHP_METHOD() [7/40]

PHP_METHOD ( ZipArchive ,
close  )

Definition at line 1561 of file php_zip.c.

◆ PHP_METHOD() [8/40]

PHP_METHOD ( ZipArchive ,
count  )

Definition at line 1615 of file php_zip.c.

◆ PHP_METHOD() [9/40]

PHP_METHOD ( ZipArchive ,
deleteIndex  )

Definition at line 2600 of file php_zip.c.

◆ PHP_METHOD() [10/40]

PHP_METHOD ( ZipArchive ,
deleteName  )

Definition at line 2625 of file php_zip.c.

◆ PHP_METHOD() [11/40]

PHP_METHOD ( ZipArchive ,
extractTo  )

Definition at line 2813 of file php_zip.c.

◆ PHP_METHOD() [12/40]

PHP_METHOD ( ZipArchive ,
getArchiveComment  )

Definition at line 2114 of file php_zip.c.

◆ PHP_METHOD() [13/40]

PHP_METHOD ( ZipArchive ,
getArchiveFlag  )

Definition at line 2155 of file php_zip.c.

◆ PHP_METHOD() [14/40]

PHP_METHOD ( ZipArchive ,
getCommentIndex  )

Definition at line 2457 of file php_zip.c.

◆ PHP_METHOD() [15/40]

PHP_METHOD ( ZipArchive ,
getCommentName  )

Definition at line 2422 of file php_zip.c.

◆ PHP_METHOD() [16/40]

PHP_METHOD ( ZipArchive ,
getFromIndex  )

Definition at line 2965 of file php_zip.c.

◆ PHP_METHOD() [17/40]

PHP_METHOD ( ZipArchive ,
getFromName  )

Definition at line 2958 of file php_zip.c.

◆ PHP_METHOD() [18/40]

PHP_METHOD ( ZipArchive ,
getNameIndex  )

Definition at line 2062 of file php_zip.c.

◆ PHP_METHOD() [19/40]

PHP_METHOD ( ZipArchive ,
getStatusString  )

Definition at line 1653 of file php_zip.c.

◆ PHP_METHOD() [20/40]

PHP_METHOD ( ZipArchive ,
getStream  )

Definition at line 3029 of file php_zip.c.

◆ PHP_METHOD() [21/40]

PHP_METHOD ( ZipArchive ,
getStreamIndex  )

Definition at line 3023 of file php_zip.c.

◆ PHP_METHOD() [22/40]

PHP_METHOD ( ZipArchive ,
getStreamName  )

Definition at line 3016 of file php_zip.c.

◆ PHP_METHOD() [23/40]

PHP_METHOD ( ZipArchive ,
locateName  )

Definition at line 2033 of file php_zip.c.

◆ PHP_METHOD() [24/40]

PHP_METHOD ( ZipArchive ,
open  )

Definition at line 1458 of file php_zip.c.

◆ PHP_METHOD() [25/40]

PHP_METHOD ( ZipArchive ,
renameIndex  )

Definition at line 2652 of file php_zip.c.

◆ PHP_METHOD() [26/40]

PHP_METHOD ( ZipArchive ,
renameName  )

Definition at line 2684 of file php_zip.c.

◆ PHP_METHOD() [27/40]

PHP_METHOD ( ZipArchive ,
replaceFile  )

Definition at line 1907 of file php_zip.c.

◆ PHP_METHOD() [28/40]

PHP_METHOD ( ZipArchive ,
setArchiveComment  )

Definition at line 2087 of file php_zip.c.

◆ PHP_METHOD() [29/40]

PHP_METHOD ( ZipArchive ,
setArchiveFlag  )

Definition at line 2136 of file php_zip.c.

◆ PHP_METHOD() [30/40]

PHP_METHOD ( ZipArchive ,
setCommentIndex  )

Definition at line 2205 of file php_zip.c.

◆ PHP_METHOD() [31/40]

PHP_METHOD ( ZipArchive ,
setCommentName  )

Definition at line 2171 of file php_zip.c.

◆ PHP_METHOD() [32/40]

PHP_METHOD ( ZipArchive ,
setCompressionIndex  )

Definition at line 2516 of file php_zip.c.

◆ PHP_METHOD() [33/40]

PHP_METHOD ( ZipArchive ,
setCompressionName  )

Definition at line 2480 of file php_zip.c.

◆ PHP_METHOD() [34/40]

PHP_METHOD ( ZipArchive ,
setPassword  )

Definition at line 1534 of file php_zip.c.

◆ PHP_METHOD() [35/40]

PHP_METHOD ( ZipArchive ,
statIndex  )

Definition at line 2010 of file php_zip.c.

◆ PHP_METHOD() [36/40]

PHP_METHOD ( ZipArchive ,
statName  )

Definition at line 1989 of file php_zip.c.

◆ PHP_METHOD() [37/40]

PHP_METHOD ( ZipArchive ,
unchangeAll  )

Definition at line 2768 of file php_zip.c.

◆ PHP_METHOD() [38/40]

PHP_METHOD ( ZipArchive ,
unchangeArchive  )

Definition at line 2788 of file php_zip.c.

◆ PHP_METHOD() [39/40]

PHP_METHOD ( ZipArchive ,
unchangeIndex  )

Definition at line 2714 of file php_zip.c.

◆ PHP_METHOD() [40/40]

PHP_METHOD ( ZipArchive ,
unchangeName  )

Definition at line 2739 of file php_zip.c.

◆ php_zip_glob()

int php_zip_glob ( char * pattern,
int pattern_len,
zend_long flags,
zval * return_value )

Definition at line 615 of file php_zip.c.

◆ php_zip_pcre()

int php_zip_pcre ( zend_string * regexp,
char * path,
int path_len,
zval * return_value )

Definition at line 722 of file php_zip.c.

Variable Documentation

◆ zip_module_entry

zend_module_entry zip_module_entry
Initial value:
= {
zip_deps,
"zip",
ext_functions,
PHP_MINIT(zip),
PHP_MINFO(zip),
}
#define PHP_MINFO
Definition php.h:396
#define PHP_MSHUTDOWN
Definition php.h:393
#define PHP_MINIT
Definition php.h:392
#define PHP_ZIP_VERSION
Definition php_zip.h:42
#define STANDARD_MODULE_PROPERTIES
#define STANDARD_MODULE_HEADER_EX

Definition at line 1160 of file php_zip.c.