summaryrefslogtreecommitdiff
path: root/ext/phar
diff options
context:
space:
mode:
Diffstat (limited to 'ext/phar')
-rw-r--r--ext/phar/dirstream.c118
-rw-r--r--ext/phar/dirstream.h18
-rw-r--r--ext/phar/func_interceptors.c110
-rw-r--r--ext/phar/func_interceptors.h12
-rw-r--r--ext/phar/phar.c287
-rw-r--r--ext/phar/phar_internal.h120
-rwxr-xr-xext/phar/phar_object.c988
-rw-r--r--ext/phar/php_phar.h2
-rw-r--r--ext/phar/stream.c182
-rw-r--r--ext/phar/stream.h24
-rw-r--r--ext/phar/stub.h2
-rw-r--r--ext/phar/tar.c106
-rw-r--r--ext/phar/util.c242
-rw-r--r--ext/phar/zip.c76
14 files changed, 1142 insertions, 1145 deletions
diff --git a/ext/phar/dirstream.c b/ext/phar/dirstream.c
index b8875891b0..33a3cd20c2 100644
--- a/ext/phar/dirstream.c
+++ b/ext/phar/dirstream.c
@@ -22,7 +22,7 @@
#include "dirstream.h"
BEGIN_EXTERN_C()
-void phar_dostat(phar_archive_data *phar, phar_entry_info *data, php_stream_statbuf *ssb, zend_bool is_dir TSRMLS_DC);
+void phar_dostat(phar_archive_data *phar, phar_entry_info *data, php_stream_statbuf *ssb, zend_bool is_dir);
END_EXTERN_C()
php_stream_ops phar_dir_ops = {
@@ -40,7 +40,7 @@ php_stream_ops phar_dir_ops = {
/**
* Used for closedir($fp) where $fp is an opendir('phar://...') directory handle
*/
-static int phar_dir_close(php_stream *stream, int close_handle TSRMLS_DC) /* {{{ */
+static int phar_dir_close(php_stream *stream, int close_handle) /* {{{ */
{
HashTable *data = (HashTable *)stream->abstract;
@@ -58,7 +58,7 @@ static int phar_dir_close(php_stream *stream, int close_handle TSRMLS_DC) /* {{
/**
* Used for seeking on a phar directory handle
*/
-static int phar_dir_seek(php_stream *stream, zend_off_t offset, int whence, zend_off_t *newoffset TSRMLS_DC) /* {{{ */
+static int phar_dir_seek(php_stream *stream, zend_off_t offset, int whence, zend_off_t *newoffset) /* {{{ */
{
HashTable *data = (HashTable *)stream->abstract;
@@ -90,7 +90,7 @@ static int phar_dir_seek(php_stream *stream, zend_off_t offset, int whence, zend
/**
* Used for readdir() on an opendir()ed phar directory handle
*/
-static size_t phar_dir_read(php_stream *stream, char *buf, size_t count TSRMLS_DC) /* {{{ */
+static size_t phar_dir_read(php_stream *stream, char *buf, size_t count) /* {{{ */
{
size_t to_read;
HashTable *data = (HashTable *)stream->abstract;
@@ -119,7 +119,7 @@ static size_t phar_dir_read(php_stream *stream, char *buf, size_t count TSRMLS_D
/**
* Dummy: Used for writing to a phar directory (i.e. not used)
*/
-static size_t phar_dir_write(php_stream *stream, const char *buf, size_t count TSRMLS_DC) /* {{{ */
+static size_t phar_dir_write(php_stream *stream, const char *buf, size_t count) /* {{{ */
{
return 0;
}
@@ -128,7 +128,7 @@ static size_t phar_dir_write(php_stream *stream, const char *buf, size_t count T
/**
* Dummy: Used for flushing writes to a phar directory (i.e. not used)
*/
-static int phar_dir_flush(php_stream *stream TSRMLS_DC) /* {{{ */
+static int phar_dir_flush(php_stream *stream) /* {{{ */
{
return EOF;
}
@@ -152,7 +152,7 @@ static int phar_add_empty(HashTable *ht, char *arKey, uint nKeyLength) /* {{{ *
/**
* Used for sorting directories alphabetically
*/
-static int phar_compare_dir_name(const void *a, const void *b TSRMLS_DC) /* {{{ */
+static int phar_compare_dir_name(const void *a, const void *b) /* {{{ */
{
Bucket *f;
Bucket *s;
@@ -177,7 +177,7 @@ static int phar_compare_dir_name(const void *a, const void *b TSRMLS_DC) /* {{{
* files in a phar and retrieving its relative path. From this, construct
* a list of files/directories that are "in" the directory represented by dir
*/
-static php_stream *phar_make_dirstream(char *dir, HashTable *manifest TSRMLS_DC) /* {{{ */
+static php_stream *phar_make_dirstream(char *dir, HashTable *manifest) /* {{{ */
{
HashTable *data;
int dirlen = strlen(dir);
@@ -285,7 +285,7 @@ PHAR_ADD_ENTRY:
if (FAILURE != zend_hash_has_more_elements(data)) {
efree(dir);
- if (zend_hash_sort(data, zend_qsort, phar_compare_dir_name, 0 TSRMLS_CC) == FAILURE) {
+ if (zend_hash_sort(data, zend_qsort, phar_compare_dir_name, 0) == FAILURE) {
FREE_HASHTABLE(data);
return NULL;
}
@@ -300,7 +300,7 @@ PHAR_ADD_ENTRY:
/**
* Open a directory handle within a phar archive
*/
-php_stream *phar_wrapper_open_dir(php_stream_wrapper *wrapper, const char *path, const char *mode, int options, char **opened_path, php_stream_context *context STREAMS_DC TSRMLS_DC) /* {{{ */
+php_stream *phar_wrapper_open_dir(php_stream_wrapper *wrapper, const char *path, const char *mode, int options, char **opened_path, php_stream_context *context STREAMS_DC) /* {{{ */
{
php_url *resource = NULL;
php_stream *ret;
@@ -311,39 +311,39 @@ php_stream *phar_wrapper_open_dir(php_stream_wrapper *wrapper, const char *path,
phar_entry_info *entry = NULL;
uint host_len;
- if ((resource = phar_parse_url(wrapper, path, mode, options TSRMLS_CC)) == NULL) {
- php_stream_wrapper_log_error(wrapper, options TSRMLS_CC, "phar url \"%s\" is unknown", path);
+ if ((resource = phar_parse_url(wrapper, path, mode, options)) == NULL) {
+ php_stream_wrapper_log_error(wrapper, options, "phar url \"%s\" is unknown", path);
return NULL;
}
/* we must have at the very least phar://alias.phar/ */
if (!resource->scheme || !resource->host || !resource->path) {
if (resource->host && !resource->path) {
- php_stream_wrapper_log_error(wrapper, options TSRMLS_CC, "phar error: no directory in \"%s\", must have at least phar://%s/ for root directory (always use full path to a new phar)", path, resource->host);
+ php_stream_wrapper_log_error(wrapper, options, "phar error: no directory in \"%s\", must have at least phar://%s/ for root directory (always use full path to a new phar)", path, resource->host);
php_url_free(resource);
return NULL;
}
php_url_free(resource);
- php_stream_wrapper_log_error(wrapper, options TSRMLS_CC, "phar error: invalid url \"%s\", must have at least phar://%s/", path, path);
+ php_stream_wrapper_log_error(wrapper, options, "phar error: invalid url \"%s\", must have at least phar://%s/", path, path);
return NULL;
}
if (strcasecmp("phar", resource->scheme)) {
php_url_free(resource);
- php_stream_wrapper_log_error(wrapper, options TSRMLS_CC, "phar error: not a phar url \"%s\"", path);
+ php_stream_wrapper_log_error(wrapper, options, "phar error: not a phar url \"%s\"", path);
return NULL;
}
host_len = strlen(resource->host);
- phar_request_initialize(TSRMLS_C);
+ phar_request_initialize();
internal_file = resource->path + 1; /* strip leading "/" */
- if (FAILURE == phar_get_archive(&phar, resource->host, host_len, NULL, 0, &error TSRMLS_CC)) {
+ if (FAILURE == phar_get_archive(&phar, resource->host, host_len, NULL, 0, &error)) {
if (error) {
- php_stream_wrapper_log_error(wrapper, options TSRMLS_CC, "%s", error);
+ php_stream_wrapper_log_error(wrapper, options, "%s", error);
efree(error);
} else {
- php_stream_wrapper_log_error(wrapper, options TSRMLS_CC, "phar file \"%s\" is unknown", resource->host);
+ php_stream_wrapper_log_error(wrapper, options, "phar file \"%s\" is unknown", resource->host);
}
php_url_free(resource);
return NULL;
@@ -356,7 +356,7 @@ php_stream *phar_wrapper_open_dir(php_stream_wrapper *wrapper, const char *path,
if (*internal_file == '\0') {
/* root directory requested */
internal_file = estrndup(internal_file - 1, 1);
- ret = phar_make_dirstream(internal_file, &phar->manifest TSRMLS_CC);
+ ret = phar_make_dirstream(internal_file, &phar->manifest);
php_url_free(resource);
return ret;
}
@@ -376,7 +376,7 @@ php_stream *phar_wrapper_open_dir(php_stream_wrapper *wrapper, const char *path,
}
internal_file = estrdup(internal_file);
php_url_free(resource);
- return phar_make_dirstream(internal_file, &phar->manifest TSRMLS_CC);
+ return phar_make_dirstream(internal_file, &phar->manifest);
} else {
int i_len = strlen(internal_file);
@@ -391,7 +391,7 @@ php_stream *phar_wrapper_open_dir(php_stream_wrapper *wrapper, const char *path,
internal_file = estrndup(internal_file,
i_len);
php_url_free(resource);
- return phar_make_dirstream(internal_file, &phar->manifest TSRMLS_CC);
+ return phar_make_dirstream(internal_file, &phar->manifest);
}
}
@@ -409,7 +409,7 @@ php_stream *phar_wrapper_open_dir(php_stream_wrapper *wrapper, const char *path,
/**
* Make a new directory within a phar archive
*/
-int phar_wrapper_mkdir(php_stream_wrapper *wrapper, const char *url_from, int mode, int options, php_stream_context *context TSRMLS_DC) /* {{{ */
+int phar_wrapper_mkdir(php_stream_wrapper *wrapper, const char *url_from, int mode, int options, php_stream_context *context) /* {{{ */
{
phar_entry_info entry, *e;
phar_archive_data *phar = NULL;
@@ -419,12 +419,12 @@ int phar_wrapper_mkdir(php_stream_wrapper *wrapper, const char *url_from, int mo
uint host_len;
/* pre-readonly check, we need to know if this is a data phar */
- if (FAILURE == phar_split_fname(url_from, strlen(url_from), &arch, &arch_len, &entry2, &entry_len, 2, 2 TSRMLS_CC)) {
- php_stream_wrapper_log_error(wrapper, options TSRMLS_CC, "phar error: cannot create directory \"%s\", no phar archive specified", url_from);
+ if (FAILURE == phar_split_fname(url_from, strlen(url_from), &arch, &arch_len, &entry2, &entry_len, 2, 2)) {
+ php_stream_wrapper_log_error(wrapper, options, "phar error: cannot create directory \"%s\", no phar archive specified", url_from);
return 0;
}
- if (FAILURE == phar_get_archive(&phar, arch, arch_len, NULL, 0, NULL TSRMLS_CC)) {
+ if (FAILURE == phar_get_archive(&phar, arch, arch_len, NULL, 0, NULL)) {
phar = NULL;
}
@@ -432,63 +432,63 @@ int phar_wrapper_mkdir(php_stream_wrapper *wrapper, const char *url_from, int mo
efree(entry2);
if (PHAR_G(readonly) && (!phar || !phar->is_data)) {
- php_stream_wrapper_log_error(wrapper, options TSRMLS_CC, "phar error: cannot create directory \"%s\", write operations disabled", url_from);
+ php_stream_wrapper_log_error(wrapper, options, "phar error: cannot create directory \"%s\", write operations disabled", url_from);
return 0;
}
- if ((resource = phar_parse_url(wrapper, url_from, "w", options TSRMLS_CC)) == NULL) {
+ if ((resource = phar_parse_url(wrapper, url_from, "w", options)) == NULL) {
return 0;
}
/* we must have at the very least phar://alias.phar/internalfile.php */
if (!resource->scheme || !resource->host || !resource->path) {
php_url_free(resource);
- php_stream_wrapper_log_error(wrapper, options TSRMLS_CC, "phar error: invalid url \"%s\"", url_from);
+ php_stream_wrapper_log_error(wrapper, options, "phar error: invalid url \"%s\"", url_from);
return 0;
}
if (strcasecmp("phar", resource->scheme)) {
php_url_free(resource);
- php_stream_wrapper_log_error(wrapper, options TSRMLS_CC, "phar error: not a phar stream url \"%s\"", url_from);
+ php_stream_wrapper_log_error(wrapper, options, "phar error: not a phar stream url \"%s\"", url_from);
return 0;
}
host_len = strlen(resource->host);
- if (FAILURE == phar_get_archive(&phar, resource->host, host_len, NULL, 0, &error TSRMLS_CC)) {
- php_stream_wrapper_log_error(wrapper, options TSRMLS_CC, "phar error: cannot create directory \"%s\" in phar \"%s\", error retrieving phar information: %s", resource->path+1, resource->host, error);
+ if (FAILURE == phar_get_archive(&phar, resource->host, host_len, NULL, 0, &error)) {
+ php_stream_wrapper_log_error(wrapper, options, "phar error: cannot create directory \"%s\" in phar \"%s\", error retrieving phar information: %s", resource->path+1, resource->host, error);
efree(error);
php_url_free(resource);
return 0;
}
- if ((e = phar_get_entry_info_dir(phar, resource->path + 1, strlen(resource->path + 1), 2, &error, 1 TSRMLS_CC))) {
+ if ((e = phar_get_entry_info_dir(phar, resource->path + 1, strlen(resource->path + 1), 2, &error, 1))) {
/* directory exists, or is a subdirectory of an existing file */
if (e->is_temp_dir) {
efree(e->filename);
efree(e);
}
- php_stream_wrapper_log_error(wrapper, options TSRMLS_CC, "phar error: cannot create directory \"%s\" in phar \"%s\", directory already exists", resource->path+1, resource->host);
+ php_stream_wrapper_log_error(wrapper, options, "phar error: cannot create directory \"%s\" in phar \"%s\", directory already exists", resource->path+1, resource->host);
php_url_free(resource);
return 0;
}
if (error) {
- php_stream_wrapper_log_error(wrapper, options TSRMLS_CC, "phar error: cannot create directory \"%s\" in phar \"%s\", %s", resource->path+1, resource->host, error);
+ php_stream_wrapper_log_error(wrapper, options, "phar error: cannot create directory \"%s\" in phar \"%s\", %s", resource->path+1, resource->host, error);
efree(error);
php_url_free(resource);
return 0;
}
- if (phar_get_entry_info_dir(phar, resource->path + 1, strlen(resource->path + 1), 0, &error, 1 TSRMLS_CC)) {
+ if (phar_get_entry_info_dir(phar, resource->path + 1, strlen(resource->path + 1), 0, &error, 1)) {
/* entry exists as a file */
- php_stream_wrapper_log_error(wrapper, options TSRMLS_CC, "phar error: cannot create directory \"%s\" in phar \"%s\", file already exists", resource->path+1, resource->host);
+ php_stream_wrapper_log_error(wrapper, options, "phar error: cannot create directory \"%s\" in phar \"%s\", file already exists", resource->path+1, resource->host);
php_url_free(resource);
return 0;
}
if (error) {
- php_stream_wrapper_log_error(wrapper, options TSRMLS_CC, "phar error: cannot create directory \"%s\" in phar \"%s\", %s", resource->path+1, resource->host, error);
+ php_stream_wrapper_log_error(wrapper, options, "phar error: cannot create directory \"%s\" in phar \"%s\", %s", resource->path+1, resource->host, error);
efree(error);
php_url_free(resource);
return 0;
@@ -518,22 +518,22 @@ int phar_wrapper_mkdir(php_stream_wrapper *wrapper, const char *url_from, int mo
entry.old_flags = PHAR_ENT_PERM_DEF_DIR;
if (NULL == zend_hash_str_add_mem(&phar->manifest, entry.filename, entry.filename_len, (void*)&entry, sizeof(phar_entry_info))) {
- php_stream_wrapper_log_error(wrapper, options TSRMLS_CC, "phar error: cannot create directory \"%s\" in phar \"%s\", adding to manifest failed", entry.filename, phar->fname);
+ php_stream_wrapper_log_error(wrapper, options, "phar error: cannot create directory \"%s\" in phar \"%s\", adding to manifest failed", entry.filename, phar->fname);
efree(error);
efree(entry.filename);
return 0;
}
- phar_flush(phar, 0, 0, 0, &error TSRMLS_CC);
+ phar_flush(phar, 0, 0, 0, &error);
if (error) {
- php_stream_wrapper_log_error(wrapper, options TSRMLS_CC, "phar error: cannot create directory \"%s\" in phar \"%s\", %s", entry.filename, phar->fname, error);
+ php_stream_wrapper_log_error(wrapper, options, "phar error: cannot create directory \"%s\" in phar \"%s\", %s", entry.filename, phar->fname, error);
zend_hash_str_del(&phar->manifest, entry.filename, entry.filename_len);
efree(error);
return 0;
}
- phar_add_virtual_dirs(phar, entry.filename, entry.filename_len TSRMLS_CC);
+ phar_add_virtual_dirs(phar, entry.filename, entry.filename_len);
return 1;
}
/* }}} */
@@ -541,7 +541,7 @@ int phar_wrapper_mkdir(php_stream_wrapper *wrapper, const char *url_from, int mo
/**
* Remove a directory within a phar archive
*/
-int phar_wrapper_rmdir(php_stream_wrapper *wrapper, const char *url, int options, php_stream_context *context TSRMLS_DC) /* {{{ */
+int phar_wrapper_rmdir(php_stream_wrapper *wrapper, const char *url, int options, php_stream_context *context) /* {{{ */
{
phar_entry_info *entry;
phar_archive_data *phar = NULL;
@@ -554,12 +554,12 @@ int phar_wrapper_rmdir(php_stream_wrapper *wrapper, const char *url, int options
uint path_len;
/* pre-readonly check, we need to know if this is a data phar */
- if (FAILURE == phar_split_fname(url, strlen(url), &arch, &arch_len, &entry2, &entry_len, 2, 2 TSRMLS_CC)) {
- php_stream_wrapper_log_error(wrapper, options TSRMLS_CC, "phar error: cannot remove directory \"%s\", no phar archive specified, or phar archive does not exist", url);
+ if (FAILURE == phar_split_fname(url, strlen(url), &arch, &arch_len, &entry2, &entry_len, 2, 2)) {
+ php_stream_wrapper_log_error(wrapper, options, "phar error: cannot remove directory \"%s\", no phar archive specified, or phar archive does not exist", url);
return 0;
}
- if (FAILURE == phar_get_archive(&phar, arch, arch_len, NULL, 0, NULL TSRMLS_CC)) {
+ if (FAILURE == phar_get_archive(&phar, arch, arch_len, NULL, 0, NULL)) {
phar = NULL;
}
@@ -567,31 +567,31 @@ int phar_wrapper_rmdir(php_stream_wrapper *wrapper, const char *url, int options
efree(entry2);
if (PHAR_G(readonly) && (!phar || !phar->is_data)) {
- php_stream_wrapper_log_error(wrapper, options TSRMLS_CC, "phar error: cannot rmdir directory \"%s\", write operations disabled", url);
+ php_stream_wrapper_log_error(wrapper, options, "phar error: cannot rmdir directory \"%s\", write operations disabled", url);
return 0;
}
- if ((resource = phar_parse_url(wrapper, url, "w", options TSRMLS_CC)) == NULL) {
+ if ((resource = phar_parse_url(wrapper, url, "w", options)) == NULL) {
return 0;
}
/* we must have at the very least phar://alias.phar/internalfile.php */
if (!resource->scheme || !resource->host || !resource->path) {
php_url_free(resource);
- php_stream_wrapper_log_error(wrapper, options TSRMLS_CC, "phar error: invalid url \"%s\"", url);
+ php_stream_wrapper_log_error(wrapper, options, "phar error: invalid url \"%s\"", url);
return 0;
}
if (strcasecmp("phar", resource->scheme)) {
php_url_free(resource);
- php_stream_wrapper_log_error(wrapper, options TSRMLS_CC, "phar error: not a phar stream url \"%s\"", url);
+ php_stream_wrapper_log_error(wrapper, options, "phar error: not a phar stream url \"%s\"", url);
return 0;
}
host_len = strlen(resource->host);
- if (FAILURE == phar_get_archive(&phar, resource->host, host_len, NULL, 0, &error TSRMLS_CC)) {
- php_stream_wrapper_log_error(wrapper, options TSRMLS_CC, "phar error: cannot remove directory \"%s\" in phar \"%s\", error retrieving phar information: %s", resource->path+1, resource->host, error);
+ if (FAILURE == phar_get_archive(&phar, resource->host, host_len, NULL, 0, &error)) {
+ php_stream_wrapper_log_error(wrapper, options, "phar error: cannot remove directory \"%s\" in phar \"%s\", error retrieving phar information: %s", resource->path+1, resource->host, error);
efree(error);
php_url_free(resource);
return 0;
@@ -599,12 +599,12 @@ int phar_wrapper_rmdir(php_stream_wrapper *wrapper, const char *url, int options
path_len = strlen(resource->path+1);
- if (!(entry = phar_get_entry_info_dir(phar, resource->path + 1, path_len, 2, &error, 1 TSRMLS_CC))) {
+ if (!(entry = phar_get_entry_info_dir(phar, resource->path + 1, path_len, 2, &error, 1))) {
if (error) {
- php_stream_wrapper_log_error(wrapper, options TSRMLS_CC, "phar error: cannot remove directory \"%s\" in phar \"%s\", %s", resource->path+1, resource->host, error);
+ php_stream_wrapper_log_error(wrapper, options, "phar error: cannot remove directory \"%s\" in phar \"%s\", %s", resource->path+1, resource->host, error);
efree(error);
} else {
- php_stream_wrapper_log_error(wrapper, options TSRMLS_CC, "phar error: cannot remove directory \"%s\" in phar \"%s\", directory does not exist", resource->path+1, resource->host);
+ php_stream_wrapper_log_error(wrapper, options, "phar error: cannot remove directory \"%s\" in phar \"%s\", directory does not exist", resource->path+1, resource->host);
}
php_url_free(resource);
return 0;
@@ -618,7 +618,7 @@ int phar_wrapper_rmdir(php_stream_wrapper *wrapper, const char *url, int options
if (str_key->len > path_len &&
memcmp(str_key->val, resource->path+1, path_len) == 0 &&
IS_SLASH(str_key->val[path_len])) {
- php_stream_wrapper_log_error(wrapper, options TSRMLS_CC, "phar error: Directory not empty");
+ php_stream_wrapper_log_error(wrapper, options, "phar error: Directory not empty");
if (entry->is_temp_dir) {
efree(entry->filename);
efree(entry);
@@ -635,7 +635,7 @@ int phar_wrapper_rmdir(php_stream_wrapper *wrapper, const char *url, int options
if (str_key->len > path_len &&
memcmp(str_key->val, resource->path+1, path_len) == 0 &&
IS_SLASH(str_key->val[path_len])) {
- php_stream_wrapper_log_error(wrapper, options TSRMLS_CC, "phar error: Directory not empty");
+ php_stream_wrapper_log_error(wrapper, options, "phar error: Directory not empty");
if (entry->is_temp_dir) {
efree(entry->filename);
efree(entry);
@@ -653,10 +653,10 @@ int phar_wrapper_rmdir(php_stream_wrapper *wrapper, const char *url, int options
} else {
entry->is_deleted = 1;
entry->is_modified = 1;
- phar_flush(phar, 0, 0, 0, &error TSRMLS_CC);
+ phar_flush(phar, 0, 0, 0, &error);
if (error) {
- php_stream_wrapper_log_error(wrapper, options TSRMLS_CC, "phar error: cannot remove directory \"%s\" in phar \"%s\", %s", entry->filename, phar->fname, error);
+ php_stream_wrapper_log_error(wrapper, options, "phar error: cannot remove directory \"%s\" in phar \"%s\", %s", entry->filename, phar->fname, error);
php_url_free(resource);
efree(error);
return 0;
diff --git a/ext/phar/dirstream.h b/ext/phar/dirstream.h
index f9a300a63c..c59ba1b95b 100644
--- a/ext/phar/dirstream.h
+++ b/ext/phar/dirstream.h
@@ -20,20 +20,20 @@
/* $Id$ */
BEGIN_EXTERN_C()
-int phar_wrapper_mkdir(php_stream_wrapper *wrapper, const char *url_from, int mode, int options, php_stream_context *context TSRMLS_DC);
-int phar_wrapper_rmdir(php_stream_wrapper *wrapper, const char *url, int options, php_stream_context *context TSRMLS_DC);
+int phar_wrapper_mkdir(php_stream_wrapper *wrapper, const char *url_from, int mode, int options, php_stream_context *context);
+int phar_wrapper_rmdir(php_stream_wrapper *wrapper, const char *url, int options, php_stream_context *context);
#ifdef PHAR_DIRSTREAM
-php_url* phar_parse_url(php_stream_wrapper *wrapper, const char *filename, const char *mode, int options TSRMLS_DC);
+php_url* phar_parse_url(php_stream_wrapper *wrapper, const char *filename, const char *mode, int options);
/* directory handlers */
-static size_t phar_dir_write(php_stream *stream, const char *buf, size_t count TSRMLS_DC);
-static size_t phar_dir_read( php_stream *stream, char *buf, size_t count TSRMLS_DC);
-static int phar_dir_close(php_stream *stream, int close_handle TSRMLS_DC);
-static int phar_dir_flush(php_stream *stream TSRMLS_DC);
-static int phar_dir_seek( php_stream *stream, zend_off_t offset, int whence, zend_off_t *newoffset TSRMLS_DC);
+static size_t phar_dir_write(php_stream *stream, const char *buf, size_t count);
+static size_t phar_dir_read( php_stream *stream, char *buf, size_t count);
+static int phar_dir_close(php_stream *stream, int close_handle);
+static int phar_dir_flush(php_stream *stream);
+static int phar_dir_seek( php_stream *stream, zend_off_t offset, int whence, zend_off_t *newoffset);
#else
-php_stream* phar_wrapper_open_dir(php_stream_wrapper *wrapper, const char *path, const char *mode, int options, char **opened_path, php_stream_context *context STREAMS_DC TSRMLS_DC);
+php_stream* phar_wrapper_open_dir(php_stream_wrapper *wrapper, const char *path, const char *mode, int options, char **opened_path, php_stream_context *context STREAMS_DC);
#endif
END_EXTERN_C()
diff --git a/ext/phar/func_interceptors.c b/ext/phar/func_interceptors.c
index bd7324c78e..5fd3753ab6 100644
--- a/ext/phar/func_interceptors.c
+++ b/ext/phar/func_interceptors.c
@@ -38,14 +38,14 @@ PHAR_FUNC(phar_opendir) /* {{{ */
goto skip_phar;
}
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "p|z", &filename, &filename_len, &zcontext) == FAILURE) {
+ if (zend_parse_parameters(ZEND_NUM_ARGS(), "p|z", &filename, &filename_len, &zcontext) == FAILURE) {
return;
}
if (!IS_ABSOLUTE_PATH(filename, filename_len) && !strstr(filename, "://")) {
char *arch, *entry, *fname;
int arch_len, entry_len, fname_len;
- fname = (char*)zend_get_executed_filename(TSRMLS_C);
+ fname = (char*)zend_get_executed_filename();
/* we are checking for existence of a file within the relative path. Chances are good that this is
retrieving something from within the phar archive */
@@ -54,7 +54,7 @@ PHAR_FUNC(phar_opendir) /* {{{ */
goto skip_phar;
}
fname_len = strlen(fname);
- if (SUCCESS == phar_split_fname(fname, fname_len, &arch, &arch_len, &entry, &entry_len, 2, 0 TSRMLS_CC)) {
+ if (SUCCESS == phar_split_fname(fname, fname_len, &arch, &arch_len, &entry, &entry_len, 2, 0)) {
php_stream_context *context = NULL;
php_stream *stream;
char *name;
@@ -64,7 +64,7 @@ PHAR_FUNC(phar_opendir) /* {{{ */
/* fopen within phar, if :// is not in the url, then prepend phar://<archive>/ */
entry_len = filename_len;
/* retrieving a file within the current directory, so use this if possible */
- entry = phar_fix_filepath(entry, &entry_len, 1 TSRMLS_CC);
+ entry = phar_fix_filepath(entry, &entry_len, 1);
if (entry[0] == '/') {
spprintf(&name, 4096, "phar://%s%s", arch, entry);
@@ -112,7 +112,7 @@ PHAR_FUNC(phar_file_get_contents) /* {{{ */
}
/* Parse arguments */
- if (zend_parse_parameters_ex(ZEND_PARSE_PARAMS_QUIET, ZEND_NUM_ARGS() TSRMLS_CC, "p|br!ll", &filename, &filename_len, &use_include_path, &zcontext, &offset, &maxlen) == FAILURE) {
+ if (zend_parse_parameters_ex(ZEND_PARSE_PARAMS_QUIET, ZEND_NUM_ARGS(), "p|br!ll", &filename, &filename_len, &use_include_path, &zcontext, &offset, &maxlen) == FAILURE) {
goto skip_phar;
}
@@ -121,13 +121,13 @@ PHAR_FUNC(phar_file_get_contents) /* {{{ */
int arch_len, entry_len, fname_len;
php_stream_context *context = NULL;
- fname = (char*)zend_get_executed_filename(TSRMLS_C);
+ fname = (char*)zend_get_executed_filename();
if (strncasecmp(fname, "phar://", 7)) {
goto skip_phar;
}
fname_len = strlen(fname);
- if (SUCCESS == phar_split_fname(fname, fname_len, &arch, &arch_len, &entry, &entry_len, 2, 0 TSRMLS_CC)) {
+ if (SUCCESS == phar_split_fname(fname, fname_len, &arch, &arch_len, &entry, &entry_len, 2, 0)) {
char *name;
phar_archive_data *phar;
@@ -138,17 +138,17 @@ PHAR_FUNC(phar_file_get_contents) /* {{{ */
if (ZEND_NUM_ARGS() == 5 && maxlen < 0) {
efree(arch);
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "length must be greater than or equal to zero");
+ php_error_docref(NULL, E_WARNING, "length must be greater than or equal to zero");
RETURN_FALSE;
}
/* retrieving a file defaults to within the current directory, so use this if possible */
- if (FAILURE == phar_get_archive(&phar, arch, arch_len, NULL, 0, NULL TSRMLS_CC)) {
+ if (FAILURE == phar_get_archive(&phar, arch, arch_len, NULL, 0, NULL)) {
efree(arch);
goto skip_phar;
}
if (use_include_path) {
- if ((entry = phar_find_in_include_path(entry, entry_len, NULL TSRMLS_CC))) {
+ if ((entry = phar_find_in_include_path(entry, entry_len, NULL))) {
name = entry;
goto phar_it;
} else {
@@ -157,7 +157,7 @@ PHAR_FUNC(phar_file_get_contents) /* {{{ */
goto skip_phar;
}
} else {
- entry = phar_fix_filepath(estrndup(entry, entry_len), &entry_len, 1 TSRMLS_CC);
+ entry = phar_fix_filepath(estrndup(entry, entry_len), &entry_len, 1);
if (entry[0] == '/') {
if (!zend_hash_str_exists(&(phar->manifest), entry + 1, entry_len - 1)) {
/* this file is not in the phar, use the original path */
@@ -195,7 +195,7 @@ phar_it:
}
if (offset > 0 && php_stream_seek(stream, offset, SEEK_SET) < 0) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "Failed to seek to position %pd in the stream", offset);
+ php_error_docref(NULL, E_WARNING, "Failed to seek to position %pd in the stream", offset);
php_stream_close(stream);
RETURN_FALSE;
}
@@ -238,7 +238,7 @@ PHAR_FUNC(phar_readfile) /* {{{ */
&& !cached_phars.arHash) {
goto skip_phar;
}
- if (zend_parse_parameters_ex(ZEND_PARSE_PARAMS_QUIET, ZEND_NUM_ARGS() TSRMLS_CC, "p|br!", &filename, &filename_len, &use_include_path, &zcontext) == FAILURE) {
+ if (zend_parse_parameters_ex(ZEND_PARSE_PARAMS_QUIET, ZEND_NUM_ARGS(), "p|br!", &filename, &filename_len, &use_include_path, &zcontext) == FAILURE) {
goto skip_phar;
}
if (use_include_path || (!IS_ABSOLUTE_PATH(filename, filename_len) && !strstr(filename, "://"))) {
@@ -247,13 +247,13 @@ PHAR_FUNC(phar_readfile) /* {{{ */
php_stream_context *context = NULL;
char *name;
phar_archive_data *phar;
- fname = (char*)zend_get_executed_filename(TSRMLS_C);
+ fname = (char*)zend_get_executed_filename();
if (strncasecmp(fname, "phar://", 7)) {
goto skip_phar;
}
fname_len = strlen(fname);
- if (FAILURE == phar_split_fname(fname, fname_len, &arch, &arch_len, &entry, &entry_len, 2, 0 TSRMLS_CC)) {
+ if (FAILURE == phar_split_fname(fname, fname_len, &arch, &arch_len, &entry, &entry_len, 2, 0)) {
goto skip_phar;
}
@@ -262,12 +262,12 @@ PHAR_FUNC(phar_readfile) /* {{{ */
/* fopen within phar, if :// is not in the url, then prepend phar://<archive>/ */
entry_len = filename_len;
/* retrieving a file defaults to within the current directory, so use this if possible */
- if (FAILURE == phar_get_archive(&phar, arch, arch_len, NULL, 0, NULL TSRMLS_CC)) {
+ if (FAILURE == phar_get_archive(&phar, arch, arch_len, NULL, 0, NULL)) {
efree(arch);
goto skip_phar;
}
if (use_include_path) {
- if (!(entry = phar_find_in_include_path(entry, entry_len, NULL TSRMLS_CC))) {
+ if (!(entry = phar_find_in_include_path(entry, entry_len, NULL))) {
/* this file is not in the phar, use the original path */
efree(arch);
goto skip_phar;
@@ -275,7 +275,7 @@ PHAR_FUNC(phar_readfile) /* {{{ */
name = entry;
}
} else {
- entry = phar_fix_filepath(estrndup(entry, entry_len), &entry_len, 1 TSRMLS_CC);
+ entry = phar_fix_filepath(estrndup(entry, entry_len), &entry_len, 1);
if (entry[0] == '/') {
if (!zend_hash_str_exists(&(phar->manifest), entry + 1, entry_len - 1)) {
/* this file is not in the phar, use the original path */
@@ -334,7 +334,7 @@ PHAR_FUNC(phar_fopen) /* {{{ */
/* no need to check, include_path not even specified in fopen/ no active phars */
goto skip_phar;
}
- if (zend_parse_parameters_ex(ZEND_PARSE_PARAMS_QUIET, ZEND_NUM_ARGS() TSRMLS_CC, "ps|br", &filename, &filename_len, &mode, &mode_len, &use_include_path, &zcontext) == FAILURE) {
+ if (zend_parse_parameters_ex(ZEND_PARSE_PARAMS_QUIET, ZEND_NUM_ARGS(), "ps|br", &filename, &filename_len, &mode, &mode_len, &use_include_path, &zcontext) == FAILURE) {
goto skip_phar;
}
if (use_include_path || (!IS_ABSOLUTE_PATH(filename, filename_len) && !strstr(filename, "://"))) {
@@ -343,13 +343,13 @@ PHAR_FUNC(phar_fopen) /* {{{ */
php_stream_context *context = NULL;
char *name;
phar_archive_data *phar;
- fname = (char*)zend_get_executed_filename(TSRMLS_C);
+ fname = (char*)zend_get_executed_filename();
if (strncasecmp(fname, "phar://", 7)) {
goto skip_phar;
}
fname_len = strlen(fname);
- if (FAILURE == phar_split_fname(fname, fname_len, &arch, (int *)&arch_len, &entry, (int *)&entry_len, 2, 0 TSRMLS_CC)) {
+ if (FAILURE == phar_split_fname(fname, fname_len, &arch, (int *)&arch_len, &entry, (int *)&entry_len, 2, 0)) {
goto skip_phar;
}
@@ -358,12 +358,12 @@ PHAR_FUNC(phar_fopen) /* {{{ */
/* fopen within phar, if :// is not in the url, then prepend phar://<archive>/ */
entry_len = filename_len;
/* retrieving a file defaults to within the current directory, so use this if possible */
- if (FAILURE == phar_get_archive(&phar, arch, arch_len, NULL, 0, NULL TSRMLS_CC)) {
+ if (FAILURE == phar_get_archive(&phar, arch, arch_len, NULL, 0, NULL)) {
efree(arch);
goto skip_phar;
}
if (use_include_path) {
- if (!(entry = phar_find_in_include_path(entry, entry_len, NULL TSRMLS_CC))) {
+ if (!(entry = phar_find_in_include_path(entry, entry_len, NULL))) {
/* this file is not in the phar, use the original path */
efree(arch);
goto skip_phar;
@@ -371,7 +371,7 @@ PHAR_FUNC(phar_fopen) /* {{{ */
name = entry;
}
} else {
- entry = phar_fix_filepath(estrndup(entry, entry_len), (int *)&entry_len, 1 TSRMLS_CC);
+ entry = phar_fix_filepath(estrndup(entry, entry_len), (int *)&entry_len, 1);
if (entry[0] == '/') {
if (!zend_hash_str_exists(&(phar->manifest), entry + 1, entry_len - 1)) {
/* this file is not in the phar, use the original path */
@@ -433,7 +433,7 @@ skip_phar:
/* {{{ php_stat
*/
-static void phar_fancy_stat(zend_stat_t *stat_sb, int type, zval *return_value TSRMLS_DC)
+static void phar_fancy_stat(zend_stat_t *stat_sb, int type, zval *return_value)
{
zval stat_dev, stat_ino, stat_mode, stat_nlink, stat_uid, stat_gid, stat_rdev,
stat_size, stat_atime, stat_mtime, stat_ctime, stat_blksize, stat_blocks;
@@ -512,7 +512,7 @@ static void phar_fancy_stat(zend_stat_t *stat_sb, int type, zval *return_value T
case S_IFDIR: RETURN_STRING("dir");
case S_IFREG: RETURN_STRING("file");
}
- php_error_docref(NULL TSRMLS_CC, E_NOTICE, "Unknown file type (%u)", stat_sb->st_mode & S_IFMT);
+ php_error_docref(NULL, E_NOTICE, "Unknown file type (%u)", stat_sb->st_mode & S_IFMT);
RETURN_STRING("unknown");
case FS_IS_W:
RETURN_BOOL((stat_sb->st_mode & wmask) != 0);
@@ -597,7 +597,7 @@ static void phar_fancy_stat(zend_stat_t *stat_sb, int type, zval *return_value T
return;
}
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "Didn't understand stat call");
+ php_error_docref(NULL, E_WARNING, "Didn't understand stat call");
RETURN_FALSE;
}
/* }}} */
@@ -615,7 +615,7 @@ static void phar_file_stat(const char *filename, php_stat_len filename_length, i
phar_entry_info *data = NULL;
phar_archive_data *phar;
- fname = (char*)zend_get_executed_filename(TSRMLS_C);
+ fname = (char*)zend_get_executed_filename();
/* we are checking for existence of a file within the relative path. Chances are good that this is
retrieving something from within the phar archive */
@@ -633,19 +633,19 @@ static void phar_file_stat(const char *filename, php_stat_len filename_length, i
phar = PHAR_G(last_phar);
goto splitted;
}
- if (SUCCESS == phar_split_fname(fname, fname_len, &arch, &arch_len, &entry, &entry_len, 2, 0 TSRMLS_CC)) {
+ if (SUCCESS == phar_split_fname(fname, fname_len, &arch, &arch_len, &entry, &entry_len, 2, 0)) {
efree(entry);
entry = estrndup(filename, filename_length);
/* fopen within phar, if :// is not in the url, then prepend phar://<archive>/ */
entry_len = (int) filename_length;
- if (FAILURE == phar_get_archive(&phar, arch, arch_len, NULL, 0, NULL TSRMLS_CC)) {
+ if (FAILURE == phar_get_archive(&phar, arch, arch_len, NULL, 0, NULL)) {
efree(arch);
efree(entry);
goto skip_phar;
}
splitted:
- entry = phar_fix_filepath(entry, &entry_len, 1 TSRMLS_CC);
+ entry = phar_fix_filepath(entry, &entry_len, 1);
if (entry[0] == '/') {
if (NULL != (data = zend_hash_str_find_ptr(&(phar->manifest), entry + 1, entry_len - 1))) {
efree(entry);
@@ -690,7 +690,7 @@ notfound:
PHAR_G(cwd) = "/";
PHAR_G(cwd_len) = 0;
/* clean path without cwd */
- entry = phar_fix_filepath(entry, &entry_len, 1 TSRMLS_CC);
+ entry = phar_fix_filepath(entry, &entry_len, 1);
if (NULL != (data = zend_hash_str_find_ptr(&(phar->manifest), entry + 1, entry_len - 1))) {
PHAR_G(cwd) = save;
PHAR_G(cwd_len) = save_len;
@@ -729,7 +729,7 @@ notfound:
efree(arch);
/* Error Occurred */
if (!IS_EXISTS_CHECK(type)) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "%sstat failed for %s", IS_LINK_OPERATION(type) ? "L" : "", filename);
+ php_error_docref(NULL, E_WARNING, "%sstat failed for %s", IS_LINK_OPERATION(type) ? "L" : "", filename);
}
RETURN_FALSE;
}
@@ -789,7 +789,7 @@ statme_baby:
sb.st_blksize = -1;
sb.st_blocks = -1;
#endif
- phar_fancy_stat(&sb, type, return_value TSRMLS_CC);
+ phar_fancy_stat(&sb, type, return_value);
return;
}
}
@@ -807,7 +807,7 @@ void fname(INTERNAL_FUNCTION_PARAMETERS) { \
char *filename; \
size_t filename_len; \
\
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "p", &filename, &filename_len) == FAILURE) { \
+ if (zend_parse_parameters(ZEND_NUM_ARGS(), "p", &filename, &filename_len) == FAILURE) { \
return; \
} \
\
@@ -899,13 +899,13 @@ PHAR_FUNC(phar_is_file) /* {{{ */
&& !cached_phars.arHash) {
goto skip_phar;
}
- if (zend_parse_parameters_ex(ZEND_PARSE_PARAMS_QUIET, ZEND_NUM_ARGS() TSRMLS_CC, "p", &filename, &filename_len) == FAILURE) {
+ if (zend_parse_parameters_ex(ZEND_PARSE_PARAMS_QUIET, ZEND_NUM_ARGS(), "p", &filename, &filename_len) == FAILURE) {
goto skip_phar;
}
if (!IS_ABSOLUTE_PATH(filename, filename_len) && !strstr(filename, "://")) {
char *arch, *entry, *fname;
int arch_len, entry_len, fname_len;
- fname = (char*)zend_get_executed_filename(TSRMLS_C);
+ fname = (char*)zend_get_executed_filename();
/* we are checking for existence of a file within the relative path. Chances are good that this is
retrieving something from within the phar archive */
@@ -914,7 +914,7 @@ PHAR_FUNC(phar_is_file) /* {{{ */
goto skip_phar;
}
fname_len = strlen(fname);
- if (SUCCESS == phar_split_fname(fname, fname_len, &arch, &arch_len, &entry, &entry_len, 2, 0 TSRMLS_CC)) {
+ if (SUCCESS == phar_split_fname(fname, fname_len, &arch, &arch_len, &entry, &entry_len, 2, 0)) {
phar_archive_data *phar;
efree(entry);
@@ -922,10 +922,10 @@ PHAR_FUNC(phar_is_file) /* {{{ */
/* fopen within phar, if :// is not in the url, then prepend phar://<archive>/ */
entry_len = filename_len;
/* retrieving a file within the current directory, so use this if possible */
- if (SUCCESS == phar_get_archive(&phar, arch, arch_len, NULL, 0, NULL TSRMLS_CC)) {
+ if (SUCCESS == phar_get_archive(&phar, arch, arch_len, NULL, 0, NULL)) {
phar_entry_info *etemp;
- entry = phar_fix_filepath(estrndup(entry, entry_len), &entry_len, 1 TSRMLS_CC);
+ entry = phar_fix_filepath(estrndup(entry, entry_len), &entry_len, 1);
if (entry[0] == '/') {
if (NULL != (etemp = zend_hash_str_find_ptr(&(phar->manifest), entry + 1, entry_len - 1))) {
/* this file is not in the current directory, use the original path */
@@ -966,13 +966,13 @@ PHAR_FUNC(phar_is_link) /* {{{ */
&& !cached_phars.arHash) {
goto skip_phar;
}
- if (zend_parse_parameters_ex(ZEND_PARSE_PARAMS_QUIET, ZEND_NUM_ARGS() TSRMLS_CC, "p", &filename, &filename_len) == FAILURE) {
+ if (zend_parse_parameters_ex(ZEND_PARSE_PARAMS_QUIET, ZEND_NUM_ARGS(), "p", &filename, &filename_len) == FAILURE) {
goto skip_phar;
}
if (!IS_ABSOLUTE_PATH(filename, filename_len) && !strstr(filename, "://")) {
char *arch, *entry, *fname;
int arch_len, entry_len, fname_len;
- fname = (char*)zend_get_executed_filename(TSRMLS_C);
+ fname = (char*)zend_get_executed_filename();
/* we are checking for existence of a file within the relative path. Chances are good that this is
retrieving something from within the phar archive */
@@ -981,7 +981,7 @@ PHAR_FUNC(phar_is_link) /* {{{ */
goto skip_phar;
}
fname_len = strlen(fname);
- if (SUCCESS == phar_split_fname(fname, fname_len, &arch, &arch_len, &entry, &entry_len, 2, 0 TSRMLS_CC)) {
+ if (SUCCESS == phar_split_fname(fname, fname_len, &arch, &arch_len, &entry, &entry_len, 2, 0)) {
phar_archive_data *phar;
efree(entry);
@@ -989,10 +989,10 @@ PHAR_FUNC(phar_is_link) /* {{{ */
/* fopen within phar, if :// is not in the url, then prepend phar://<archive>/ */
entry_len = filename_len;
/* retrieving a file within the current directory, so use this if possible */
- if (SUCCESS == phar_get_archive(&phar, arch, arch_len, NULL, 0, NULL TSRMLS_CC)) {
+ if (SUCCESS == phar_get_archive(&phar, arch, arch_len, NULL, 0, NULL)) {
phar_entry_info *etemp;
- entry = phar_fix_filepath(estrndup(entry, entry_len), &entry_len, 1 TSRMLS_CC);
+ entry = phar_fix_filepath(estrndup(entry, entry_len), &entry_len, 1);
if (entry[0] == '/') {
if (NULL != (etemp = zend_hash_str_find_ptr(&(phar->manifest), entry + 1, entry_len - 1))) {
/* this file is not in the current directory, use the original path */
@@ -1028,8 +1028,8 @@ PharFileFunction(phar_lstat, FS_LSTAT, orig_lstat)
PharFileFunction(phar_stat, FS_STAT, orig_stat)
/* }}} */
-/* {{{ void phar_intercept_functions(TSRMLS_D) */
-void phar_intercept_functions(TSRMLS_D)
+/* {{{ void phar_intercept_functions(void) */
+void phar_intercept_functions(void)
{
if (!PHAR_G(request_init)) {
PHAR_G(cwd) = NULL;
@@ -1039,14 +1039,14 @@ void phar_intercept_functions(TSRMLS_D)
}
/* }}} */
-/* {{{ void phar_release_functions(TSRMLS_D) */
-void phar_release_functions(TSRMLS_D)
+/* {{{ void phar_release_functions(void) */
+void phar_release_functions(void)
{
PHAR_G(intercepted) = 0;
}
/* }}} */
-/* {{{ void phar_intercept_functions_init(TSRMLS_D) */
+/* {{{ void phar_intercept_functions_init(void) */
#define PHAR_INTERCEPT(func) \
PHAR_G(orig_##func) = NULL; \
if (NULL != (orig = zend_hash_str_find_ptr(CG(function_table), #func, sizeof(#func)-1))) { \
@@ -1054,7 +1054,7 @@ void phar_release_functions(TSRMLS_D)
orig->internal_function.handler = phar_##func; \
}
-void phar_intercept_functions_init(TSRMLS_D)
+void phar_intercept_functions_init(void)
{
zend_function *orig;
@@ -1084,14 +1084,14 @@ void phar_intercept_functions_init(TSRMLS_D)
}
/* }}} */
-/* {{{ void phar_intercept_functions_shutdown(TSRMLS_D) */
+/* {{{ void phar_intercept_functions_shutdown(void) */
#define PHAR_RELEASE(func) \
if (PHAR_G(orig_##func) && NULL != (orig = zend_hash_str_find_ptr(CG(function_table), #func, sizeof(#func)-1))) { \
orig->internal_function.handler = PHAR_G(orig_##func); \
} \
PHAR_G(orig_##func) = NULL;
-void phar_intercept_functions_shutdown(TSRMLS_D)
+void phar_intercept_functions_shutdown(void)
{
zend_function *orig;
@@ -1145,7 +1145,7 @@ static struct _phar_orig_functions {
void (*orig_stat)(INTERNAL_FUNCTION_PARAMETERS);
} phar_orig_functions = {NULL};
-void phar_save_orig_functions(TSRMLS_D) /* {{{ */
+void phar_save_orig_functions(void) /* {{{ */
{
phar_orig_functions.orig_fopen = PHAR_G(orig_fopen);
phar_orig_functions.orig_file_get_contents = PHAR_G(orig_file_get_contents);
@@ -1172,7 +1172,7 @@ void phar_save_orig_functions(TSRMLS_D) /* {{{ */
}
/* }}} */
-void phar_restore_orig_functions(TSRMLS_D) /* {{{ */
+void phar_restore_orig_functions(void) /* {{{ */
{
PHAR_G(orig_fopen) = phar_orig_functions.orig_fopen;
PHAR_G(orig_file_get_contents) = phar_orig_functions.orig_file_get_contents;
diff --git a/ext/phar/func_interceptors.h b/ext/phar/func_interceptors.h
index ff271460fe..e0aba7a8a2 100644
--- a/ext/phar/func_interceptors.h
+++ b/ext/phar/func_interceptors.h
@@ -20,12 +20,12 @@
/* $Id$ */
BEGIN_EXTERN_C()
-void phar_intercept_functions(TSRMLS_D);
-void phar_release_functions(TSRMLS_D);
-void phar_intercept_functions_init(TSRMLS_D);
-void phar_intercept_functions_shutdown(TSRMLS_D);
-void phar_save_orig_functions(TSRMLS_D);
-void phar_restore_orig_functions(TSRMLS_D);
+void phar_intercept_functions(void);
+void phar_release_functions(void);
+void phar_intercept_functions_init(void);
+void phar_intercept_functions_shutdown(void);
+void phar_save_orig_functions(void);
+void phar_restore_orig_functions(void);
END_EXTERN_C()
/*
diff --git a/ext/phar/phar.c b/ext/phar/phar.c
index ec64f09c09..b601669507 100644
--- a/ext/phar/phar.c
+++ b/ext/phar/phar.c
@@ -27,12 +27,12 @@
static void destroy_phar_data(zval *zv);
ZEND_DECLARE_MODULE_GLOBALS(phar)
-char *(*phar_save_resolve_path)(const char *filename, int filename_len TSRMLS_DC);
+char *(*phar_save_resolve_path)(const char *filename, int filename_len);
/**
* set's phar->is_writeable based on the current INI value
*/
-static int phar_set_writeable_bit(zval *zv, void *argument TSRMLS_DC) /* {{{ */
+static int phar_set_writeable_bit(zval *zv, void *argument) /* {{{ */
{
zend_bool keep = *(zend_bool *)argument;
phar_archive_data *phar = (phar_archive_data *)Z_PTR_P(zv);
@@ -83,7 +83,7 @@ ZEND_INI_MH(phar_ini_modify_handler) /* {{{ */
if (entry->name->len == sizeof("phar.readonly")-1) {
PHAR_G(readonly) = ini;
if (PHAR_GLOBALS->request_init && PHAR_GLOBALS->phar_fname_map.arHash) {
- zend_hash_apply_with_argument(&(PHAR_GLOBALS->phar_fname_map), phar_set_writeable_bit, (void *)&ini TSRMLS_CC);
+ zend_hash_apply_with_argument(&(PHAR_GLOBALS->phar_fname_map), phar_set_writeable_bit, (void *)&ini);
}
} else {
PHAR_G(require_hash) = ini;
@@ -97,7 +97,7 @@ ZEND_INI_MH(phar_ini_modify_handler) /* {{{ */
HashTable cached_phars;
HashTable cached_alias;
-static void phar_split_cache_list(TSRMLS_D) /* {{{ */
+static void phar_split_cache_list(void) /* {{{ */
{
char *tmp;
char *key, *lasts, *end;
@@ -135,7 +135,7 @@ static void phar_split_cache_list(TSRMLS_D) /* {{{ */
end = strchr(key, DEFAULT_DIR_SEPARATOR);
if (end) {
- if (SUCCESS == phar_open_from_filename(key, end - key, NULL, 0, 0, &phar, NULL TSRMLS_CC)) {
+ if (SUCCESS == phar_open_from_filename(key, end - key, NULL, 0, 0, &phar, NULL)) {
finish_up:
phar->phar_pos = i++;
php_stream_close(phar->fp);
@@ -158,7 +158,7 @@ finish_error:
return;
}
} else {
- if (SUCCESS == phar_open_from_filename(key, strlen(key), NULL, 0, 0, &phar, NULL TSRMLS_CC)) {
+ if (SUCCESS == phar_open_from_filename(key, strlen(key), NULL, 0, 0, &phar, NULL)) {
goto finish_up;
} else {
goto finish_error;
@@ -186,7 +186,7 @@ ZEND_INI_MH(phar_ini_cache_list) /* {{{ */
PHAR_G(cache_list) = new_value->val;
if (stage == ZEND_INI_STAGE_STARTUP) {
- phar_split_cache_list(TSRMLS_C);
+ phar_split_cache_list();
}
return SUCCESS;
@@ -203,7 +203,7 @@ PHP_INI_END()
* When all uses of a phar have been concluded, this frees the manifest
* and the phar slot
*/
-void phar_destroy_phar_data(phar_archive_data *phar TSRMLS_DC) /* {{{ */
+void phar_destroy_phar_data(phar_archive_data *phar) /* {{{ */
{
if (phar->alias && phar->alias != phar->fname) {
pefree(phar->alias, phar->is_persistent);
@@ -267,7 +267,7 @@ void phar_destroy_phar_data(phar_archive_data *phar TSRMLS_DC) /* {{{ */
/**
* Delete refcount and destruct if needed. On destruct return 1 else 0.
*/
-int phar_archive_delref(phar_archive_data *phar TSRMLS_DC) /* {{{ */
+int phar_archive_delref(phar_archive_data *phar) /* {{{ */
{
if (phar->is_persistent) {
return 0;
@@ -276,7 +276,7 @@ int phar_archive_delref(phar_archive_data *phar TSRMLS_DC) /* {{{ */
if (--phar->refcount < 0) {
if (PHAR_GLOBALS->request_done
|| zend_hash_str_del(&(PHAR_GLOBALS->phar_fname_map), phar->fname, phar->fname_len) != SUCCESS) {
- phar_destroy_phar_data(phar TSRMLS_CC);
+ phar_destroy_phar_data(phar);
}
return 1;
} else if (!phar->refcount) {
@@ -297,7 +297,7 @@ int phar_archive_delref(phar_archive_data *phar TSRMLS_DC) /* {{{ */
/* this is a new phar that has perhaps had an alias/metadata set, but has never
been flushed */
if (zend_hash_str_del(&(PHAR_GLOBALS->phar_fname_map), phar->fname, phar->fname_len) != SUCCESS) {
- phar_destroy_phar_data(phar TSRMLS_CC);
+ phar_destroy_phar_data(phar);
}
return 1;
}
@@ -312,10 +312,9 @@ int phar_archive_delref(phar_archive_data *phar TSRMLS_DC) /* {{{ */
static void destroy_phar_data_only(zval *zv) /* {{{ */
{
phar_archive_data *phar_data = (phar_archive_data *) Z_PTR_P(zv);
- TSRMLS_FETCH();
if (EG(exception) || --phar_data->refcount < 0) {
- phar_destroy_phar_data(phar_data TSRMLS_CC);
+ phar_destroy_phar_data(phar_data);
}
}
/* }}}*/
@@ -323,7 +322,7 @@ static void destroy_phar_data_only(zval *zv) /* {{{ */
/**
* Delete aliases to phar's that got kicked out of the global table
*/
-static int phar_unalias_apply(zval *zv, void *argument TSRMLS_DC) /* {{{ */
+static int phar_unalias_apply(zval *zv, void *argument) /* {{{ */
{
return Z_PTR_P(zv) == argument ? ZEND_HASH_APPLY_REMOVE : ZEND_HASH_APPLY_KEEP;
}
@@ -332,7 +331,7 @@ static int phar_unalias_apply(zval *zv, void *argument TSRMLS_DC) /* {{{ */
/**
* Delete aliases to phar's that got kicked out of the global table
*/
-static int phar_tmpclose_apply(zval *zv TSRMLS_DC) /* {{{ */
+static int phar_tmpclose_apply(zval *zv) /* {{{ */
{
phar_entry_info *entry = (phar_entry_info *) Z_PTR_P(zv);
@@ -355,20 +354,19 @@ static int phar_tmpclose_apply(zval *zv TSRMLS_DC) /* {{{ */
static void destroy_phar_data(zval *zv) /* {{{ */
{
phar_archive_data *phar_data = (phar_archive_data *)Z_PTR_P(zv);
- TSRMLS_FETCH();
if (PHAR_GLOBALS->request_ends) {
/* first, iterate over the manifest and close all PHAR_TMP entry fp handles,
this prevents unnecessary unfreed stream resources */
- zend_hash_apply(&(phar_data->manifest), phar_tmpclose_apply TSRMLS_CC);
+ zend_hash_apply(&(phar_data->manifest), phar_tmpclose_apply);
destroy_phar_data_only(zv);
return;
}
- zend_hash_apply_with_argument(&(PHAR_GLOBALS->phar_alias_map), phar_unalias_apply, phar_data TSRMLS_CC);
+ zend_hash_apply_with_argument(&(PHAR_GLOBALS->phar_alias_map), phar_unalias_apply, phar_data);
if (--phar_data->refcount < 0) {
- phar_destroy_phar_data(phar_data TSRMLS_CC);
+ phar_destroy_phar_data(phar_data);
}
}
/* }}}*/
@@ -378,7 +376,6 @@ static void destroy_phar_data(zval *zv) /* {{{ */
*/
void destroy_phar_manifest_entry_int(phar_entry_info *entry) /* {{{ */
{
- TSRMLS_FETCH();
if (entry->cfp) {
php_stream_close(entry->cfp);
@@ -432,7 +429,7 @@ void destroy_phar_manifest_entry(zval *zv) /* {{{ */
}
/* }}} */
-int phar_entry_delref(phar_entry_data *idata TSRMLS_DC) /* {{{ */
+int phar_entry_delref(phar_entry_data *idata) /* {{{ */
{
int ret = 0;
@@ -451,7 +448,7 @@ int phar_entry_delref(phar_entry_data *idata TSRMLS_DC) /* {{{ */
}
}
- phar_archive_delref(idata->phar TSRMLS_CC);
+ phar_archive_delref(idata->phar);
efree(idata);
return ret;
}
@@ -460,7 +457,7 @@ int phar_entry_delref(phar_entry_data *idata TSRMLS_DC) /* {{{ */
/**
* Removes an entry, either by actually removing it or by marking it.
*/
-void phar_entry_remove(phar_entry_data *idata, char **error TSRMLS_DC) /* {{{ */
+void phar_entry_remove(phar_entry_data *idata, char **error) /* {{{ */
{
phar_archive_data *phar;
@@ -475,11 +472,11 @@ void phar_entry_remove(phar_entry_data *idata, char **error TSRMLS_DC) /* {{{ */
efree(idata);
} else {
idata->internal_file->is_deleted = 1;
- phar_entry_delref(idata TSRMLS_CC);
+ phar_entry_delref(idata);
}
if (!phar->donotflush) {
- phar_flush(phar, 0, 0, 0, error TSRMLS_CC);
+ phar_flush(phar, 0, 0, 0, error);
}
}
/* }}} */
@@ -496,7 +493,7 @@ void phar_entry_remove(phar_entry_data *idata, char **error TSRMLS_DC) /* {{{ */
#define MAPPHAR_FAIL(msg) \
efree(savebuf);\
if (mydata) {\
- phar_destroy_phar_data(mydata TSRMLS_CC);\
+ phar_destroy_phar_data(mydata);\
}\
if (signature) {\
pefree(signature, PHAR_G(persist));\
@@ -532,7 +529,7 @@ void phar_entry_remove(phar_entry_data *idata, char **error TSRMLS_DC) /* {{{ */
/**
* Open an already loaded phar
*/
-int phar_open_parsed_phar(char *fname, int fname_len, char *alias, int alias_len, int is_data, int options, phar_archive_data** pphar, char **error TSRMLS_DC) /* {{{ */
+int phar_open_parsed_phar(char *fname, int fname_len, char *alias, int alias_len, int is_data, int options, phar_archive_data** pphar, char **error) /* {{{ */
{
phar_archive_data *phar;
#ifdef PHP_WIN32
@@ -546,14 +543,14 @@ int phar_open_parsed_phar(char *fname, int fname_len, char *alias, int alias_len
unixfname = estrndup(fname, fname_len);
phar_unixify_path_separators(unixfname, fname_len);
- if (SUCCESS == phar_get_archive(&phar, unixfname, fname_len, alias, alias_len, error TSRMLS_CC)
+ if (SUCCESS == phar_get_archive(&phar, unixfname, fname_len, alias, alias_len, error)
&& ((alias && fname_len == phar->fname_len
&& !strncmp(unixfname, phar->fname, fname_len)) || !alias)
) {
phar_entry_info *stub;
efree(unixfname);
#else
- if (SUCCESS == phar_get_archive(&phar, fname, fname_len, alias, alias_len, error TSRMLS_CC)
+ if (SUCCESS == phar_get_archive(&phar, fname, fname_len, alias, alias_len, error)
&& ((alias && fname_len == phar->fname_len
&& !strncmp(fname, phar->fname, fname_len)) || !alias)
) {
@@ -607,7 +604,7 @@ int phar_open_parsed_phar(char *fname, int fname_len, char *alias, int alias_len
*
* data is the serialized zval
*/
-int phar_parse_metadata(char **buffer, zval *metadata, int zip_metadata_len TSRMLS_DC) /* {{{ */
+int phar_parse_metadata(char **buffer, zval *metadata, int zip_metadata_len) /* {{{ */
{
const unsigned char *p;
php_uint32 buf_len;
@@ -624,7 +621,7 @@ int phar_parse_metadata(char **buffer, zval *metadata, int zip_metadata_len TSRM
p = (const unsigned char*) *buffer;
PHP_VAR_UNSERIALIZE_INIT(var_hash);
- if (!php_var_unserialize(metadata, &p, p + buf_len, &var_hash TSRMLS_CC)) {
+ if (!php_var_unserialize(metadata, &p, p + buf_len, &var_hash)) {
PHP_VAR_UNSERIALIZE_DESTROY(var_hash);
zval_ptr_dtor(metadata);
ZVAL_UNDEF(metadata);
@@ -662,7 +659,7 @@ int phar_parse_metadata(char **buffer, zval *metadata, int zip_metadata_len TSRM
* This is used by phar_open_from_filename to process the manifest, but can be called
* directly.
*/
-static int phar_parse_pharfile(php_stream *fp, char *fname, int fname_len, char *alias, int alias_len, zend_long halt_offset, phar_archive_data** pphar, php_uint32 compression, char **error TSRMLS_DC) /* {{{ */
+static int phar_parse_pharfile(php_stream *fp, char *fname, int fname_len, char *alias, int alias_len, zend_long halt_offset, phar_archive_data** pphar, php_uint32 compression, char **error) /* {{{ */
{
char b32[4], *buffer, *endbuffer, *savebuf;
phar_archive_data *mydata = NULL;
@@ -823,7 +820,7 @@ static int phar_parse_pharfile(php_stream *fp, char *fname, int fname_len, char
return FAILURE;
}
- if (FAILURE == phar_verify_signature(fp, end_of_phar, PHAR_SIG_OPENSSL, sig, signature_len, fname, &signature, &sig_len, error TSRMLS_CC)) {
+ if (FAILURE == phar_verify_signature(fp, end_of_phar, PHAR_SIG_OPENSSL, sig, signature_len, fname, &signature, &sig_len, error)) {
efree(savebuf);
efree(sig);
php_stream_close(fp);
@@ -853,7 +850,7 @@ static int phar_parse_pharfile(php_stream *fp, char *fname, int fname_len, char
return FAILURE;
}
- if (FAILURE == phar_verify_signature(fp, read_len, PHAR_SIG_SHA512, (char *)digest, 64, fname, &signature, &sig_len, error TSRMLS_CC)) {
+ if (FAILURE == phar_verify_signature(fp, read_len, PHAR_SIG_SHA512, (char *)digest, 64, fname, &signature, &sig_len, error)) {
efree(savebuf);
php_stream_close(fp);
if (error) {
@@ -880,7 +877,7 @@ static int phar_parse_pharfile(php_stream *fp, char *fname, int fname_len, char
return FAILURE;
}
- if (FAILURE == phar_verify_signature(fp, read_len, PHAR_SIG_SHA256, (char *)digest, 32, fname, &signature, &sig_len, error TSRMLS_CC)) {
+ if (FAILURE == phar_verify_signature(fp, read_len, PHAR_SIG_SHA256, (char *)digest, 32, fname, &signature, &sig_len, error)) {
efree(savebuf);
php_stream_close(fp);
if (error) {
@@ -918,7 +915,7 @@ static int phar_parse_pharfile(php_stream *fp, char *fname, int fname_len, char
return FAILURE;
}
- if (FAILURE == phar_verify_signature(fp, read_len, PHAR_SIG_SHA1, (char *)digest, 20, fname, &signature, &sig_len, error TSRMLS_CC)) {
+ if (FAILURE == phar_verify_signature(fp, read_len, PHAR_SIG_SHA1, (char *)digest, 20, fname, &signature, &sig_len, error)) {
efree(savebuf);
php_stream_close(fp);
if (error) {
@@ -945,7 +942,7 @@ static int phar_parse_pharfile(php_stream *fp, char *fname, int fname_len, char
return FAILURE;
}
- if (FAILURE == phar_verify_signature(fp, read_len, PHAR_SIG_MD5, (char *)digest, 16, fname, &signature, &sig_len, error TSRMLS_CC)) {
+ if (FAILURE == phar_verify_signature(fp, read_len, PHAR_SIG_MD5, (char *)digest, 16, fname, &signature, &sig_len, error)) {
efree(savebuf);
php_stream_close(fp);
if (error) {
@@ -1036,11 +1033,11 @@ static int phar_parse_pharfile(php_stream *fp, char *fname, int fname_len, char
/* check whether we have meta data, zero check works regardless of byte order */
if (mydata->is_persistent) {
PHAR_GET_32(buffer, mydata->metadata_len);
- if (phar_parse_metadata(&buffer, &mydata->metadata, mydata->metadata_len TSRMLS_CC) == FAILURE) {
+ if (phar_parse_metadata(&buffer, &mydata->metadata, mydata->metadata_len) == FAILURE) {
MAPPHAR_FAIL("unable to read phar metadata in .phar file \"%s\"");
}
} else {
- if (phar_parse_metadata(&buffer, &mydata->metadata, 0 TSRMLS_CC) == FAILURE) {
+ if (phar_parse_metadata(&buffer, &mydata->metadata, 0) == FAILURE) {
MAPPHAR_FAIL("unable to read phar metadata in .phar file \"%s\"");
}
}
@@ -1088,7 +1085,7 @@ static int phar_parse_pharfile(php_stream *fp, char *fname, int fname_len, char
entry.is_dir = 0;
}
- phar_add_virtual_dirs(mydata, buffer, entry.filename_len TSRMLS_CC);
+ phar_add_virtual_dirs(mydata, buffer, entry.filename_len);
entry.filename = pestrndup(buffer, entry.filename_len, entry.is_persistent);
buffer += entry.filename_len;
PHAR_GET_32(buffer, entry.uncompressed_filesize);
@@ -1117,12 +1114,12 @@ static int phar_parse_pharfile(php_stream *fp, char *fname, int fname_len, char
if (entry.is_persistent) {
PHAR_GET_32(buffer, entry.metadata_len);
if (!entry.metadata_len) buffer -= 4;
- if (phar_parse_metadata(&buffer, &entry.metadata, entry.metadata_len TSRMLS_CC) == FAILURE) {
+ if (phar_parse_metadata(&buffer, &entry.metadata, entry.metadata_len) == FAILURE) {
pefree(entry.filename, entry.is_persistent);
MAPPHAR_FAIL("unable to read file metadata in .phar file \"%s\"");
}
} else {
- if (phar_parse_metadata(&buffer, &entry.metadata, 0 TSRMLS_CC) == FAILURE) {
+ if (phar_parse_metadata(&buffer, &entry.metadata, 0) == FAILURE) {
pefree(entry.filename, entry.is_persistent);
MAPPHAR_FAIL("unable to read file metadata in .phar file \"%s\"");
}
@@ -1176,7 +1173,7 @@ static int phar_parse_pharfile(php_stream *fp, char *fname, int fname_len, char
manifest_flags |= (entry.flags & PHAR_ENT_COMPRESSION_MASK);
/* if signature matched, no need to check CRC32 for each file */
entry.is_crc_checked = (manifest_flags & PHAR_HDR_SIGNATURE ? 1 : 0);
- phar_set_inode(&entry TSRMLS_CC);
+ phar_set_inode(&entry);
zend_hash_str_add_mem(&mydata->manifest, entry.filename, entry.filename_len, (void*)&entry, sizeof(phar_entry_info));
}
@@ -1204,7 +1201,7 @@ static int phar_parse_pharfile(php_stream *fp, char *fname, int fname_len, char
mydata->fp = fp;
mydata->sig_len = sig_len;
mydata->signature = signature;
- phar_request_initialize(TSRMLS_C);
+ phar_request_initialize();
if (register_alias) {
phar_archive_data *fd_ptr;
@@ -1218,7 +1215,7 @@ static int phar_parse_pharfile(php_stream *fp, char *fname, int fname_len, char
}
if (NULL != (fd_ptr = zend_hash_str_find_ptr(&(PHAR_GLOBALS->phar_alias_map), alias, alias_len))) {
- if (SUCCESS != phar_free_alias(fd_ptr, alias, alias_len TSRMLS_CC)) {
+ if (SUCCESS != phar_free_alias(fd_ptr, alias, alias_len)) {
signature = NULL;
fp = NULL;
MAPPHAR_FAIL("Cannot open archive \"%s\", alias is already in use by existing archive");
@@ -1244,7 +1241,7 @@ static int phar_parse_pharfile(php_stream *fp, char *fname, int fname_len, char
/**
* Create or open a phar for writing
*/
-int phar_open_or_create_filename(char *fname, int fname_len, char *alias, int alias_len, int is_data, int options, phar_archive_data** pphar, char **error TSRMLS_DC) /* {{{ */
+int phar_open_or_create_filename(char *fname, int fname_len, char *alias, int alias_len, int is_data, int options, phar_archive_data** pphar, char **error) /* {{{ */
{
const char *ext_str, *z;
char *my_error;
@@ -1258,12 +1255,12 @@ int phar_open_or_create_filename(char *fname, int fname_len, char *alias, int al
}
/* first try to open an existing file */
- if (phar_detect_phar_fname_ext(fname, fname_len, &ext_str, &ext_len, !is_data, 0, 1 TSRMLS_CC) == SUCCESS) {
+ if (phar_detect_phar_fname_ext(fname, fname_len, &ext_str, &ext_len, !is_data, 0, 1) == SUCCESS) {
goto check_file;
}
/* next try to create a new file */
- if (FAILURE == phar_detect_phar_fname_ext(fname, fname_len, &ext_str, &ext_len, !is_data, 1, 1 TSRMLS_CC)) {
+ if (FAILURE == phar_detect_phar_fname_ext(fname, fname_len, &ext_str, &ext_len, !is_data, 1, 1)) {
if (error) {
if (ext_len == -2) {
spprintf(error, 0, "Cannot create a phar archive from a URL like \"%s\". Phar objects can only be created from local files", fname);
@@ -1274,7 +1271,7 @@ int phar_open_or_create_filename(char *fname, int fname_len, char *alias, int al
return FAILURE;
}
check_file:
- if (phar_open_parsed_phar(fname, fname_len, alias, alias_len, is_data, options, test, &my_error TSRMLS_CC) == SUCCESS) {
+ if (phar_open_parsed_phar(fname, fname_len, alias, alias_len, is_data, options, test, &my_error) == SUCCESS) {
if (pphar) {
*pphar = *test;
}
@@ -1309,19 +1306,19 @@ check_file:
if (ext_len > 3 && (z = memchr(ext_str, 'z', ext_len)) && ((ext_str + ext_len) - z >= 2) && !memcmp(z + 1, "ip", 2)) {
/* assume zip-based phar */
- return phar_open_or_create_zip(fname, fname_len, alias, alias_len, is_data, options, pphar, error TSRMLS_CC);
+ return phar_open_or_create_zip(fname, fname_len, alias, alias_len, is_data, options, pphar, error);
}
if (ext_len > 3 && (z = memchr(ext_str, 't', ext_len)) && ((ext_str + ext_len) - z >= 2) && !memcmp(z + 1, "ar", 2)) {
/* assume tar-based phar */
- return phar_open_or_create_tar(fname, fname_len, alias, alias_len, is_data, options, pphar, error TSRMLS_CC);
+ return phar_open_or_create_tar(fname, fname_len, alias, alias_len, is_data, options, pphar, error);
}
- return phar_create_or_parse_filename(fname, fname_len, alias, alias_len, is_data, options, pphar, error TSRMLS_CC);
+ return phar_create_or_parse_filename(fname, fname_len, alias, alias_len, is_data, options, pphar, error);
}
/* }}} */
-int phar_create_or_parse_filename(char *fname, int fname_len, char *alias, int alias_len, int is_data, int options, phar_archive_data** pphar, char **error TSRMLS_DC) /* {{{ */
+int phar_create_or_parse_filename(char *fname, int fname_len, char *alias, int alias_len, int is_data, int options, phar_archive_data** pphar, char **error) /* {{{ */
{
phar_archive_data *mydata;
php_stream *fp;
@@ -1335,7 +1332,7 @@ int phar_create_or_parse_filename(char *fname, int fname_len, char *alias, int a
return FAILURE;
}
#endif
- if (php_check_open_basedir(fname TSRMLS_CC)) {
+ if (php_check_open_basedir(fname)) {
return FAILURE;
}
@@ -1348,7 +1345,7 @@ int phar_create_or_parse_filename(char *fname, int fname_len, char *alias, int a
}
if (fp) {
- if (phar_open_from_fp(fp, fname, fname_len, alias, alias_len, options, pphar, is_data, error TSRMLS_CC) == SUCCESS) {
+ if (phar_open_from_fp(fp, fname, fname_len, alias, alias_len, options, pphar, is_data, error) == SUCCESS) {
if ((*pphar)->is_data || !PHAR_G(readonly)) {
(*pphar)->is_writeable = 1;
}
@@ -1380,7 +1377,7 @@ int phar_create_or_parse_filename(char *fname, int fname_len, char *alias, int a
/* set up our manifest */
mydata = ecalloc(1, sizeof(phar_archive_data));
- mydata->fname = expand_filepath(fname, NULL TSRMLS_CC);
+ mydata->fname = expand_filepath(fname, NULL);
fname_len = strlen(mydata->fname);
#ifdef PHP_WIN32
phar_unixify_path_separators(mydata->fname, fname_len);
@@ -1414,7 +1411,7 @@ int phar_create_or_parse_filename(char *fname, int fname_len, char *alias, int a
mydata->fp = NULL;
mydata->is_writeable = 1;
mydata->is_brandnew = 1;
- phar_request_initialize(TSRMLS_C);
+ phar_request_initialize();
zend_hash_str_add_ptr(&(PHAR_GLOBALS->phar_fname_map), mydata->fname, fname_len, mydata);
if (is_data) {
@@ -1427,7 +1424,7 @@ int phar_create_or_parse_filename(char *fname, int fname_len, char *alias, int a
phar_archive_data *fd_ptr;
if (alias && NULL != (fd_ptr = zend_hash_str_find_ptr(&(PHAR_GLOBALS->phar_alias_map), alias, alias_len))) {
- if (SUCCESS != phar_free_alias(fd_ptr, alias, alias_len TSRMLS_CC)) {
+ if (SUCCESS != phar_free_alias(fd_ptr, alias, alias_len)) {
if (error) {
spprintf(error, 4096, "phar error: phar \"%s\" cannot set alias \"%s\", already in use by another phar archive", mydata->fname, alias);
}
@@ -1475,7 +1472,7 @@ int phar_create_or_parse_filename(char *fname, int fname_len, char *alias, int a
* that the manifest is proper, then pass it to phar_parse_pharfile(). SUCCESS
* or FAILURE is returned and pphar is set to a pointer to the phar's manifest
*/
-int phar_open_from_filename(char *fname, int fname_len, char *alias, int alias_len, int options, phar_archive_data** pphar, char **error TSRMLS_DC) /* {{{ */
+int phar_open_from_filename(char *fname, int fname_len, char *alias, int alias_len, int options, phar_archive_data** pphar, char **error) /* {{{ */
{
php_stream *fp;
char *actual;
@@ -1489,7 +1486,7 @@ int phar_open_from_filename(char *fname, int fname_len, char *alias, int alias_l
is_data = 1;
}
- if (phar_open_parsed_phar(fname, fname_len, alias, alias_len, is_data, options, pphar, error TSRMLS_CC) == SUCCESS) {
+ if (phar_open_parsed_phar(fname, fname_len, alias, alias_len, is_data, options, pphar, error) == SUCCESS) {
return SUCCESS;
} else if (error && *error) {
return FAILURE;
@@ -1499,7 +1496,7 @@ int phar_open_from_filename(char *fname, int fname_len, char *alias, int alias_l
return FAILURE;
}
#endif
- if (php_check_open_basedir(fname TSRMLS_CC)) {
+ if (php_check_open_basedir(fname)) {
return FAILURE;
}
@@ -1522,7 +1519,7 @@ int phar_open_from_filename(char *fname, int fname_len, char *alias, int alias_l
fname_len = strlen(actual);
}
- ret = phar_open_from_fp(fp, fname, fname_len, alias, alias_len, options, pphar, is_data, error TSRMLS_CC);
+ ret = phar_open_from_fp(fp, fname, fname_len, alias, alias_len, options, pphar, is_data, error);
if (actual) {
efree(actual);
@@ -1566,7 +1563,7 @@ static inline char *phar_strnstr(const char *buf, int buf_len, const char *searc
* that the manifest is proper, then pass it to phar_parse_pharfile(). SUCCESS
* or FAILURE is returned and pphar is set to a pointer to the phar's manifest
*/
-static int phar_open_from_fp(php_stream* fp, char *fname, int fname_len, char *alias, int alias_len, int options, phar_archive_data** pphar, int is_data, char **error TSRMLS_DC) /* {{{ */
+static int phar_open_from_fp(php_stream* fp, char *fname, int fname_len, char *alias, int alias_len, int options, phar_archive_data** pphar, int is_data, char **error) /* {{{ */
{
const char token[] = "__HALT_COMPILER();";
const char zip_magic[] = "PK\x03\x04";
@@ -1626,12 +1623,12 @@ static int phar_open_from_fp(php_stream* fp, char *fname, int fname_len, char *a
}
php_stream_rewind(fp);
- filter = php_stream_filter_create("zlib.inflate", &filterparams, php_stream_is_persistent(fp) TSRMLS_CC);
+ filter = php_stream_filter_create("zlib.inflate", &filterparams, php_stream_is_persistent(fp));
if (!filter) {
err = 1;
add_assoc_long_ex(&filterparams, "window", sizeof("window") - 1, MAX_WBITS);
- filter = php_stream_filter_create("zlib.inflate", &filterparams, php_stream_is_persistent(fp) TSRMLS_CC);
+ filter = php_stream_filter_create("zlib.inflate", &filterparams, php_stream_is_persistent(fp));
zval_dtor(&filterparams);
if (!filter) {
@@ -1654,7 +1651,7 @@ static int phar_open_from_fp(php_stream* fp, char *fname, int fname_len, char *a
}
php_stream_filter_flush(filter, 1);
- php_stream_filter_remove(filter, 1 TSRMLS_CC);
+ php_stream_filter_remove(filter, 1);
php_stream_close(fp);
fp = temp;
php_stream_rewind(fp);
@@ -1677,7 +1674,7 @@ static int phar_open_from_fp(php_stream* fp, char *fname, int fname_len, char *a
}
php_stream_rewind(fp);
- filter = php_stream_filter_create("bzip2.decompress", NULL, php_stream_is_persistent(fp) TSRMLS_CC);
+ filter = php_stream_filter_create("bzip2.decompress", NULL, php_stream_is_persistent(fp));
if (!filter) {
php_stream_close(temp);
@@ -1692,7 +1689,7 @@ static int phar_open_from_fp(php_stream* fp, char *fname, int fname_len, char *a
}
php_stream_filter_flush(filter, 1);
- php_stream_filter_remove(filter, 1 TSRMLS_CC);
+ php_stream_filter_remove(filter, 1);
php_stream_close(fp);
fp = temp;
php_stream_rewind(fp);
@@ -1705,20 +1702,20 @@ static int phar_open_from_fp(php_stream* fp, char *fname, int fname_len, char *a
if (!memcmp(pos, zip_magic, 4)) {
php_stream_seek(fp, 0, SEEK_END);
- return phar_parse_zipfile(fp, fname, fname_len, alias, alias_len, pphar, error TSRMLS_CC);
+ return phar_parse_zipfile(fp, fname, fname_len, alias, alias_len, pphar, error);
}
if (got > 512) {
if (phar_is_tar(pos, fname)) {
php_stream_rewind(fp);
- return phar_parse_tarfile(fp, fname, fname_len, alias, alias_len, pphar, is_data, compression, error TSRMLS_CC);
+ return phar_parse_tarfile(fp, fname, fname_len, alias, alias_len, pphar, is_data, compression, error);
}
}
}
if (got > 0 && (pos = phar_strnstr(buffer, got + sizeof(token), token, sizeof(token)-1)) != NULL) {
halt_offset += (pos - buffer); /* no -tokenlen+tokenlen here */
- return phar_parse_pharfile(fp, fname, fname_len, alias, alias_len, halt_offset, pphar, compression, error TSRMLS_CC);
+ return phar_parse_pharfile(fp, fname, fname_len, alias, alias_len, halt_offset, pphar, compression, error);
}
halt_offset += got;
@@ -1738,13 +1735,13 @@ static int phar_open_from_fp(php_stream* fp, char *fname, int fname_len, char *a
* if not, check to see if its dirname() exists (i.e. "/path/to") and is a directory
* succeed if we are creating the file, otherwise fail.
*/
-static int phar_analyze_path(const char *fname, const char *ext, int ext_len, int for_create TSRMLS_DC) /* {{{ */
+static int phar_analyze_path(const char *fname, const char *ext, int ext_len, int for_create) /* {{{ */
{
php_stream_statbuf ssb;
char *realpath;
char *filename = estrndup(fname, (ext - fname) + ext_len);
- if ((realpath = expand_filepath(filename, NULL TSRMLS_CC))) {
+ if ((realpath = expand_filepath(filename, NULL))) {
#ifdef PHP_WIN32
phar_unixify_path_separators(realpath, strlen(realpath));
#endif
@@ -1791,7 +1788,7 @@ static int phar_analyze_path(const char *fname, const char *ext, int ext_len, in
if (SUCCESS != php_stream_stat_path((char *) filename, &ssb)) {
if (!slash) {
- if (!(realpath = expand_filepath(filename, NULL TSRMLS_CC))) {
+ if (!(realpath = expand_filepath(filename, NULL))) {
efree(filename);
return FAILURE;
}
@@ -1840,7 +1837,7 @@ static int phar_analyze_path(const char *fname, const char *ext, int ext_len, in
/* }}} */
/* check for ".phar" in extension */
-static int phar_check_str(const char *fname, const char *ext_str, int ext_len, int executable, int for_create TSRMLS_DC) /* {{{ */
+static int phar_check_str(const char *fname, const char *ext_str, int ext_len, int executable, int for_create) /* {{{ */
{
char test[51];
const char *pos;
@@ -1859,7 +1856,7 @@ static int phar_check_str(const char *fname, const char *ext_str, int ext_len, i
if (pos && (*(pos - 1) != '/')
&& (pos += 5) && (*pos == '\0' || *pos == '/' || *pos == '.')) {
- return phar_analyze_path(fname, ext_str, ext_len, for_create TSRMLS_CC);
+ return phar_analyze_path(fname, ext_str, ext_len, for_create);
} else {
return FAILURE;
}
@@ -1870,11 +1867,11 @@ static int phar_check_str(const char *fname, const char *ext_str, int ext_len, i
pos = strstr(ext_str, ".phar");
if (!(pos && (*(pos - 1) != '/')
&& (pos += 5) && (*pos == '\0' || *pos == '/' || *pos == '.')) && *(ext_str + 1) != '.' && *(ext_str + 1) != '/' && *(ext_str + 1) != '\0') {
- return phar_analyze_path(fname, ext_str, ext_len, for_create TSRMLS_CC);
+ return phar_analyze_path(fname, ext_str, ext_len, for_create);
}
} else {
if (*(ext_str + 1) != '.' && *(ext_str + 1) != '/' && *(ext_str + 1) != '\0') {
- return phar_analyze_path(fname, ext_str, ext_len, for_create TSRMLS_CC);
+ return phar_analyze_path(fname, ext_str, ext_len, for_create);
}
}
@@ -1895,7 +1892,7 @@ static int phar_check_str(const char *fname, const char *ext_str, int ext_len, i
* the last parameter should be set to tell the thing to assume that filename is the full path, and only to check the
* extension rules, not to iterate.
*/
-int phar_detect_phar_fname_ext(const char *filename, int filename_len, const char **ext_str, int *ext_len, int executable, int for_create, int is_complete TSRMLS_DC) /* {{{ */
+int phar_detect_phar_fname_ext(const char *filename, int filename_len, const char **ext_str, int *ext_len, int executable, int for_create, int is_complete) /* {{{ */
{
const char *pos, *slash;
@@ -1906,7 +1903,7 @@ int phar_detect_phar_fname_ext(const char *filename, int filename_len, const cha
return FAILURE;
}
- phar_request_initialize(TSRMLS_C);
+ phar_request_initialize();
/* first check for alias in first segment */
pos = memchr(filename, '/', filename_len);
@@ -2023,7 +2020,7 @@ next_extension:
*ext_len = strlen(pos);
/* file extension must contain "phar" */
- switch (phar_check_str(filename, *ext_str, *ext_len, executable, for_create TSRMLS_CC)) {
+ switch (phar_check_str(filename, *ext_str, *ext_len, executable, for_create)) {
case SUCCESS:
return SUCCESS;
case FAILURE:
@@ -2036,7 +2033,7 @@ next_extension:
*ext_str = pos;
*ext_len = slash - pos;
- switch (phar_check_str(filename, *ext_str, *ext_len, executable, for_create TSRMLS_CC)) {
+ switch (phar_check_str(filename, *ext_str, *ext_len, executable, for_create)) {
case SUCCESS:
return SUCCESS;
case FAILURE:
@@ -2075,7 +2072,7 @@ static int php_check_dots(const char *element, int n) /* {{{ */
/**
* Remove .. and . references within a phar filename
*/
-char *phar_fix_filepath(char *path, int *new_len, int use_cwd TSRMLS_DC) /* {{{ */
+char *phar_fix_filepath(char *path, int *new_len, int use_cwd) /* {{{ */
{
char newpath[MAXPATHLEN];
int newpath_len;
@@ -2183,7 +2180,7 @@ last_time:
*
* This is used by phar_parse_url()
*/
-int phar_split_fname(const char *filename, int filename_len, char **arch, int *arch_len, char **entry, int *entry_len, int executable, int for_create TSRMLS_DC) /* {{{ */
+int phar_split_fname(const char *filename, int filename_len, char **arch, int *arch_len, char **entry, int *entry_len, int executable, int for_create) /* {{{ */
{
const char *ext_str;
#ifdef PHP_WIN32
@@ -2202,7 +2199,7 @@ int phar_split_fname(const char *filename, int filename_len, char **arch, int *a
filename = estrndup(filename, filename_len);
phar_unixify_path_separators(filename, filename_len);
#endif
- if (phar_detect_phar_fname_ext(filename, filename_len, &ext_str, &ext_len, executable, for_create, 0 TSRMLS_CC) == FAILURE) {
+ if (phar_detect_phar_fname_ext(filename, filename_len, &ext_str, &ext_len, executable, for_create, 0) == FAILURE) {
if (ext_len != -1) {
if (!ext_str) {
/* no / detected, restore arch for error message */
@@ -2232,7 +2229,7 @@ int phar_split_fname(const char *filename, int filename_len, char **arch, int *a
#ifdef PHP_WIN32
phar_unixify_path_separators(*entry, *entry_len);
#endif
- *entry = phar_fix_filepath(*entry, entry_len, 0 TSRMLS_CC);
+ *entry = phar_fix_filepath(*entry, entry_len, 0);
} else {
*entry_len = 1;
*entry = estrndup("/", 1);
@@ -2250,7 +2247,7 @@ int phar_split_fname(const char *filename, int filename_len, char **arch, int *a
* Invoked when a user calls Phar::mapPhar() from within an executing .phar
* to set up its manifest directly
*/
-int phar_open_executed_filename(char *alias, int alias_len, char **error TSRMLS_DC) /* {{{ */
+int phar_open_executed_filename(char *alias, int alias_len, char **error) /* {{{ */
{
char *fname;
php_stream *fp;
@@ -2262,10 +2259,10 @@ int phar_open_executed_filename(char *alias, int alias_len, char **error TSRMLS_
*error = NULL;
}
- fname = (char*)zend_get_executed_filename(TSRMLS_C);
+ fname = (char*)zend_get_executed_filename();
fname_len = strlen(fname);
- if (phar_open_parsed_phar(fname, fname_len, alias, alias_len, 0, REPORT_ERRORS, NULL, 0 TSRMLS_CC) == SUCCESS) {
+ if (phar_open_parsed_phar(fname, fname_len, alias, alias_len, 0, REPORT_ERRORS, NULL, 0) == SUCCESS) {
return SUCCESS;
}
@@ -2276,7 +2273,7 @@ int phar_open_executed_filename(char *alias, int alias_len, char **error TSRMLS_
return FAILURE;
}
- if (0 == zend_get_constant_str("__COMPILER_HALT_OFFSET__", sizeof("__COMPILER_HALT_OFFSET__")-1 TSRMLS_CC)) {
+ if (0 == zend_get_constant_str("__COMPILER_HALT_OFFSET__", sizeof("__COMPILER_HALT_OFFSET__")-1)) {
if (error) {
spprintf(error, 0, "__HALT_COMPILER(); must be declared in a phar");
}
@@ -2290,7 +2287,7 @@ int phar_open_executed_filename(char *alias, int alias_len, char **error TSRMLS_
}
#endif
- if (php_check_open_basedir(fname TSRMLS_CC)) {
+ if (php_check_open_basedir(fname)) {
return FAILURE;
}
@@ -2311,7 +2308,7 @@ int phar_open_executed_filename(char *alias, int alias_len, char **error TSRMLS_
fname_len = strlen(actual);
}
- ret = phar_open_from_fp(fp, fname, fname_len, alias, alias_len, REPORT_ERRORS, NULL, 0, error TSRMLS_CC);
+ ret = phar_open_from_fp(fp, fname, fname_len, alias, alias_len, REPORT_ERRORS, NULL, 0, error);
if (actual) {
efree(actual);
@@ -2324,7 +2321,7 @@ int phar_open_executed_filename(char *alias, int alias_len, char **error TSRMLS_
/**
* Validate the CRC32 of a file opened from within the phar
*/
-int phar_postprocess_file(phar_entry_data *idata, php_uint32 crc32, char **error, int process_zip TSRMLS_DC) /* {{{ */
+int phar_postprocess_file(phar_entry_data *idata, php_uint32 crc32, char **error, int process_zip) /* {{{ */
{
php_uint32 crc = ~0;
int len = idata->internal_file->uncompressed_filesize;
@@ -2340,13 +2337,13 @@ int phar_postprocess_file(phar_entry_data *idata, php_uint32 crc32, char **error
phar_zip_file_header local;
phar_zip_data_desc desc;
- if (SUCCESS != phar_open_archive_fp(idata->phar TSRMLS_CC)) {
+ if (SUCCESS != phar_open_archive_fp(idata->phar)) {
spprintf(error, 0, "phar error: unable to open zip-based phar archive \"%s\" to verify local file header for file \"%s\"", idata->phar->fname, entry->filename);
return FAILURE;
}
- php_stream_seek(phar_get_entrypfp(idata->internal_file TSRMLS_CC), entry->header_offset, SEEK_SET);
+ php_stream_seek(phar_get_entrypfp(idata->internal_file), entry->header_offset, SEEK_SET);
- if (sizeof(local) != php_stream_read(phar_get_entrypfp(idata->internal_file TSRMLS_CC), (char *) &local, sizeof(local))) {
+ if (sizeof(local) != php_stream_read(phar_get_entrypfp(idata->internal_file), (char *) &local, sizeof(local))) {
spprintf(error, 0, "phar error: internal corruption of zip-based phar \"%s\" (cannot read local file header for file \"%s\")", idata->phar->fname, entry->filename);
return FAILURE;
@@ -2354,12 +2351,12 @@ int phar_postprocess_file(phar_entry_data *idata, php_uint32 crc32, char **error
/* check for data descriptor */
if (((PHAR_ZIP_16(local.flags)) & 0x8) == 0x8) {
- php_stream_seek(phar_get_entrypfp(idata->internal_file TSRMLS_CC),
+ php_stream_seek(phar_get_entrypfp(idata->internal_file),
entry->header_offset + sizeof(local) +
PHAR_ZIP_16(local.filename_len) +
PHAR_ZIP_16(local.extra_len) +
entry->compressed_filesize, SEEK_SET);
- if (sizeof(desc) != php_stream_read(phar_get_entrypfp(idata->internal_file TSRMLS_CC),
+ if (sizeof(desc) != php_stream_read(phar_get_entrypfp(idata->internal_file),
(char *) &desc, sizeof(desc))) {
spprintf(error, 0, "phar error: internal corruption of zip-based phar \"%s\" (cannot read local data descriptor for file \"%s\")", idata->phar->fname, entry->filename);
return FAILURE;
@@ -2420,7 +2417,7 @@ static inline void phar_set_32(char *buffer, int var) /* {{{ */
#endif
} /* }}} */
-static int phar_flush_clean_deleted_apply(zval *zv TSRMLS_DC) /* {{{ */
+static int phar_flush_clean_deleted_apply(zval *zv) /* {{{ */
{
phar_entry_info *entry = (phar_entry_info *)Z_PTR_P(zv);
@@ -2434,7 +2431,7 @@ static int phar_flush_clean_deleted_apply(zval *zv TSRMLS_DC) /* {{{ */
#include "stub.h"
-char *phar_create_default_stub(const char *index_php, const char *web_index, size_t *len, char **error TSRMLS_DC) /* {{{ */
+char *phar_create_default_stub(const char *index_php, const char *web_index, size_t *len, char **error) /* {{{ */
{
char *stub = NULL;
int index_len, web_len;
@@ -2475,7 +2472,7 @@ char *phar_create_default_stub(const char *index_php, const char *web_index, siz
}
}
- phar_get_stub(index_php, web_index, len, &stub, index_len+1, web_len+1 TSRMLS_CC);
+ phar_get_stub(index_php, web_index, len, &stub, index_len+1, web_len+1);
return stub;
}
/* }}} */
@@ -2486,7 +2483,7 @@ char *phar_create_default_stub(const char *index_php, const char *web_index, siz
* user_stub contains either a string, or a resource pointer, if len is a negative length.
* user_stub and len should be both 0 if the default or existing stub should be used
*/
-int phar_flush(phar_archive_data *phar, char *user_stub, zend_long len, int convert, char **error TSRMLS_DC) /* {{{ */
+int phar_flush(phar_archive_data *phar, char *user_stub, zend_long len, int convert, char **error) /* {{{ */
{
char halt_stub[] = "__HALT_COMPILER();";
char *newstub, *tmp;
@@ -2524,11 +2521,11 @@ int phar_flush(phar_archive_data *phar, char *user_stub, zend_long len, int conv
zend_hash_clean(&phar->virtual_dirs);
if (phar->is_zip) {
- return phar_zip_flush(phar, user_stub, len, convert, error TSRMLS_CC);
+ return phar_zip_flush(phar, user_stub, len, convert, error);
}
if (phar->is_tar) {
- return phar_tar_flush(phar, user_stub, len, convert, error TSRMLS_CC);
+ return phar_tar_flush(phar, user_stub, len, convert, error);
}
if (PHAR_G(readonly)) {
@@ -2635,7 +2632,7 @@ int phar_flush(phar_archive_data *phar, char *user_stub, zend_long len, int conv
newstub = NULL;
} else {
/* this is either a brand new phar or a default stub overwrite */
- newstub = phar_create_default_stub(NULL, NULL, &(phar->halt_offset), NULL TSRMLS_CC);
+ newstub = phar_create_default_stub(NULL, NULL, &(phar->halt_offset), NULL);
written = php_stream_write(newfile, newstub, phar->halt_offset);
}
if (phar->halt_offset != written) {
@@ -2665,13 +2662,13 @@ int phar_flush(phar_archive_data *phar, char *user_stub, zend_long len, int conv
/* Check whether we can get rid of some of the deleted entries which are
* unused. However some might still be in use so even after this clean-up
* we need to skip entries marked is_deleted. */
- zend_hash_apply(&phar->manifest, phar_flush_clean_deleted_apply TSRMLS_CC);
+ zend_hash_apply(&phar->manifest, phar_flush_clean_deleted_apply);
/* compress as necessary, calculate crcs, serialize meta-data, manifest size, and file sizes */
main_metadata_str.s = NULL;
if (Z_TYPE(phar->metadata) != IS_UNDEF) {
PHP_VAR_SERIALIZE_INIT(metadata_hash);
- php_var_serialize(&main_metadata_str, &phar->metadata, &metadata_hash TSRMLS_CC);
+ php_var_serialize(&main_metadata_str, &phar->metadata, &metadata_hash);
PHP_VAR_SERIALIZE_DESTROY(metadata_hash);
}
new_manifest_count = 0;
@@ -2705,7 +2702,7 @@ int phar_flush(phar_archive_data *phar, char *user_stub, zend_long len, int conv
}
/* after excluding deleted files, calculate manifest size in bytes and number of entries */
++new_manifest_count;
- phar_add_virtual_dirs(phar, entry->filename, entry->filename_len TSRMLS_CC);
+ phar_add_virtual_dirs(phar, entry->filename, entry->filename_len);
if (entry->is_dir) {
/* we use this to calculate API version, 1.1.1 is used for phars with directories */
@@ -2717,7 +2714,7 @@ int phar_flush(phar_archive_data *phar, char *user_stub, zend_long len, int conv
}
entry->metadata_str.s = NULL;
PHP_VAR_SERIALIZE_INIT(metadata_hash);
- php_var_serialize(&entry->metadata_str, &entry->metadata, &metadata_hash TSRMLS_CC);
+ php_var_serialize(&entry->metadata_str, &entry->metadata, &metadata_hash);
PHP_VAR_SERIALIZE_DESTROY(metadata_hash);
} else {
if (entry->metadata_str.s) {
@@ -2737,9 +2734,9 @@ int phar_flush(phar_archive_data *phar, char *user_stub, zend_long len, int conv
}
continue;
}
- if (!phar_get_efp(entry, 0 TSRMLS_CC)) {
+ if (!phar_get_efp(entry, 0)) {
/* re-open internal file pointer just-in-time */
- newentry = phar_open_jit(phar, entry, error TSRMLS_CC);
+ newentry = phar_open_jit(phar, entry, error);
if (!newentry) {
/* major problem re-opening, so we ignore this file and the error */
efree(*error);
@@ -2748,8 +2745,8 @@ int phar_flush(phar_archive_data *phar, char *user_stub, zend_long len, int conv
}
entry = newentry;
}
- file = phar_get_efp(entry, 0 TSRMLS_CC);
- if (-1 == phar_seek_efp(entry, 0, SEEK_SET, 0, 1 TSRMLS_CC)) {
+ file = phar_get_efp(entry, 0);
+ if (-1 == phar_seek_efp(entry, 0, SEEK_SET, 0, 1)) {
if (closeoldfile) {
php_stream_close(oldfile);
}
@@ -2771,7 +2768,7 @@ int phar_flush(phar_archive_data *phar, char *user_stub, zend_long len, int conv
entry->compressed_filesize = entry->uncompressed_filesize;
continue;
}
- filter = php_stream_filter_create(phar_compress_filter(entry, 0), NULL, 0 TSRMLS_CC);
+ filter = php_stream_filter_create(phar_compress_filter(entry, 0), NULL, 0);
if (!filter) {
if (closeoldfile) {
php_stream_close(oldfile);
@@ -2804,7 +2801,7 @@ int phar_flush(phar_archive_data *phar, char *user_stub, zend_long len, int conv
return EOF;
}
php_stream_flush(file);
- if (-1 == phar_seek_efp(entry, 0, SEEK_SET, 0, 0 TSRMLS_CC)) {
+ if (-1 == phar_seek_efp(entry, 0, SEEK_SET, 0, 0)) {
if (closeoldfile) {
php_stream_close(oldfile);
}
@@ -2827,7 +2824,7 @@ int phar_flush(phar_archive_data *phar, char *user_stub, zend_long len, int conv
}
php_stream_filter_flush(filter, 1);
php_stream_flush(entry->cfp);
- php_stream_filter_remove(filter, 1 TSRMLS_CC);
+ php_stream_filter_remove(filter, 1);
php_stream_seek(entry->cfp, 0, SEEK_END);
entry->compressed_filesize = (php_uint32) php_stream_tell(entry->cfp);
/* generate crc on compressed file */
@@ -3021,8 +3018,8 @@ int phar_flush(phar_archive_data *phar, char *user_stub, zend_long len, int conv
file = entry->cfp;
php_stream_rewind(file);
} else {
- file = phar_get_efp(entry, 0 TSRMLS_CC);
- if (-1 == phar_seek_efp(entry, 0, SEEK_SET, 0, 0 TSRMLS_CC)) {
+ file = phar_get_efp(entry, 0);
+ if (-1 == phar_seek_efp(entry, 0, SEEK_SET, 0, 0)) {
if (closeoldfile) {
php_stream_close(oldfile);
}
@@ -3110,7 +3107,7 @@ int phar_flush(phar_archive_data *phar, char *user_stub, zend_long len, int conv
char *digest = NULL;
int digest_len;
- if (FAILURE == phar_create_signature(phar, newfile, &digest, &digest_len, error TSRMLS_CC)) {
+ if (FAILURE == phar_create_signature(phar, newfile, &digest, &digest_len, error)) {
if (error) {
char *save = *error;
spprintf(error, 0, "phar error: unable to write signature: %s", save);
@@ -3183,7 +3180,7 @@ int phar_flush(phar_archive_data *phar, char *user_stub, zend_long len, int conv
array_init(&filterparams);
add_assoc_long(&filterparams, "window", MAX_WBITS+16);
- filter = php_stream_filter_create("zlib.deflate", &filterparams, php_stream_is_persistent(phar->fp) TSRMLS_CC);
+ filter = php_stream_filter_create("zlib.deflate", &filterparams, php_stream_is_persistent(phar->fp));
zval_dtor(&filterparams);
if (!filter) {
@@ -3196,16 +3193,16 @@ int phar_flush(phar_archive_data *phar, char *user_stub, zend_long len, int conv
php_stream_filter_append(&phar->fp->writefilters, filter);
php_stream_copy_to_stream_ex(newfile, phar->fp, PHP_STREAM_COPY_ALL, NULL);
php_stream_filter_flush(filter, 1);
- php_stream_filter_remove(filter, 1 TSRMLS_CC);
+ php_stream_filter_remove(filter, 1);
php_stream_close(phar->fp);
/* use the temp stream as our base */
phar->fp = newfile;
} else if (phar->flags & PHAR_FILE_COMPRESSED_BZ2) {
- filter = php_stream_filter_create("bzip2.compress", NULL, php_stream_is_persistent(phar->fp) TSRMLS_CC);
+ filter = php_stream_filter_create("bzip2.compress", NULL, php_stream_is_persistent(phar->fp));
php_stream_filter_append(&phar->fp->writefilters, filter);
php_stream_copy_to_stream_ex(newfile, phar->fp, PHP_STREAM_COPY_ALL, NULL);
php_stream_filter_flush(filter, 1);
- php_stream_filter_remove(filter, 1 TSRMLS_CC);
+ php_stream_filter_remove(filter, 1);
php_stream_close(phar->fp);
/* use the temp stream as our base */
phar->fp = newfile;
@@ -3243,26 +3240,26 @@ zend_function_entry phar_functions[] = {
};
/* }}}*/
-static size_t phar_zend_stream_reader(void *handle, char *buf, size_t len TSRMLS_DC) /* {{{ */
+static size_t phar_zend_stream_reader(void *handle, char *buf, size_t len) /* {{{ */
{
- return php_stream_read(phar_get_pharfp((phar_archive_data*)handle TSRMLS_CC), buf, len);
+ return php_stream_read(phar_get_pharfp((phar_archive_data*)handle), buf, len);
}
/* }}} */
-static size_t phar_zend_stream_fsizer(void *handle TSRMLS_DC) /* {{{ */
+static size_t phar_zend_stream_fsizer(void *handle) /* {{{ */
{
return ((phar_archive_data*)handle)->halt_offset + 32;
} /* }}} */
-zend_op_array *(*phar_orig_compile_file)(zend_file_handle *file_handle, int type TSRMLS_DC);
+zend_op_array *(*phar_orig_compile_file)(zend_file_handle *file_handle, int type);
#define phar_orig_zend_open zend_stream_open_function
-static char *phar_resolve_path(const char *filename, int filename_len TSRMLS_DC)
+static char *phar_resolve_path(const char *filename, int filename_len)
{
- return phar_find_in_include_path((char *) filename, filename_len, NULL TSRMLS_CC);
+ return phar_find_in_include_path((char *) filename, filename_len, NULL);
}
-static zend_op_array *phar_compile_file(zend_file_handle *file_handle, int type TSRMLS_DC) /* {{{ */
+static zend_op_array *phar_compile_file(zend_file_handle *file_handle, int type) /* {{{ */
{
zend_op_array *res;
char *name = NULL;
@@ -3270,16 +3267,16 @@ static zend_op_array *phar_compile_file(zend_file_handle *file_handle, int type
phar_archive_data *phar;
if (!file_handle || !file_handle->filename) {
- return phar_orig_compile_file(file_handle, type TSRMLS_CC);
+ return phar_orig_compile_file(file_handle, type);
}
if (strstr(file_handle->filename, ".phar") && !strstr(file_handle->filename, "://")) {
- if (SUCCESS == phar_open_from_filename((char*)file_handle->filename, strlen(file_handle->filename), NULL, 0, 0, &phar, NULL TSRMLS_CC)) {
+ if (SUCCESS == phar_open_from_filename((char*)file_handle->filename, strlen(file_handle->filename), NULL, 0, 0, &phar, NULL)) {
if (phar->is_zip || phar->is_tar) {
zend_file_handle f = *file_handle;
/* zip or tar-based phar */
spprintf(&name, 4096, "phar://%s/%s", file_handle->filename, ".phar/stub.php");
- if (SUCCESS == phar_orig_zend_open((const char *)name, file_handle TSRMLS_CC)) {
+ if (SUCCESS == phar_orig_zend_open((const char *)name, file_handle)) {
efree(name);
name = NULL;
file_handle->filename = f.filename;
@@ -3311,7 +3308,7 @@ static zend_op_array *phar_compile_file(zend_file_handle *file_handle, int type
zend_try {
failed = 0;
CG(zend_lineno) = 0;
- res = phar_orig_compile_file(file_handle, type TSRMLS_CC);
+ res = phar_orig_compile_file(file_handle, type);
} zend_catch {
failed = 1;
res = NULL;
@@ -3329,7 +3326,7 @@ static zend_op_array *phar_compile_file(zend_file_handle *file_handle, int type
}
/* }}} */
-typedef zend_op_array* (zend_compile_t)(zend_file_handle*, int TSRMLS_DC);
+typedef zend_op_array* (zend_compile_t)(zend_file_handle*, int);
typedef zend_compile_t* (compile_hook)(zend_compile_t *ptr);
static void mime_type_dtor(zval *zv)
@@ -3396,7 +3393,7 @@ PHP_GINIT_FUNCTION(phar) /* {{{ */
PHAR_SET_MIME("image/xbm", PHAR_MIME_OTHER, "xbm")
PHAR_SET_MIME("text/xml", PHAR_MIME_OTHER, "xml")
- phar_restore_orig_functions(TSRMLS_C);
+ phar_restore_orig_functions();
}
/* }}} */
@@ -3416,20 +3413,20 @@ PHP_MINIT_FUNCTION(phar) /* {{{ */
phar_save_resolve_path = zend_resolve_path;
zend_resolve_path = phar_resolve_path;
- phar_object_init(TSRMLS_C);
+ phar_object_init();
- phar_intercept_functions_init(TSRMLS_C);
- phar_save_orig_functions(TSRMLS_C);
+ phar_intercept_functions_init();
+ phar_save_orig_functions();
- return php_register_url_stream_wrapper("phar", &php_stream_phar_wrapper TSRMLS_CC);
+ return php_register_url_stream_wrapper("phar", &php_stream_phar_wrapper);
}
/* }}} */
PHP_MSHUTDOWN_FUNCTION(phar) /* {{{ */
{
- php_unregister_url_stream_wrapper("phar" TSRMLS_CC);
+ php_unregister_url_stream_wrapper("phar");
- phar_intercept_functions_shutdown(TSRMLS_C);
+ phar_intercept_functions_shutdown();
if (zend_compile_file == phar_compile_file) {
zend_compile_file = phar_orig_compile_file;
@@ -3444,7 +3441,7 @@ PHP_MSHUTDOWN_FUNCTION(phar) /* {{{ */
}
/* }}} */
-void phar_request_initialize(TSRMLS_D) /* {{{ */
+void phar_request_initialize(void) /* {{{ */
{
if (!PHAR_GLOBALS->request_init)
{
@@ -3488,7 +3485,7 @@ PHP_RSHUTDOWN_FUNCTION(phar) /* {{{ */
if (PHAR_GLOBALS->request_init)
{
- phar_release_functions(TSRMLS_C);
+ phar_release_functions();
zend_hash_destroy(&(PHAR_GLOBALS->phar_alias_map));
PHAR_GLOBALS->phar_alias_map.arHash = NULL;
zend_hash_destroy(&(PHAR_GLOBALS->phar_fname_map));
@@ -3529,7 +3526,7 @@ PHP_RSHUTDOWN_FUNCTION(phar) /* {{{ */
PHP_MINFO_FUNCTION(phar) /* {{{ */
{
- phar_request_initialize(TSRMLS_C);
+ phar_request_initialize();
php_info_print_table_start();
php_info_print_table_header(2, "Phar: PHP Archive support", "enabled");
php_info_print_table_row(2, "Phar EXT version", PHP_PHAR_VERSION);
diff --git a/ext/phar/phar_internal.h b/ext/phar/phar_internal.h
index 7fe647b97d..fed80029f6 100644
--- a/ext/phar/phar_internal.h
+++ b/ext/phar/phar_internal.h
@@ -346,7 +346,7 @@ struct _phar_entry_fp {
phar_entry_fp_info *manifest;
};
-static inline php_stream *phar_get_entrypfp(phar_entry_info *entry TSRMLS_DC)
+static inline php_stream *phar_get_entrypfp(phar_entry_info *entry)
{
if (!entry->is_persistent) {
return entry->phar->fp;
@@ -354,7 +354,7 @@ static inline php_stream *phar_get_entrypfp(phar_entry_info *entry TSRMLS_DC)
return PHAR_GLOBALS->cached_fp[entry->phar->phar_pos].fp;
}
-static inline php_stream *phar_get_entrypufp(phar_entry_info *entry TSRMLS_DC)
+static inline php_stream *phar_get_entrypufp(phar_entry_info *entry)
{
if (!entry->is_persistent) {
return entry->phar->ufp;
@@ -362,7 +362,7 @@ static inline php_stream *phar_get_entrypufp(phar_entry_info *entry TSRMLS_DC)
return PHAR_GLOBALS->cached_fp[entry->phar->phar_pos].ufp;
}
-static inline void phar_set_entrypfp(phar_entry_info *entry, php_stream *fp TSRMLS_DC)
+static inline void phar_set_entrypfp(phar_entry_info *entry, php_stream *fp)
{
if (!entry->phar->is_persistent) {
entry->phar->fp = fp;
@@ -372,7 +372,7 @@ static inline void phar_set_entrypfp(phar_entry_info *entry, php_stream *fp TSRM
PHAR_GLOBALS->cached_fp[entry->phar->phar_pos].fp = fp;
}
-static inline void phar_set_entrypufp(phar_entry_info *entry, php_stream *fp TSRMLS_DC)
+static inline void phar_set_entrypufp(phar_entry_info *entry, php_stream *fp)
{
if (!entry->phar->is_persistent) {
entry->phar->ufp = fp;
@@ -382,7 +382,7 @@ static inline void phar_set_entrypufp(phar_entry_info *entry, php_stream *fp TSR
PHAR_GLOBALS->cached_fp[entry->phar->phar_pos].ufp = fp;
}
-static inline php_stream *phar_get_pharfp(phar_archive_data *phar TSRMLS_DC)
+static inline php_stream *phar_get_pharfp(phar_archive_data *phar)
{
if (!phar->is_persistent) {
return phar->fp;
@@ -390,7 +390,7 @@ static inline php_stream *phar_get_pharfp(phar_archive_data *phar TSRMLS_DC)
return PHAR_GLOBALS->cached_fp[phar->phar_pos].fp;
}
-static inline php_stream *phar_get_pharufp(phar_archive_data *phar TSRMLS_DC)
+static inline php_stream *phar_get_pharufp(phar_archive_data *phar)
{
if (!phar->is_persistent) {
return phar->ufp;
@@ -398,7 +398,7 @@ static inline php_stream *phar_get_pharufp(phar_archive_data *phar TSRMLS_DC)
return PHAR_GLOBALS->cached_fp[phar->phar_pos].ufp;
}
-static inline void phar_set_pharfp(phar_archive_data *phar, php_stream *fp TSRMLS_DC)
+static inline void phar_set_pharfp(phar_archive_data *phar, php_stream *fp)
{
if (!phar->is_persistent) {
phar->fp = fp;
@@ -408,7 +408,7 @@ static inline void phar_set_pharfp(phar_archive_data *phar, php_stream *fp TSRML
PHAR_GLOBALS->cached_fp[phar->phar_pos].fp = fp;
}
-static inline void phar_set_pharufp(phar_archive_data *phar, php_stream *fp TSRMLS_DC)
+static inline void phar_set_pharufp(phar_archive_data *phar, php_stream *fp)
{
if (!phar->is_persistent) {
phar->ufp = fp;
@@ -418,7 +418,7 @@ static inline void phar_set_pharufp(phar_archive_data *phar, php_stream *fp TSRM
PHAR_GLOBALS->cached_fp[phar->phar_pos].ufp = fp;
}
-static inline void phar_set_fp_type(phar_entry_info *entry, enum phar_fp_type type, zend_off_t offset TSRMLS_DC)
+static inline void phar_set_fp_type(phar_entry_info *entry, enum phar_fp_type type, zend_off_t offset)
{
phar_entry_fp_info *data;
@@ -432,7 +432,7 @@ static inline void phar_set_fp_type(phar_entry_info *entry, enum phar_fp_type ty
data->offset = offset;
}
-static inline enum phar_fp_type phar_get_fp_type(phar_entry_info *entry TSRMLS_DC)
+static inline enum phar_fp_type phar_get_fp_type(phar_entry_info *entry)
{
if (!entry->is_persistent) {
return entry->fp_type;
@@ -440,7 +440,7 @@ static inline enum phar_fp_type phar_get_fp_type(phar_entry_info *entry TSRMLS_D
return PHAR_GLOBALS->cached_fp[entry->phar->phar_pos].manifest[entry->manifest_pos].fp_type;
}
-static inline zend_off_t phar_get_fp_offset(phar_entry_info *entry TSRMLS_DC)
+static inline zend_off_t phar_get_fp_offset(phar_entry_info *entry)
{
if (!entry->is_persistent) {
return entry->offset;
@@ -495,7 +495,7 @@ union _phar_entry_object {
#endif
#ifndef PHAR_MAIN
-extern char *(*phar_save_resolve_path)(const char *filename, int filename_len TSRMLS_DC);
+extern char *(*phar_save_resolve_path)(const char *filename, int filename_len);
#endif
BEGIN_EXTERN_C()
@@ -525,7 +525,7 @@ static inline int phar_validate_alias(const char *alias, int alias_len) /* {{{ *
}
/* }}} */
-static inline void phar_set_inode(phar_entry_info *entry TSRMLS_DC) /* {{{ */
+static inline void phar_set_inode(phar_entry_info *entry) /* {{{ */
{
char tmp[MAXPATHLEN];
int tmp_len;
@@ -537,75 +537,75 @@ static inline void phar_set_inode(phar_entry_info *entry TSRMLS_DC) /* {{{ */
}
/* }}} */
-void phar_request_initialize(TSRMLS_D);
+void phar_request_initialize(void);
-void phar_object_init(TSRMLS_D);
-void phar_destroy_phar_data(phar_archive_data *phar TSRMLS_DC);
+void phar_object_init(void);
+void phar_destroy_phar_data(phar_archive_data *phar);
-int phar_open_entry_file(phar_archive_data *phar, phar_entry_info *entry, char **error TSRMLS_DC);
-int phar_postprocess_file(phar_entry_data *idata, php_uint32 crc32, char **error, int process_zip TSRMLS_DC);
-int phar_open_from_filename(char *fname, int fname_len, char *alias, int alias_len, int options, phar_archive_data** pphar, char **error TSRMLS_DC);
-int phar_open_or_create_filename(char *fname, int fname_len, char *alias, int alias_len, int is_data, int options, phar_archive_data** pphar, char **error TSRMLS_DC);
-int phar_create_or_parse_filename(char *fname, int fname_len, char *alias, int alias_len, int is_data, int options, phar_archive_data** pphar, char **error TSRMLS_DC);
-int phar_open_executed_filename(char *alias, int alias_len, char **error TSRMLS_DC);
-int phar_free_alias(phar_archive_data *phar, char *alias, int alias_len TSRMLS_DC);
-int phar_get_archive(phar_archive_data **archive, char *fname, int fname_len, char *alias, int alias_len, char **error TSRMLS_DC);
-int phar_open_parsed_phar(char *fname, int fname_len, char *alias, int alias_len, int is_data, int options, phar_archive_data** pphar, char **error TSRMLS_DC);
-int phar_verify_signature(php_stream *fp, size_t end_of_phar, php_uint32 sig_type, char *sig, int sig_len, char *fname, char **signature, int *signature_len, char **error TSRMLS_DC);
-int phar_create_signature(phar_archive_data *phar, php_stream *fp, char **signature, int *signature_length, char **error TSRMLS_DC);
+int phar_open_entry_file(phar_archive_data *phar, phar_entry_info *entry, char **error);
+int phar_postprocess_file(phar_entry_data *idata, php_uint32 crc32, char **error, int process_zip);
+int phar_open_from_filename(char *fname, int fname_len, char *alias, int alias_len, int options, phar_archive_data** pphar, char **error);
+int phar_open_or_create_filename(char *fname, int fname_len, char *alias, int alias_len, int is_data, int options, phar_archive_data** pphar, char **error);
+int phar_create_or_parse_filename(char *fname, int fname_len, char *alias, int alias_len, int is_data, int options, phar_archive_data** pphar, char **error);
+int phar_open_executed_filename(char *alias, int alias_len, char **error);
+int phar_free_alias(phar_archive_data *phar, char *alias, int alias_len);
+int phar_get_archive(phar_archive_data **archive, char *fname, int fname_len, char *alias, int alias_len, char **error);
+int phar_open_parsed_phar(char *fname, int fname_len, char *alias, int alias_len, int is_data, int options, phar_archive_data** pphar, char **error);
+int phar_verify_signature(php_stream *fp, size_t end_of_phar, php_uint32 sig_type, char *sig, int sig_len, char *fname, char **signature, int *signature_len, char **error);
+int phar_create_signature(phar_archive_data *phar, php_stream *fp, char **signature, int *signature_length, char **error);
/* utility functions */
-char *phar_create_default_stub(const char *index_php, const char *web_index, size_t *len, char **error TSRMLS_DC);
+char *phar_create_default_stub(const char *index_php, const char *web_index, size_t *len, char **error);
char *phar_decompress_filter(phar_entry_info * entry, int return_unknown);
char *phar_compress_filter(phar_entry_info * entry, int return_unknown);
-void phar_remove_virtual_dirs(phar_archive_data *phar, char *filename, int filename_len TSRMLS_DC);
-void phar_add_virtual_dirs(phar_archive_data *phar, char *filename, int filename_len TSRMLS_DC);
-int phar_mount_entry(phar_archive_data *phar, char *filename, int filename_len, char *path, int path_len TSRMLS_DC);
-char *phar_find_in_include_path(char *file, int file_len, phar_archive_data **pphar TSRMLS_DC);
-char *phar_fix_filepath(char *path, int *new_len, int use_cwd TSRMLS_DC);
-phar_entry_info * phar_open_jit(phar_archive_data *phar, phar_entry_info *entry, char **error TSRMLS_DC);
-int phar_parse_metadata(char **buffer, zval *metadata, int zip_metadata_len TSRMLS_DC);
+void phar_remove_virtual_dirs(phar_archive_data *phar, char *filename, int filename_len);
+void phar_add_virtual_dirs(phar_archive_data *phar, char *filename, int filename_len);
+int phar_mount_entry(phar_archive_data *phar, char *filename, int filename_len, char *path, int path_len);
+char *phar_find_in_include_path(char *file, int file_len, phar_archive_data **pphar);
+char *phar_fix_filepath(char *path, int *new_len, int use_cwd);
+phar_entry_info * phar_open_jit(phar_archive_data *phar, phar_entry_info *entry, char **error);
+int phar_parse_metadata(char **buffer, zval *metadata, int zip_metadata_len);
void destroy_phar_manifest_entry(zval *zv);
-int phar_seek_efp(phar_entry_info *entry, zend_off_t offset, int whence, zend_off_t position, int follow_links TSRMLS_DC);
-php_stream *phar_get_efp(phar_entry_info *entry, int follow_links TSRMLS_DC);
-int phar_copy_entry_fp(phar_entry_info *source, phar_entry_info *dest, char **error TSRMLS_DC);
-int phar_open_entry_fp(phar_entry_info *entry, char **error, int follow_links TSRMLS_DC);
-phar_entry_info *phar_get_link_source(phar_entry_info *entry TSRMLS_DC);
-int phar_create_writeable_entry(phar_archive_data *phar, phar_entry_info *entry, char **error TSRMLS_DC);
-int phar_separate_entry_fp(phar_entry_info *entry, char **error TSRMLS_DC);
-int phar_open_archive_fp(phar_archive_data *phar TSRMLS_DC);
-int phar_copy_on_write(phar_archive_data **pphar TSRMLS_DC);
+int phar_seek_efp(phar_entry_info *entry, zend_off_t offset, int whence, zend_off_t position, int follow_links);
+php_stream *phar_get_efp(phar_entry_info *entry, int follow_links);
+int phar_copy_entry_fp(phar_entry_info *source, phar_entry_info *dest, char **error);
+int phar_open_entry_fp(phar_entry_info *entry, char **error, int follow_links);
+phar_entry_info *phar_get_link_source(phar_entry_info *entry);
+int phar_create_writeable_entry(phar_archive_data *phar, phar_entry_info *entry, char **error);
+int phar_separate_entry_fp(phar_entry_info *entry, char **error);
+int phar_open_archive_fp(phar_archive_data *phar);
+int phar_copy_on_write(phar_archive_data **pphar);
/* tar functions in tar.c */
int phar_is_tar(char *buf, char *fname);
-int phar_parse_tarfile(php_stream* fp, char *fname, int fname_len, char *alias, int alias_len, phar_archive_data** pphar, int is_data, php_uint32 compression, char **error TSRMLS_DC);
-int phar_open_or_create_tar(char *fname, int fname_len, char *alias, int alias_len, int is_data, int options, phar_archive_data** pphar, char **error TSRMLS_DC);
-int phar_tar_flush(phar_archive_data *phar, char *user_stub, zend_long len, int defaultstub, char **error TSRMLS_DC);
+int phar_parse_tarfile(php_stream* fp, char *fname, int fname_len, char *alias, int alias_len, phar_archive_data** pphar, int is_data, php_uint32 compression, char **error);
+int phar_open_or_create_tar(char *fname, int fname_len, char *alias, int alias_len, int is_data, int options, phar_archive_data** pphar, char **error);
+int phar_tar_flush(phar_archive_data *phar, char *user_stub, zend_long len, int defaultstub, char **error);
/* zip functions in zip.c */
-int phar_parse_zipfile(php_stream *fp, char *fname, int fname_len, char *alias, int alias_len, phar_archive_data** pphar, char **error TSRMLS_DC);
-int phar_open_or_create_zip(char *fname, int fname_len, char *alias, int alias_len, int is_data, int options, phar_archive_data** pphar, char **error TSRMLS_DC);
-int phar_zip_flush(phar_archive_data *archive, char *user_stub, zend_long len, int defaultstub, char **error TSRMLS_DC);
+int phar_parse_zipfile(php_stream *fp, char *fname, int fname_len, char *alias, int alias_len, phar_archive_data** pphar, char **error);
+int phar_open_or_create_zip(char *fname, int fname_len, char *alias, int alias_len, int is_data, int options, phar_archive_data** pphar, char **error);
+int phar_zip_flush(phar_archive_data *archive, char *user_stub, zend_long len, int defaultstub, char **error);
#ifdef PHAR_MAIN
-static int phar_open_from_fp(php_stream* fp, char *fname, int fname_len, char *alias, int alias_len, int options, phar_archive_data** pphar, int is_data, char **error TSRMLS_DC);
+static int phar_open_from_fp(php_stream* fp, char *fname, int fname_len, char *alias, int alias_len, int options, phar_archive_data** pphar, int is_data, char **error);
extern php_stream_wrapper php_stream_phar_wrapper;
#else
extern HashTable cached_phars;
extern HashTable cached_alias;
#endif
-int phar_archive_delref(phar_archive_data *phar TSRMLS_DC);
-int phar_entry_delref(phar_entry_data *idata TSRMLS_DC);
+int phar_archive_delref(phar_archive_data *phar);
+int phar_entry_delref(phar_entry_data *idata);
-phar_entry_info *phar_get_entry_info(phar_archive_data *phar, char *path, int path_len, char **error, int security TSRMLS_DC);
-phar_entry_info *phar_get_entry_info_dir(phar_archive_data *phar, char *path, int path_len, char dir, char **error, int security TSRMLS_DC);
-phar_entry_data *phar_get_or_create_entry_data(char *fname, int fname_len, char *path, int path_len, const char *mode, char allow_dir, char **error, int security TSRMLS_DC);
-int phar_get_entry_data(phar_entry_data **ret, char *fname, int fname_len, char *path, int path_len, const char *mode, char allow_dir, char **error, int security TSRMLS_DC);
-int phar_flush(phar_archive_data *archive, char *user_stub, zend_long len, int convert, char **error TSRMLS_DC);
-int phar_detect_phar_fname_ext(const char *filename, int filename_len, const char **ext_str, int *ext_len, int executable, int for_create, int is_complete TSRMLS_DC);
-int phar_split_fname(const char *filename, int filename_len, char **arch, int *arch_len, char **entry, int *entry_len, int executable, int for_create TSRMLS_DC);
+phar_entry_info *phar_get_entry_info(phar_archive_data *phar, char *path, int path_len, char **error, int security);
+phar_entry_info *phar_get_entry_info_dir(phar_archive_data *phar, char *path, int path_len, char dir, char **error, int security);
+phar_entry_data *phar_get_or_create_entry_data(char *fname, int fname_len, char *path, int path_len, const char *mode, char allow_dir, char **error, int security);
+int phar_get_entry_data(phar_entry_data **ret, char *fname, int fname_len, char *path, int path_len, const char *mode, char allow_dir, char **error, int security);
+int phar_flush(phar_archive_data *archive, char *user_stub, zend_long len, int convert, char **error);
+int phar_detect_phar_fname_ext(const char *filename, int filename_len, const char **ext_str, int *ext_len, int executable, int for_create, int is_complete);
+int phar_split_fname(const char *filename, int filename_len, char **arch, int *arch_len, char **entry, int *entry_len, int executable, int for_create);
typedef enum {
pcr_use_query,
diff --git a/ext/phar/phar_object.c b/ext/phar/phar_object.c
index d23c7cd6c6..70577ff496 100755
--- a/ext/phar/phar_object.c
+++ b/ext/phar/phar_object.c
@@ -36,7 +36,7 @@ static zend_class_entry *phar_ce_entry;
# define PHAR_ARG_INFO static
#endif
-static int phar_file_type(HashTable *mimes, char *file, char **mime_type TSRMLS_DC) /* {{{ */
+static int phar_file_type(HashTable *mimes, char *file, char **mime_type) /* {{{ */
{
char *ext;
phar_mime_type *mime;
@@ -56,7 +56,7 @@ static int phar_file_type(HashTable *mimes, char *file, char **mime_type TSRMLS_
}
/* }}} */
-static void phar_mung_server_vars(char *fname, char *entry, int entry_len, char *basename, int request_uri_len TSRMLS_DC) /* {{{ */
+static void phar_mung_server_vars(char *fname, char *entry, int entry_len, char *basename, int request_uri_len) /* {{{ */
{
HashTable *_SERVER;
zval *stuff;
@@ -142,7 +142,7 @@ static void phar_mung_server_vars(char *fname, char *entry, int entry_len, char
}
/* }}} */
-static int phar_file_action(phar_archive_data *phar, phar_entry_info *info, char *mime_type, int code, char *entry, int entry_len, char *arch, char *basename, char *ru, int ru_len TSRMLS_DC) /* {{{ */
+static int phar_file_action(phar_archive_data *phar, phar_entry_info *info, char *mime_type, int code, char *entry, int entry_len, char *arch, char *basename, char *ru, int ru_len) /* {{{ */
{
char *name = NULL, buf[8192];
const char *cwd;
@@ -168,7 +168,7 @@ static int phar_file_action(phar_archive_data *phar, phar_entry_info *info, char
}
php_get_highlight_struct(&syntax_highlighter_ini);
- highlight_file(name, &syntax_highlighter_ini TSRMLS_CC);
+ highlight_file(name, &syntax_highlighter_ini);
efree(name);
#ifdef PHP_WIN32
@@ -179,32 +179,32 @@ static int phar_file_action(phar_archive_data *phar, phar_entry_info *info, char
/* send headers, output file contents */
efree(basename);
ctr.line_len = spprintf(&(ctr.line), 0, "Content-type: %s", mime_type);
- sapi_header_op(SAPI_HEADER_REPLACE, &ctr TSRMLS_CC);
+ sapi_header_op(SAPI_HEADER_REPLACE, &ctr);
efree(ctr.line);
ctr.line_len = spprintf(&(ctr.line), 0, "Content-length: %u", info->uncompressed_filesize);
- sapi_header_op(SAPI_HEADER_REPLACE, &ctr TSRMLS_CC);
+ sapi_header_op(SAPI_HEADER_REPLACE, &ctr);
efree(ctr.line);
- if (FAILURE == sapi_send_headers(TSRMLS_C)) {
+ if (FAILURE == sapi_send_headers()) {
zend_bailout();
}
/* prepare to output */
- fp = phar_get_efp(info, 1 TSRMLS_CC);
+ fp = phar_get_efp(info, 1);
if (!fp) {
char *error;
- if (!phar_open_jit(phar, info, &error TSRMLS_CC)) {
+ if (!phar_open_jit(phar, info, &error)) {
if (error) {
- zend_throw_exception_ex(phar_ce_PharException, 0 TSRMLS_CC, "%s", error);
+ zend_throw_exception_ex(phar_ce_PharException, 0, "%s", error);
efree(error);
}
return -1;
}
- fp = phar_get_efp(info, 1 TSRMLS_CC);
+ fp = phar_get_efp(info, 1);
}
position = 0;
- phar_seek_efp(info, 0, SEEK_SET, 0, 1 TSRMLS_CC);
+ phar_seek_efp(info, 0, SEEK_SET, 0, 1);
do {
got = php_stream_read(fp, buf, MIN(8192, info->uncompressed_filesize - position));
@@ -220,7 +220,7 @@ static int phar_file_action(phar_archive_data *phar, phar_entry_info *info, char
zend_bailout();
case PHAR_MIME_PHP:
if (basename) {
- phar_mung_server_vars(arch, entry, entry_len, basename, ru_len TSRMLS_CC);
+ phar_mung_server_vars(arch, entry, entry_len, basename, ru_len);
efree(basename);
}
@@ -256,13 +256,13 @@ static int phar_file_action(phar_archive_data *phar, phar_entry_info *info, char
}
}
- new_op_array = zend_compile_file(&file_handle, ZEND_REQUIRE TSRMLS_CC);
+ new_op_array = zend_compile_file(&file_handle, ZEND_REQUIRE);
if (!new_op_array) {
zend_hash_str_del(&EG(included_files), name, name_len);
}
- zend_destroy_file_handle(&file_handle TSRMLS_CC);
+ zend_destroy_file_handle(&file_handle);
} else {
efree(name);
@@ -275,7 +275,7 @@ static int phar_file_action(phar_archive_data *phar, phar_entry_info *info, char
ZVAL_UNDEF(&result);
zend_try {
- zend_execute(new_op_array, &result TSRMLS_CC);
+ zend_execute(new_op_array, &result);
if (PHAR_G(cwd)) {
efree(PHAR_G(cwd));
PHAR_G(cwd) = NULL;
@@ -284,7 +284,7 @@ static int phar_file_action(phar_archive_data *phar, phar_entry_info *info, char
PHAR_G(cwd_init) = 0;
efree(name);
- destroy_op_array(new_op_array TSRMLS_CC);
+ destroy_op_array(new_op_array);
efree(new_op_array);
zval_ptr_dtor(&result);
} zend_catch {
@@ -307,31 +307,31 @@ static int phar_file_action(phar_archive_data *phar, phar_entry_info *info, char
}
/* }}} */
-static void phar_do_403(char *entry, int entry_len TSRMLS_DC) /* {{{ */
+static void phar_do_403(char *entry, int entry_len) /* {{{ */
{
sapi_header_line ctr = {0};
ctr.response_code = 403;
ctr.line_len = sizeof("HTTP/1.0 403 Access Denied")-1;
ctr.line = "HTTP/1.0 403 Access Denied";
- sapi_header_op(SAPI_HEADER_REPLACE, &ctr TSRMLS_CC);
- sapi_send_headers(TSRMLS_C);
+ sapi_header_op(SAPI_HEADER_REPLACE, &ctr);
+ sapi_send_headers();
PHPWRITE("<html>\n <head>\n <title>Access Denied</title>\n </head>\n <body>\n <h1>403 - File ", sizeof("<html>\n <head>\n <title>Access Denied</title>\n </head>\n <body>\n <h1>403 - File ") - 1);
PHPWRITE(entry, entry_len);
PHPWRITE(" Access Denied</h1>\n </body>\n</html>", sizeof(" Access Denied</h1>\n </body>\n</html>") - 1);
}
/* }}} */
-static void phar_do_404(phar_archive_data *phar, char *fname, int fname_len, char *f404, size_t f404_len, char *entry, size_t entry_len TSRMLS_DC) /* {{{ */
+static void phar_do_404(phar_archive_data *phar, char *fname, int fname_len, char *f404, size_t f404_len, char *entry, size_t entry_len) /* {{{ */
{
sapi_header_line ctr = {0};
phar_entry_info *info;
if (phar && f404_len) {
- info = phar_get_entry_info(phar, f404, f404_len, NULL, 1 TSRMLS_CC);
+ info = phar_get_entry_info(phar, f404, f404_len, NULL, 1);
if (info) {
- phar_file_action(phar, info, "text/html", PHAR_MIME_PHP, f404, f404_len, fname, NULL, NULL, 0 TSRMLS_CC);
+ phar_file_action(phar, info, "text/html", PHAR_MIME_PHP, f404, f404_len, fname, NULL, NULL, 0);
return;
}
}
@@ -339,8 +339,8 @@ static void phar_do_404(phar_archive_data *phar, char *fname, int fname_len, cha
ctr.response_code = 404;
ctr.line_len = sizeof("HTTP/1.0 404 Not Found")-1;
ctr.line = "HTTP/1.0 404 Not Found";
- sapi_header_op(SAPI_HEADER_REPLACE, &ctr TSRMLS_CC);
- sapi_send_headers(TSRMLS_C);
+ sapi_header_op(SAPI_HEADER_REPLACE, &ctr);
+ sapi_send_headers();
PHPWRITE("<html>\n <head>\n <title>File Not Found</title>\n </head>\n <body>\n <h1>404 - File ", sizeof("<html>\n <head>\n <title>File Not Found</title>\n </head>\n <body>\n <h1>404 - File ") - 1);
PHPWRITE(entry, entry_len);
PHPWRITE(" Not Found</h1>\n </body>\n</html>", sizeof(" Not Found</h1>\n </body>\n</html>") - 1);
@@ -350,7 +350,7 @@ static void phar_do_404(phar_archive_data *phar, char *fname, int fname_len, cha
/* post-process REQUEST_URI and retrieve the actual request URI. This is for
cases like http://localhost/blah.phar/path/to/file.php/extra/stuff
which calls "blah.phar" file "path/to/file.php" with PATH_INFO "/extra/stuff" */
-static void phar_postprocess_ru_web(char *fname, int fname_len, char **entry, int *entry_len, char **ru, int *ru_len TSRMLS_DC) /* {{{ */
+static void phar_postprocess_ru_web(char *fname, int fname_len, char **entry, int *entry_len, char **ru, int *ru_len) /* {{{ */
{
char *e = *entry + 1, *u = NULL, *u1 = NULL, *saveu = NULL;
int e_len = *entry_len - 1, u_len = 0;
@@ -421,14 +421,14 @@ PHP_METHOD(Phar, running)
int fname_len, arch_len, entry_len;
zend_bool retphar = 1;
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "|b", &retphar) == FAILURE) {
+ if (zend_parse_parameters(ZEND_NUM_ARGS(), "|b", &retphar) == FAILURE) {
return;
}
- fname = (char*)zend_get_executed_filename(TSRMLS_C);
+ fname = (char*)zend_get_executed_filename();
fname_len = strlen(fname);
- if (fname_len > 7 && !memcmp(fname, "phar://", 7) && SUCCESS == phar_split_fname(fname, fname_len, &arch, &arch_len, &entry, &entry_len, 2, 0 TSRMLS_CC)) {
+ if (fname_len > 7 && !memcmp(fname, "phar://", 7) && SUCCESS == phar_split_fname(fname, fname_len, &arch, &arch_len, &entry, &entry_len, 2, 0)) {
efree(entry);
if (retphar) {
RETVAL_STRINGL(fname, arch_len + 7);
@@ -459,35 +459,35 @@ PHP_METHOD(Phar, mount)
size_t path_len, actual_len;
phar_archive_data *pphar;
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "ss", &path, &path_len, &actual, &actual_len) == FAILURE) {
+ if (zend_parse_parameters(ZEND_NUM_ARGS(), "ss", &path, &path_len, &actual, &actual_len) == FAILURE) {
return;
}
- fname = (char*)zend_get_executed_filename(TSRMLS_C);
+ fname = (char*)zend_get_executed_filename();
fname_len = strlen(fname);
#ifdef PHP_WIN32
phar_unixify_path_separators(fname, fname_len);
#endif
- if (fname_len > 7 && !memcmp(fname, "phar://", 7) && SUCCESS == phar_split_fname(fname, fname_len, &arch, &arch_len, &entry, &entry_len, 2, 0 TSRMLS_CC)) {
+ if (fname_len > 7 && !memcmp(fname, "phar://", 7) && SUCCESS == phar_split_fname(fname, fname_len, &arch, &arch_len, &entry, &entry_len, 2, 0)) {
efree(entry);
entry = NULL;
if (path_len > 7 && !memcmp(path, "phar://", 7)) {
- zend_throw_exception_ex(phar_ce_PharException, 0 TSRMLS_CC, "Can only mount internal paths within a phar archive, use a relative path instead of \"%s\"", path);
+ zend_throw_exception_ex(phar_ce_PharException, 0, "Can only mount internal paths within a phar archive, use a relative path instead of \"%s\"", path);
efree(arch);
return;
}
carry_on2:
if (NULL == (pphar = zend_hash_str_find_ptr(&(PHAR_GLOBALS->phar_fname_map), arch, arch_len))) {
if (PHAR_G(manifest_cached) && NULL != (pphar = zend_hash_str_find_ptr(&cached_phars, arch, arch_len))) {
- if (SUCCESS == phar_copy_on_write(&pphar TSRMLS_CC)) {
+ if (SUCCESS == phar_copy_on_write(&pphar)) {
goto carry_on;
}
}
- zend_throw_exception_ex(phar_ce_PharException, 0 TSRMLS_CC, "%s is not a phar archive, cannot mount", arch);
+ zend_throw_exception_ex(phar_ce_PharException, 0, "%s is not a phar archive, cannot mount", arch);
if (arch) {
efree(arch);
@@ -495,8 +495,8 @@ carry_on2:
return;
}
carry_on:
- if (SUCCESS != phar_mount_entry(pphar, actual, actual_len, path, path_len TSRMLS_CC)) {
- zend_throw_exception_ex(phar_ce_PharException, 0 TSRMLS_CC, "Mounting of %s to %s within phar %s failed", path, actual, arch);
+ if (SUCCESS != phar_mount_entry(pphar, actual, actual_len, path, path_len)) {
+ zend_throw_exception_ex(phar_ce_PharException, 0, "Mounting of %s to %s within phar %s failed", path, actual, arch);
if (path && path == entry) {
efree(entry);
}
@@ -520,18 +520,18 @@ carry_on:
} else if (PHAR_GLOBALS->phar_fname_map.arHash && NULL != (pphar = zend_hash_str_find_ptr(&(PHAR_GLOBALS->phar_fname_map), fname, fname_len))) {
goto carry_on;
} else if (PHAR_G(manifest_cached) && NULL != (pphar = zend_hash_str_find_ptr(&cached_phars, fname, fname_len))) {
- if (SUCCESS == phar_copy_on_write(&pphar TSRMLS_CC)) {
+ if (SUCCESS == phar_copy_on_write(&pphar)) {
goto carry_on;
}
goto carry_on;
- } else if (SUCCESS == phar_split_fname(path, path_len, &arch, &arch_len, &entry, &entry_len, 2, 0 TSRMLS_CC)) {
+ } else if (SUCCESS == phar_split_fname(path, path_len, &arch, &arch_len, &entry, &entry_len, 2, 0)) {
path = entry;
path_len = entry_len;
goto carry_on2;
}
- zend_throw_exception_ex(phar_ce_PharException, 0 TSRMLS_CC, "Mounting of %s to %s failed", path, actual);
+ zend_throw_exception_ex(phar_ce_PharException, 0, "Mounting of %s to %s failed", path, actual);
}
/* }}} */
@@ -555,17 +555,17 @@ PHP_METHOD(Phar, webPhar)
phar_entry_info *info = NULL;
size_t sapi_mod_name_len = strlen(sapi_module.name);
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "|s!s!saz", &alias, &alias_len, &index_php, &index_php_len, &f404, &f404_len, &mimeoverride, &rewrite) == FAILURE) {
+ if (zend_parse_parameters(ZEND_NUM_ARGS(), "|s!s!saz", &alias, &alias_len, &index_php, &index_php_len, &f404, &f404_len, &mimeoverride, &rewrite) == FAILURE) {
return;
}
- phar_request_initialize(TSRMLS_C);
- fname = (char*)zend_get_executed_filename(TSRMLS_C);
+ phar_request_initialize();
+ fname = (char*)zend_get_executed_filename();
fname_len = strlen(fname);
- if (phar_open_executed_filename(alias, alias_len, &error TSRMLS_CC) != SUCCESS) {
+ if (phar_open_executed_filename(alias, alias_len, &error) != SUCCESS) {
if (error) {
- zend_throw_exception_ex(phar_ce_PharException, 0 TSRMLS_CC, "%s", error);
+ zend_throw_exception_ex(phar_ce_PharException, 0, "%s", error);
efree(error);
}
return;
@@ -621,13 +621,13 @@ PHP_METHOD(Phar, webPhar)
} else {
char *testit;
- testit = sapi_getenv("SCRIPT_NAME", sizeof("SCRIPT_NAME")-1 TSRMLS_CC);
+ testit = sapi_getenv("SCRIPT_NAME", sizeof("SCRIPT_NAME")-1);
if (!(pt = strstr(testit, basename))) {
efree(testit);
return;
}
- path_info = sapi_getenv("PATH_INFO", sizeof("PATH_INFO")-1 TSRMLS_CC);
+ path_info = sapi_getenv("PATH_INFO", sizeof("PATH_INFO")-1);
if (path_info) {
entry = path_info;
@@ -667,8 +667,8 @@ PHP_METHOD(Phar, webPhar)
ZVAL_STRINGL(&params, entry, entry_len);
- if (FAILURE == zend_fcall_info_init(rewrite, 0, &fci, &fcc, NULL, NULL TSRMLS_CC)) {
- zend_throw_exception_ex(phar_ce_PharException, 0 TSRMLS_CC, "phar error: invalid rewrite callback");
+ if (FAILURE == zend_fcall_info_init(rewrite, 0, &fci, &fcc, NULL, NULL)) {
+ zend_throw_exception_ex(phar_ce_PharException, 0, "phar error: invalid rewrite callback");
if (free_pathinfo) {
efree(path_info);
@@ -682,9 +682,9 @@ PHP_METHOD(Phar, webPhar)
Z_ADDREF(params);
fci.retval = &retval;
- if (FAILURE == zend_call_function(&fci, &fcc TSRMLS_CC)) {
+ if (FAILURE == zend_call_function(&fci, &fcc)) {
if (!EG(exception)) {
- zend_throw_exception_ex(phar_ce_PharException, 0 TSRMLS_CC, "phar error: failed to call rewrite callback");
+ zend_throw_exception_ex(phar_ce_PharException, 0, "phar error: failed to call rewrite callback");
}
if (free_pathinfo) {
@@ -698,7 +698,7 @@ PHP_METHOD(Phar, webPhar)
if (free_pathinfo) {
efree(path_info);
}
- zend_throw_exception_ex(phar_ce_PharException, 0 TSRMLS_CC, "phar error: rewrite callback must return a string or false");
+ zend_throw_exception_ex(phar_ce_PharException, 0, "phar error: rewrite callback must return a string or false");
return;
}
@@ -710,7 +710,7 @@ PHP_METHOD(Phar, webPhar)
break;
case IS_TRUE:
case IS_FALSE:
- phar_do_403(entry, entry_len TSRMLS_CC);
+ phar_do_403(entry, entry_len);
if (free_pathinfo) {
efree(path_info);
@@ -723,13 +723,13 @@ PHP_METHOD(Phar, webPhar)
efree(path_info);
}
- zend_throw_exception_ex(phar_ce_PharException, 0 TSRMLS_CC, "phar error: rewrite callback must return a string or false");
+ zend_throw_exception_ex(phar_ce_PharException, 0, "phar error: rewrite callback must return a string or false");
return;
}
}
if (entry_len) {
- phar_postprocess_ru_web(fname, fname_len, &entry, (int *)&entry_len, &ru, (int *)&ru_len TSRMLS_CC);
+ phar_postprocess_ru_web(fname, fname_len, &entry, (int *)&entry_len, &ru, (int *)&ru_len);
}
if (!entry_len || (entry_len == 1 && entry[0] == '/')) {
@@ -748,9 +748,9 @@ PHP_METHOD(Phar, webPhar)
entry_len = sizeof("/index.php")-1;
}
- if (FAILURE == phar_get_archive(&phar, fname, fname_len, NULL, 0, NULL TSRMLS_CC) ||
- (info = phar_get_entry_info(phar, entry, entry_len, NULL, 0 TSRMLS_CC)) == NULL) {
- phar_do_404(phar, fname, fname_len, f404, f404_len, entry, entry_len TSRMLS_CC);
+ if (FAILURE == phar_get_archive(&phar, fname, fname_len, NULL, 0, NULL) ||
+ (info = phar_get_entry_info(phar, entry, entry_len, NULL, 0)) == NULL) {
+ phar_do_404(phar, fname, fname_len, f404, f404_len, entry, entry_len);
if (free_pathinfo) {
efree(path_info);
@@ -763,7 +763,7 @@ PHP_METHOD(Phar, webPhar)
ctr.response_code = 301;
ctr.line_len = sizeof("HTTP/1.1 301 Moved Permanently")-1;
ctr.line = "HTTP/1.1 301 Moved Permanently";
- sapi_header_op(SAPI_HEADER_REPLACE, &ctr TSRMLS_CC);
+ sapi_header_op(SAPI_HEADER_REPLACE, &ctr);
if (not_cgi) {
tmp = strstr(path_info, basename) + fname_len;
@@ -787,16 +787,16 @@ PHP_METHOD(Phar, webPhar)
efree(path_info);
}
- sapi_header_op(SAPI_HEADER_REPLACE, &ctr TSRMLS_CC);
- sapi_send_headers(TSRMLS_C);
+ sapi_header_op(SAPI_HEADER_REPLACE, &ctr);
+ sapi_send_headers();
efree(ctr.line);
zend_bailout();
}
}
- if (FAILURE == phar_get_archive(&phar, fname, fname_len, NULL, 0, NULL TSRMLS_CC) ||
- (info = phar_get_entry_info(phar, entry, entry_len, NULL, 0 TSRMLS_CC)) == NULL) {
- phar_do_404(phar, fname, fname_len, f404, f404_len, entry, entry_len TSRMLS_CC);
+ if (FAILURE == phar_get_archive(&phar, fname, fname_len, NULL, 0, NULL) ||
+ (info = phar_get_entry_info(phar, entry, entry_len, NULL, 0)) == NULL) {
+ phar_do_404(phar, fname, fname_len, f404, f404_len, entry, entry_len);
#ifdef PHP_WIN32
efree(fname);
#endif
@@ -817,7 +817,7 @@ PHP_METHOD(Phar, webPhar)
mime_type = "";
code = Z_LVAL_P(val);
} else {
- zend_throw_exception_ex(phar_ce_PharException, 0 TSRMLS_CC, "Unknown mime type specifier used, only Phar::PHP, Phar::PHPS and a mime type string are allowed");
+ zend_throw_exception_ex(phar_ce_PharException, 0, "Unknown mime type specifier used, only Phar::PHP, Phar::PHPS and a mime type string are allowed");
#ifdef PHP_WIN32
efree(fname);
#endif
@@ -829,7 +829,7 @@ PHP_METHOD(Phar, webPhar)
code = PHAR_MIME_OTHER;
break;
default:
- zend_throw_exception_ex(phar_ce_PharException, 0 TSRMLS_CC, "Unknown mime type specifier used (not a string or int), only Phar::PHP, Phar::PHPS and a mime type string are allowed");
+ zend_throw_exception_ex(phar_ce_PharException, 0, "Unknown mime type specifier used (not a string or int), only Phar::PHP, Phar::PHPS and a mime type string are allowed");
#ifdef PHP_WIN32
efree(fname);
#endif
@@ -840,9 +840,9 @@ PHP_METHOD(Phar, webPhar)
}
if (!mime_type) {
- code = phar_file_type(&PHAR_G(mime_types), entry, &mime_type TSRMLS_CC);
+ code = phar_file_type(&PHAR_G(mime_types), entry, &mime_type);
}
- phar_file_action(phar, info, mime_type, code, entry, entry_len, fname, pt, ru, ru_len TSRMLS_CC);
+ phar_file_action(phar, info, mime_type, code, entry, entry_len, fname, pt, ru, ru_len);
}
/* }}} */
@@ -856,26 +856,26 @@ PHP_METHOD(Phar, mungServer)
{
zval *mungvalues, *data;
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "a", &mungvalues) == FAILURE) {
+ if (zend_parse_parameters(ZEND_NUM_ARGS(), "a", &mungvalues) == FAILURE) {
return;
}
if (!zend_hash_num_elements(Z_ARRVAL_P(mungvalues))) {
- zend_throw_exception_ex(phar_ce_PharException, 0 TSRMLS_CC, "No values passed to Phar::mungServer(), expecting an array of any of these strings: PHP_SELF, REQUEST_URI, SCRIPT_FILENAME, SCRIPT_NAME");
+ zend_throw_exception_ex(phar_ce_PharException, 0, "No values passed to Phar::mungServer(), expecting an array of any of these strings: PHP_SELF, REQUEST_URI, SCRIPT_FILENAME, SCRIPT_NAME");
return;
}
if (zend_hash_num_elements(Z_ARRVAL_P(mungvalues)) > 4) {
- zend_throw_exception_ex(phar_ce_PharException, 0 TSRMLS_CC, "Too many values passed to Phar::mungServer(), expecting an array of any of these strings: PHP_SELF, REQUEST_URI, SCRIPT_FILENAME, SCRIPT_NAME");
+ zend_throw_exception_ex(phar_ce_PharException, 0, "Too many values passed to Phar::mungServer(), expecting an array of any of these strings: PHP_SELF, REQUEST_URI, SCRIPT_FILENAME, SCRIPT_NAME");
return;
}
- phar_request_initialize(TSRMLS_C);
+ phar_request_initialize();
ZEND_HASH_FOREACH_VAL(Z_ARRVAL_P(mungvalues), data) {
if (Z_TYPE_P(data) != IS_STRING) {
- zend_throw_exception_ex(phar_ce_PharException, 0 TSRMLS_CC, "Non-string value passed to Phar::mungServer(), expecting an array of any of these strings: PHP_SELF, REQUEST_URI, SCRIPT_FILENAME, SCRIPT_NAME");
+ zend_throw_exception_ex(phar_ce_PharException, 0, "Non-string value passed to Phar::mungServer(), expecting an array of any of these strings: PHP_SELF, REQUEST_URI, SCRIPT_FILENAME, SCRIPT_NAME");
return;
}
@@ -912,7 +912,7 @@ PHP_METHOD(Phar, interceptFileFuncs)
if (zend_parse_parameters_none() == FAILURE) {
return;
}
- phar_intercept_functions(TSRMLS_C);
+ phar_intercept_functions();
}
/* }}} */
@@ -927,14 +927,14 @@ PHP_METHOD(Phar, createDefaultStub)
size_t index_len = 0, webindex_len = 0;
size_t stub_len;
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "|ss", &index, &index_len, &webindex, &webindex_len) == FAILURE) {
+ if (zend_parse_parameters(ZEND_NUM_ARGS(), "|ss", &index, &index_len, &webindex, &webindex_len) == FAILURE) {
return;
}
- stub = phar_create_default_stub(index, webindex, &stub_len, &error TSRMLS_CC);
+ stub = phar_create_default_stub(index, webindex, &stub_len, &error);
if (error) {
- zend_throw_exception_ex(phar_ce_PharException, 0 TSRMLS_CC, "%s", error);
+ zend_throw_exception_ex(phar_ce_PharException, 0, "%s", error);
efree(error);
return;
}
@@ -952,16 +952,16 @@ PHP_METHOD(Phar, mapPhar)
size_t alias_len = 0;
zend_long dataoffset = 0;
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "|s!l", &alias, &alias_len, &dataoffset) == FAILURE) {
+ if (zend_parse_parameters(ZEND_NUM_ARGS(), "|s!l", &alias, &alias_len, &dataoffset) == FAILURE) {
return;
}
- phar_request_initialize(TSRMLS_C);
+ phar_request_initialize();
- RETVAL_BOOL(phar_open_executed_filename(alias, alias_len, &error TSRMLS_CC) == SUCCESS);
+ RETVAL_BOOL(phar_open_executed_filename(alias, alias_len, &error) == SUCCESS);
if (error) {
- zend_throw_exception_ex(phar_ce_PharException, 0 TSRMLS_CC, "%s", error);
+ zend_throw_exception_ex(phar_ce_PharException, 0, "%s", error);
efree(error);
}
} /* }}} */
@@ -973,16 +973,16 @@ PHP_METHOD(Phar, loadPhar)
char *fname, *alias = NULL, *error;
size_t fname_len, alias_len = 0;
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s|s!", &fname, &fname_len, &alias, &alias_len) == FAILURE) {
+ if (zend_parse_parameters(ZEND_NUM_ARGS(), "s|s!", &fname, &fname_len, &alias, &alias_len) == FAILURE) {
return;
}
- phar_request_initialize(TSRMLS_C);
+ phar_request_initialize();
- RETVAL_BOOL(phar_open_from_filename(fname, fname_len, alias, alias_len, REPORT_ERRORS, NULL, &error TSRMLS_CC) == SUCCESS);
+ RETVAL_BOOL(phar_open_from_filename(fname, fname_len, alias, alias_len, REPORT_ERRORS, NULL, &error) == SUCCESS);
if (error) {
- zend_throw_exception_ex(phar_ce_PharException, 0 TSRMLS_CC, "%s", error);
+ zend_throw_exception_ex(phar_ce_PharException, 0, "%s", error);
efree(error);
}
} /* }}} */
@@ -1004,11 +1004,11 @@ PHP_METHOD(Phar, canCompress)
{
zend_long method = 0;
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "|l", &method) == FAILURE) {
+ if (zend_parse_parameters(ZEND_NUM_ARGS(), "|l", &method) == FAILURE) {
return;
}
- phar_request_initialize(TSRMLS_C);
+ phar_request_initialize();
switch (method) {
case PHAR_ENT_COMPRESSED_GZ:
if (PHAR_G(has_zlib)) {
@@ -1053,12 +1053,12 @@ PHP_METHOD(Phar, isValidPharFilename)
int ext_len, is_executable;
zend_bool executable = 1;
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s|b", &fname, &fname_len, &executable) == FAILURE) {
+ if (zend_parse_parameters(ZEND_NUM_ARGS(), "s|b", &fname, &fname_len, &executable) == FAILURE) {
return;
}
is_executable = executable;
- RETVAL_BOOL(phar_detect_phar_fname_ext(fname, fname_len, &ext_str, &ext_len, is_executable, 2, 1 TSRMLS_CC) == SUCCESS);
+ RETVAL_BOOL(phar_detect_phar_fname_ext(fname, fname_len, &ext_str, &ext_len, is_executable, 2, 1) == SUCCESS);
}
/* }}} */
@@ -1066,12 +1066,12 @@ PHP_METHOD(Phar, isValidPharFilename)
/**
* from spl_directory
*/
-static void phar_spl_foreign_dtor(spl_filesystem_object *object TSRMLS_DC) /* {{{ */
+static void phar_spl_foreign_dtor(spl_filesystem_object *object) /* {{{ */
{
phar_archive_data *phar = (phar_archive_data *) object->oth;
if (!phar->is_persistent) {
- phar_archive_delref(phar TSRMLS_CC);
+ phar_archive_delref(phar);
}
object->oth = NULL;
@@ -1081,7 +1081,7 @@ static void phar_spl_foreign_dtor(spl_filesystem_object *object TSRMLS_DC) /* {{
/**
* from spl_directory
*/
-static void phar_spl_foreign_clone(spl_filesystem_object *src, spl_filesystem_object *dst TSRMLS_DC) /* {{{ */
+static void phar_spl_foreign_clone(spl_filesystem_object *src, spl_filesystem_object *dst) /* {{{ */
{
phar_archive_data *phar_data = (phar_archive_data *) dst->oth;
@@ -1109,7 +1109,7 @@ static spl_other_handler phar_spl_foreign_handler = {
PHP_METHOD(Phar, __construct)
{
#if !HAVE_SPL
- zend_throw_exception_ex(zend_exception_get_default(TSRMLS_C), 0 TSRMLS_CC, "Cannot instantiate Phar object without SPL extension");
+ zend_throw_exception_ex(zend_exception_get_default(), 0, "Cannot instantiate Phar object without SPL extension");
#else
char *fname, *alias = NULL, *error, *arch = NULL, *entry = NULL, *save_fname;
size_t fname_len, alias_len = 0;
@@ -1122,25 +1122,25 @@ PHP_METHOD(Phar, __construct)
phar_obj = (phar_archive_object*)((char*)Z_OBJ_P(zobj) - Z_OBJ_P(zobj)->handlers->offset);
- is_data = instanceof_function(Z_OBJCE_P(zobj), phar_ce_data TSRMLS_CC);
+ is_data = instanceof_function(Z_OBJCE_P(zobj), phar_ce_data);
if (is_data) {
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s|ls!l", &fname, &fname_len, &flags, &alias, &alias_len, &format) == FAILURE) {
+ if (zend_parse_parameters(ZEND_NUM_ARGS(), "s|ls!l", &fname, &fname_len, &flags, &alias, &alias_len, &format) == FAILURE) {
return;
}
} else {
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s|ls!", &fname, &fname_len, &flags, &alias, &alias_len) == FAILURE) {
+ if (zend_parse_parameters(ZEND_NUM_ARGS(), "s|ls!", &fname, &fname_len, &flags, &alias, &alias_len) == FAILURE) {
return;
}
}
if (phar_obj->archive) {
- zend_throw_exception_ex(spl_ce_BadMethodCallException, 0 TSRMLS_CC, "Cannot call constructor twice");
+ zend_throw_exception_ex(spl_ce_BadMethodCallException, 0, "Cannot call constructor twice");
return;
}
save_fname = fname;
- if (SUCCESS == phar_split_fname(fname, (int)fname_len, &arch, &arch_len, &entry, &entry_len, !is_data, 2 TSRMLS_CC)) {
+ if (SUCCESS == phar_split_fname(fname, (int)fname_len, &arch, &arch_len, &entry, &entry_len, !is_data, 2)) {
/* use arch (the basename for the archive) for fname instead of fname */
/* this allows support for RecursiveDirectoryIterator of subdirectories */
#ifdef PHP_WIN32
@@ -1157,7 +1157,7 @@ PHP_METHOD(Phar, __construct)
#endif
}
- if (phar_open_or_create_filename(fname, fname_len, alias, alias_len, is_data, REPORT_ERRORS, &phar_data, &error TSRMLS_CC) == FAILURE) {
+ if (phar_open_or_create_filename(fname, fname_len, alias, alias_len, is_data, REPORT_ERRORS, &phar_data, &error) == FAILURE) {
if (fname == arch && fname != save_fname) {
efree(arch);
@@ -1169,11 +1169,11 @@ PHP_METHOD(Phar, __construct)
}
if (error) {
- zend_throw_exception_ex(spl_ce_UnexpectedValueException, 0 TSRMLS_CC,
+ zend_throw_exception_ex(spl_ce_UnexpectedValueException, 0,
"%s", error);
efree(error);
} else {
- zend_throw_exception_ex(spl_ce_UnexpectedValueException, 0 TSRMLS_CC,
+ zend_throw_exception_ex(spl_ce_UnexpectedValueException, 0,
"Phar creation or opening failed");
}
@@ -1192,10 +1192,10 @@ PHP_METHOD(Phar, __construct)
if ((is_data && !phar_data->is_data) || (!is_data && phar_data->is_data)) {
if (is_data) {
- zend_throw_exception_ex(spl_ce_UnexpectedValueException, 0 TSRMLS_CC,
+ zend_throw_exception_ex(spl_ce_UnexpectedValueException, 0,
"PharData class can only be used for non-executable tar and zip archives");
} else {
- zend_throw_exception_ex(spl_ce_UnexpectedValueException, 0 TSRMLS_CC,
+ zend_throw_exception_ex(spl_ce_UnexpectedValueException, 0,
"Phar class can only be used for executable tar and zip archives");
}
efree(entry);
@@ -1276,7 +1276,7 @@ PHP_METHOD(Phar, getSupportedCompression)
}
array_init(return_value);
- phar_request_initialize(TSRMLS_C);
+ phar_request_initialize();
if (PHAR_G(has_zlib)) {
add_next_index_stringl(return_value, "GZ", 2);
@@ -1298,31 +1298,31 @@ PHP_METHOD(Phar, unlinkArchive)
int zname_len, arch_len, entry_len;
phar_archive_data *phar;
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s", &fname, &fname_len) == FAILURE) {
+ if (zend_parse_parameters(ZEND_NUM_ARGS(), "s", &fname, &fname_len) == FAILURE) {
RETURN_FALSE;
}
if (!fname_len) {
- zend_throw_exception_ex(phar_ce_PharException, 0 TSRMLS_CC, "Unknown phar archive \"\"");
+ zend_throw_exception_ex(phar_ce_PharException, 0, "Unknown phar archive \"\"");
return;
}
- if (FAILURE == phar_open_from_filename(fname, fname_len, NULL, 0, REPORT_ERRORS, &phar, &error TSRMLS_CC)) {
+ if (FAILURE == phar_open_from_filename(fname, fname_len, NULL, 0, REPORT_ERRORS, &phar, &error)) {
if (error) {
- zend_throw_exception_ex(phar_ce_PharException, 0 TSRMLS_CC, "Unknown phar archive \"%s\": %s", fname, error);
+ zend_throw_exception_ex(phar_ce_PharException, 0, "Unknown phar archive \"%s\": %s", fname, error);
efree(error);
} else {
- zend_throw_exception_ex(phar_ce_PharException, 0 TSRMLS_CC, "Unknown phar archive \"%s\"", fname);
+ zend_throw_exception_ex(phar_ce_PharException, 0, "Unknown phar archive \"%s\"", fname);
}
return;
}
- zname = (char*)zend_get_executed_filename(TSRMLS_C);
+ zname = (char*)zend_get_executed_filename();
zname_len = strlen(zname);
- if (zname_len > 7 && !memcmp(zname, "phar://", 7) && SUCCESS == phar_split_fname(zname, zname_len, &arch, &arch_len, &entry, &entry_len, 2, 0 TSRMLS_CC)) {
+ if (zname_len > 7 && !memcmp(zname, "phar://", 7) && SUCCESS == phar_split_fname(zname, zname_len, &arch, &arch_len, &entry, &entry_len, 2, 0)) {
if (arch_len == fname_len && !memcmp(arch, fname, arch_len)) {
- zend_throw_exception_ex(phar_ce_PharException, 0 TSRMLS_CC, "phar archive \"%s\" cannot be unlinked from within itself", fname);
+ zend_throw_exception_ex(phar_ce_PharException, 0, "phar archive \"%s\" cannot be unlinked from within itself", fname);
efree(arch);
efree(entry);
return;
@@ -1332,12 +1332,12 @@ PHP_METHOD(Phar, unlinkArchive)
}
if (phar->is_persistent) {
- zend_throw_exception_ex(phar_ce_PharException, 0 TSRMLS_CC, "phar archive \"%s\" is in phar.cache_list, cannot unlinkArchive()", fname);
+ zend_throw_exception_ex(phar_ce_PharException, 0, "phar archive \"%s\" is in phar.cache_list, cannot unlinkArchive()", fname);
return;
}
if (phar->refcount) {
- zend_throw_exception_ex(phar_ce_PharException, 0 TSRMLS_CC, "phar archive \"%s\" has open file handles or objects. fclose() all file handles, and unset() all objects prior to calling unlinkArchive()", fname);
+ zend_throw_exception_ex(phar_ce_PharException, 0, "phar archive \"%s\" has open file handles or objects. fclose() all file handles, and unset() all objects prior to calling unlinkArchive()", fname);
return;
}
@@ -1347,7 +1347,7 @@ PHP_METHOD(Phar, unlinkArchive)
PHAR_G(last_phar) = NULL;
PHAR_G(last_phar_name) = PHAR_G(last_alias) = NULL;
- phar_archive_delref(phar TSRMLS_CC);
+ phar_archive_delref(phar);
unlink(fname);
efree(fname);
RETURN_TRUE;
@@ -1360,7 +1360,7 @@ PHP_METHOD(Phar, unlinkArchive)
zval *zobj = getThis(); \
phar_archive_object *phar_obj = (phar_archive_object*)((char*)Z_OBJ_P(zobj) - Z_OBJ_P(zobj)->handlers->offset); \
if (!phar_obj->archive) { \
- zend_throw_exception_ex(spl_ce_BadMethodCallException, 0 TSRMLS_CC, \
+ zend_throw_exception_ex(spl_ce_BadMethodCallException, 0, \
"Cannot call method on an uninitialized Phar object"); \
return; \
}
@@ -1389,7 +1389,7 @@ struct _phar_t {
int count;
};
-static int phar_build(zend_object_iterator *iter, void *puser TSRMLS_DC) /* {{{ */
+static int phar_build(zend_object_iterator *iter, void *puser) /* {{{ */
{
zval *value;
zend_bool close_fp = 1;
@@ -1404,7 +1404,7 @@ static int phar_build(zend_object_iterator *iter, void *puser TSRMLS_DC) /* {{{
phar_archive_object *phar_obj = p_obj->p;
char *str = "[stream]";
- value = iter->funcs->get_current_data(iter TSRMLS_CC);
+ value = iter->funcs->get_current_data(iter);
if (EG(exception)) {
return ZEND_HASH_APPLY_STOP;
@@ -1412,7 +1412,7 @@ static int phar_build(zend_object_iterator *iter, void *puser TSRMLS_DC) /* {{{
if (!value) {
/* failure in get_current_data */
- zend_throw_exception_ex(spl_ce_UnexpectedValueException, 0 TSRMLS_CC, "Iterator %v returned no value", ce->name->val);
+ zend_throw_exception_ex(spl_ce_UnexpectedValueException, 0, "Iterator %v returned no value", ce->name->val);
return ZEND_HASH_APPLY_STOP;
}
@@ -1423,13 +1423,13 @@ static int phar_build(zend_object_iterator *iter, void *puser TSRMLS_DC) /* {{{
php_stream_from_zval_no_verify(fp, value);
if (!fp) {
- zend_throw_exception_ex(spl_ce_BadMethodCallException, 0 TSRMLS_CC, "Iterator %v returned an invalid stream handle", ce->name->val);
+ zend_throw_exception_ex(spl_ce_BadMethodCallException, 0, "Iterator %v returned an invalid stream handle", ce->name->val);
return ZEND_HASH_APPLY_STOP;
}
if (iter->funcs->get_current_key) {
zval key;
- iter->funcs->get_current_key(iter, &key TSRMLS_CC);
+ iter->funcs->get_current_key(iter, &key);
if (EG(exception)) {
return ZEND_HASH_APPLY_STOP;
@@ -1437,7 +1437,7 @@ static int phar_build(zend_object_iterator *iter, void *puser TSRMLS_DC) /* {{{
if (Z_TYPE(key) != IS_STRING) {
zval_dtor(&key);
- zend_throw_exception_ex(spl_ce_UnexpectedValueException, 0 TSRMLS_CC, "Iterator %v returned an invalid key (must return a string)", ce->name->val);
+ zend_throw_exception_ex(spl_ce_UnexpectedValueException, 0, "Iterator %v returned an invalid key (must return a string)", ce->name->val);
return ZEND_HASH_APPLY_STOP;
}
@@ -1447,7 +1447,7 @@ static int phar_build(zend_object_iterator *iter, void *puser TSRMLS_DC) /* {{{
save = str_key;
zval_dtor(&key);
} else {
- zend_throw_exception_ex(spl_ce_UnexpectedValueException, 0 TSRMLS_CC, "Iterator %v returned an invalid key (must return a string)", ce->name->val);
+ zend_throw_exception_ex(spl_ce_UnexpectedValueException, 0, "Iterator %v returned an invalid key (must return a string)", ce->name->val);
return ZEND_HASH_APPLY_STOP;
}
@@ -1455,21 +1455,21 @@ static int phar_build(zend_object_iterator *iter, void *puser TSRMLS_DC) /* {{{
opened = (char *) estrndup(str, sizeof("[stream]") - 1);
goto after_open_fp;
case IS_OBJECT:
- if (instanceof_function(Z_OBJCE_P(value), spl_ce_SplFileInfo TSRMLS_CC)) {
+ if (instanceof_function(Z_OBJCE_P(value), spl_ce_SplFileInfo)) {
char *test = NULL;
zval dummy;
spl_filesystem_object *intern = (spl_filesystem_object*)((char*)Z_OBJ_P(value) - Z_OBJ_P(value)->handlers->offset);
if (!base_len) {
- zend_throw_exception_ex(spl_ce_BadMethodCallException, 0 TSRMLS_CC, "Iterator %v returns an SplFileInfo object, so base directory must be specified", ce->name->val);
+ zend_throw_exception_ex(spl_ce_BadMethodCallException, 0, "Iterator %v returns an SplFileInfo object, so base directory must be specified", ce->name->val);
return ZEND_HASH_APPLY_STOP;
}
switch (intern->type) {
case SPL_FS_DIR:
- test = spl_filesystem_object_get_path(intern, NULL TSRMLS_CC);
+ test = spl_filesystem_object_get_path(intern, NULL);
fname_len = spprintf(&fname, 0, "%s%c%s", test, DEFAULT_SLASH, intern->u.dir.entry.d_name);
- php_stat(fname, fname_len, FS_IS_DIR, &dummy TSRMLS_CC);
+ php_stat(fname, fname_len, FS_IS_DIR, &dummy);
if (Z_TYPE(dummy) == IS_TRUE) {
/* ignore directories */
@@ -1477,14 +1477,14 @@ static int phar_build(zend_object_iterator *iter, void *puser TSRMLS_DC) /* {{{
return ZEND_HASH_APPLY_KEEP;
}
- test = expand_filepath(fname, NULL TSRMLS_CC);
+ test = expand_filepath(fname, NULL);
efree(fname);
if (test) {
fname = test;
fname_len = strlen(fname);
} else {
- zend_throw_exception_ex(spl_ce_UnexpectedValueException, 0 TSRMLS_CC, "Could not resolve file path");
+ zend_throw_exception_ex(spl_ce_UnexpectedValueException, 0, "Could not resolve file path");
return ZEND_HASH_APPLY_STOP;
}
@@ -1492,9 +1492,9 @@ static int phar_build(zend_object_iterator *iter, void *puser TSRMLS_DC) /* {{{
goto phar_spl_fileinfo;
case SPL_FS_INFO:
case SPL_FS_FILE:
- fname = expand_filepath(intern->file_name, NULL TSRMLS_CC);
+ fname = expand_filepath(intern->file_name, NULL);
if (!fname) {
- zend_throw_exception_ex(spl_ce_UnexpectedValueException, 0 TSRMLS_CC, "Could not resolve file path");
+ zend_throw_exception_ex(spl_ce_UnexpectedValueException, 0, "Could not resolve file path");
return ZEND_HASH_APPLY_STOP;
}
@@ -1505,7 +1505,7 @@ static int phar_build(zend_object_iterator *iter, void *puser TSRMLS_DC) /* {{{
}
/* fall-through */
default:
- zend_throw_exception_ex(spl_ce_UnexpectedValueException, 0 TSRMLS_CC, "Iterator %v returned an invalid value (must return a string)", ce->name->val);
+ zend_throw_exception_ex(spl_ce_UnexpectedValueException, 0, "Iterator %v returned an invalid value (must return a string)", ce->name->val);
return ZEND_HASH_APPLY_STOP;
}
@@ -1514,9 +1514,9 @@ static int phar_build(zend_object_iterator *iter, void *puser TSRMLS_DC) /* {{{
phar_spl_fileinfo:
if (base_len) {
- temp = expand_filepath(base, NULL TSRMLS_CC);
+ temp = expand_filepath(base, NULL);
if (!temp) {
- zend_throw_exception_ex(spl_ce_UnexpectedValueException, 0 TSRMLS_CC, "Could not resolve file path");
+ zend_throw_exception_ex(spl_ce_UnexpectedValueException, 0, "Could not resolve file path");
if (save) {
efree(save);
}
@@ -1545,7 +1545,7 @@ phar_spl_fileinfo:
}
} else {
- zend_throw_exception_ex(spl_ce_UnexpectedValueException, 0 TSRMLS_CC, "Iterator %v returned a path \"%s\" that is not in the base directory \"%s\"", ce->name->val, fname, base);
+ zend_throw_exception_ex(spl_ce_UnexpectedValueException, 0, "Iterator %v returned a path \"%s\" that is not in the base directory \"%s\"", ce->name->val, fname, base);
if (save) {
efree(save);
@@ -1557,7 +1557,7 @@ phar_spl_fileinfo:
} else {
if (iter->funcs->get_current_key) {
zval key;
- iter->funcs->get_current_key(iter, &key TSRMLS_CC);
+ iter->funcs->get_current_key(iter, &key);
if (EG(exception)) {
return ZEND_HASH_APPLY_STOP;
@@ -1565,7 +1565,7 @@ phar_spl_fileinfo:
if (Z_TYPE(key) != IS_STRING) {
zval_dtor(&key);
- zend_throw_exception_ex(spl_ce_UnexpectedValueException, 0 TSRMLS_CC, "Iterator %v returned an invalid key (must return a string)", ce->name->val);
+ zend_throw_exception_ex(spl_ce_UnexpectedValueException, 0, "Iterator %v returned an invalid key (must return a string)", ce->name->val);
return ZEND_HASH_APPLY_STOP;
}
@@ -1575,13 +1575,13 @@ phar_spl_fileinfo:
save = str_key;
zval_dtor(&key);
} else {
- zend_throw_exception_ex(spl_ce_UnexpectedValueException, 0 TSRMLS_CC, "Iterator %v returned an invalid key (must return a string)", ce->name->val);
+ zend_throw_exception_ex(spl_ce_UnexpectedValueException, 0, "Iterator %v returned an invalid key (must return a string)", ce->name->val);
return ZEND_HASH_APPLY_STOP;
}
}
#if PHP_API_VERSION < 20100412
if (PG(safe_mode) && (!php_checkuid(fname, NULL, CHECKUID_ALLOW_ONLY_FILE))) {
- zend_throw_exception_ex(spl_ce_UnexpectedValueException, 0 TSRMLS_CC, "Iterator %v returned a path \"%s\" that safe mode prevents opening", ce->name->val, fname);
+ zend_throw_exception_ex(spl_ce_UnexpectedValueException, 0, "Iterator %v returned a path \"%s\" that safe mode prevents opening", ce->name->val, fname);
if (save) {
efree(save);
@@ -1595,8 +1595,8 @@ phar_spl_fileinfo:
}
#endif
- if (php_check_open_basedir(fname TSRMLS_CC)) {
- zend_throw_exception_ex(spl_ce_UnexpectedValueException, 0 TSRMLS_CC, "Iterator %v returned a path \"%s\" that open_basedir prevents opening", ce->name->val, fname);
+ if (php_check_open_basedir(fname)) {
+ zend_throw_exception_ex(spl_ce_UnexpectedValueException, 0, "Iterator %v returned a path \"%s\" that open_basedir prevents opening", ce->name->val, fname);
if (save) {
efree(save);
@@ -1613,7 +1613,7 @@ phar_spl_fileinfo:
fp = php_stream_open_wrapper(fname, "rb", STREAM_MUST_SEEK|0, &opened);
if (!fp) {
- zend_throw_exception_ex(spl_ce_UnexpectedValueException, 0 TSRMLS_CC, "Iterator %v returned a file that could not be opened \"%s\"", ce->name->val, fname);
+ zend_throw_exception_ex(spl_ce_UnexpectedValueException, 0, "Iterator %v returned a file that could not be opened \"%s\"", ce->name->val, fname);
if (save) {
efree(save);
@@ -1647,8 +1647,8 @@ after_open_fp:
return ZEND_HASH_APPLY_KEEP;
}
- if (!(data = phar_get_or_create_entry_data(phar_obj->archive->fname, phar_obj->archive->fname_len, str_key, str_key_len, "w+b", 0, &error, 1 TSRMLS_CC))) {
- zend_throw_exception_ex(spl_ce_BadMethodCallException, 0 TSRMLS_CC, "Entry %s cannot be created: %s", str_key, error);
+ if (!(data = phar_get_or_create_entry_data(phar_obj->archive->fname, phar_obj->archive->fname_len, str_key, str_key_len, "w+b", 0, &error, 1))) {
+ zend_throw_exception_ex(spl_ce_BadMethodCallException, 0, "Entry %s cannot be created: %s", str_key, error);
efree(error);
if (save) {
@@ -1704,7 +1704,7 @@ after_open_fp:
}
data->internal_file->compressed_filesize = data->internal_file->uncompressed_filesize = contents_len;
- phar_entry_delref(data TSRMLS_CC);
+ phar_entry_delref(data);
return ZEND_HASH_APPLY_KEEP;
}
@@ -1727,18 +1727,18 @@ PHP_METHOD(Phar, buildFromDirectory)
PHAR_ARCHIVE_OBJECT();
if (PHAR_G(readonly) && !phar_obj->archive->is_data) {
- zend_throw_exception_ex(spl_ce_UnexpectedValueException, 0 TSRMLS_CC,
+ zend_throw_exception_ex(spl_ce_UnexpectedValueException, 0,
"Cannot write to archive - write operations restricted by INI setting");
return;
}
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s|s", &dir, &dir_len, &regex, &regex_len) == FAILURE) {
+ if (zend_parse_parameters(ZEND_NUM_ARGS(), "s|s", &dir, &dir_len, &regex, &regex_len) == FAILURE) {
RETURN_FALSE;
}
if (SUCCESS != object_init_ex(&iter, spl_ce_RecursiveDirectoryIterator)) {
zval_ptr_dtor(&iter);
- zend_throw_exception_ex(spl_ce_BadMethodCallException, 0 TSRMLS_CC, "Unable to instantiate directory iterator for %s", phar_obj->archive->fname);
+ zend_throw_exception_ex(spl_ce_BadMethodCallException, 0, "Unable to instantiate directory iterator for %s", phar_obj->archive->fname);
RETURN_FALSE;
}
@@ -1757,7 +1757,7 @@ PHP_METHOD(Phar, buildFromDirectory)
if (SUCCESS != object_init_ex(&iteriter, spl_ce_RecursiveIteratorIterator)) {
zval_ptr_dtor(&iter);
zval_ptr_dtor(&iteriter);
- zend_throw_exception_ex(spl_ce_BadMethodCallException, 0 TSRMLS_CC, "Unable to instantiate directory iterator for %s", phar_obj->archive->fname);
+ zend_throw_exception_ex(spl_ce_BadMethodCallException, 0, "Unable to instantiate directory iterator for %s", phar_obj->archive->fname);
RETURN_FALSE;
}
@@ -1778,7 +1778,7 @@ PHP_METHOD(Phar, buildFromDirectory)
if (SUCCESS != object_init_ex(&regexiter, spl_ce_RegexIterator)) {
zval_ptr_dtor(&iteriter);
zval_dtor(&regexiter);
- zend_throw_exception_ex(spl_ce_BadMethodCallException, 0 TSRMLS_CC, "Unable to instantiate regex iterator for %s", phar_obj->archive->fname);
+ zend_throw_exception_ex(spl_ce_BadMethodCallException, 0, "Unable to instantiate regex iterator for %s", phar_obj->archive->fname);
RETURN_FALSE;
}
@@ -1799,21 +1799,21 @@ PHP_METHOD(Phar, buildFromDirectory)
pass.ret = return_value;
pass.fp = php_stream_fopen_tmpfile();
if (pass.fp == NULL) {
- zend_throw_exception_ex(phar_ce_PharException, 0 TSRMLS_CC, "phar \"%s\" unable to create temporary file", phar_obj->archive->fname);
+ zend_throw_exception_ex(phar_ce_PharException, 0, "phar \"%s\" unable to create temporary file", phar_obj->archive->fname);
return;
}
- if (phar_obj->archive->is_persistent && FAILURE == phar_copy_on_write(&(phar_obj->archive) TSRMLS_CC)) {
+ if (phar_obj->archive->is_persistent && FAILURE == phar_copy_on_write(&(phar_obj->archive))) {
zval_ptr_dtor(&iteriter);
if (apply_reg) {
zval_ptr_dtor(&regexiter);
}
php_stream_close(pass.fp);
- zend_throw_exception_ex(phar_ce_PharException, 0 TSRMLS_CC, "phar \"%s\" is persistent, unable to copy on write", phar_obj->archive->fname);
+ zend_throw_exception_ex(phar_ce_PharException, 0, "phar \"%s\" is persistent, unable to copy on write", phar_obj->archive->fname);
return;
}
- if (SUCCESS == spl_iterator_apply((apply_reg ? &regexiter : &iteriter), (spl_iterator_apply_func_t) phar_build, (void *) &pass TSRMLS_CC)) {
+ if (SUCCESS == spl_iterator_apply((apply_reg ? &regexiter : &iteriter), (spl_iterator_apply_func_t) phar_build, (void *) &pass)) {
zval_ptr_dtor(&iteriter);
if (apply_reg) {
@@ -1821,10 +1821,10 @@ PHP_METHOD(Phar, buildFromDirectory)
}
phar_obj->archive->ufp = pass.fp;
- phar_flush(phar_obj->archive, 0, 0, 0, &error TSRMLS_CC);
+ phar_flush(phar_obj->archive, 0, 0, 0, &error);
if (error) {
- zend_throw_exception_ex(phar_ce_PharException, 0 TSRMLS_CC, "%s", error);
+ zend_throw_exception_ex(phar_ce_PharException, 0, "%s", error);
efree(error);
}
@@ -1859,17 +1859,17 @@ PHP_METHOD(Phar, buildFromIterator)
PHAR_ARCHIVE_OBJECT();
if (PHAR_G(readonly) && !phar_obj->archive->is_data) {
- zend_throw_exception_ex(spl_ce_UnexpectedValueException, 0 TSRMLS_CC,
+ zend_throw_exception_ex(spl_ce_UnexpectedValueException, 0,
"Cannot write out phar archive, phar is read-only");
return;
}
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "O|s", &obj, zend_ce_traversable, &base, &base_len) == FAILURE) {
+ if (zend_parse_parameters(ZEND_NUM_ARGS(), "O|s", &obj, zend_ce_traversable, &base, &base_len) == FAILURE) {
RETURN_FALSE;
}
- if (phar_obj->archive->is_persistent && FAILURE == phar_copy_on_write(&(phar_obj->archive) TSRMLS_CC)) {
- zend_throw_exception_ex(phar_ce_PharException, 0 TSRMLS_CC, "phar \"%s\" is persistent, unable to copy on write", phar_obj->archive->fname);
+ if (phar_obj->archive->is_persistent && FAILURE == phar_copy_on_write(&(phar_obj->archive))) {
+ zend_throw_exception_ex(phar_ce_PharException, 0, "phar \"%s\" is persistent, unable to copy on write", phar_obj->archive->fname);
return;
}
@@ -1883,15 +1883,15 @@ PHP_METHOD(Phar, buildFromIterator)
pass.count = 0;
pass.fp = php_stream_fopen_tmpfile();
if (pass.fp == NULL) {
- zend_throw_exception_ex(phar_ce_PharException, 0 TSRMLS_CC, "phar \"%s\": unable to create temporary file", phar_obj->archive->fname);
+ zend_throw_exception_ex(phar_ce_PharException, 0, "phar \"%s\": unable to create temporary file", phar_obj->archive->fname);
return;
}
- if (SUCCESS == spl_iterator_apply(obj, (spl_iterator_apply_func_t) phar_build, (void *) &pass TSRMLS_CC)) {
+ if (SUCCESS == spl_iterator_apply(obj, (spl_iterator_apply_func_t) phar_build, (void *) &pass)) {
phar_obj->archive->ufp = pass.fp;
- phar_flush(phar_obj->archive, 0, 0, 0, &error TSRMLS_CC);
+ phar_flush(phar_obj->archive, 0, 0, 0, &error);
if (error) {
- zend_throw_exception_ex(phar_ce_PharException, 0 TSRMLS_CC, "%s", error);
+ zend_throw_exception_ex(phar_ce_PharException, 0, "%s", error);
efree(error);
}
} else {
@@ -1909,7 +1909,7 @@ PHP_METHOD(Phar, count)
zend_long mode;
PHAR_ARCHIVE_OBJECT();
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "|l", &mode) == FAILURE) {
+ if (zend_parse_parameters(ZEND_NUM_ARGS(), "|l", &mode) == FAILURE) {
RETURN_FALSE;
}
@@ -1926,7 +1926,7 @@ PHP_METHOD(Phar, isFileFormat)
zend_long type;
PHAR_ARCHIVE_OBJECT();
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "l", &type) == FAILURE) {
+ if (zend_parse_parameters(ZEND_NUM_ARGS(), "l", &type) == FAILURE) {
RETURN_FALSE;
}
@@ -1938,40 +1938,40 @@ PHP_METHOD(Phar, isFileFormat)
case PHAR_FORMAT_PHAR:
RETURN_BOOL(!phar_obj->archive->is_tar && !phar_obj->archive->is_zip);
default:
- zend_throw_exception_ex(phar_ce_PharException, 0 TSRMLS_CC, "Unknown file format specified");
+ zend_throw_exception_ex(phar_ce_PharException, 0, "Unknown file format specified");
}
}
/* }}} */
-static int phar_copy_file_contents(phar_entry_info *entry, php_stream *fp TSRMLS_DC) /* {{{ */
+static int phar_copy_file_contents(phar_entry_info *entry, php_stream *fp) /* {{{ */
{
char *error;
zend_off_t offset;
phar_entry_info *link;
- if (FAILURE == phar_open_entry_fp(entry, &error, 1 TSRMLS_CC)) {
+ if (FAILURE == phar_open_entry_fp(entry, &error, 1)) {
if (error) {
- zend_throw_exception_ex(spl_ce_UnexpectedValueException, 0 TSRMLS_CC,
+ zend_throw_exception_ex(spl_ce_UnexpectedValueException, 0,
"Cannot convert phar archive \"%s\", unable to open entry \"%s\" contents: %s", entry->phar->fname, entry->filename, error);
efree(error);
} else {
- zend_throw_exception_ex(spl_ce_UnexpectedValueException, 0 TSRMLS_CC,
+ zend_throw_exception_ex(spl_ce_UnexpectedValueException, 0,
"Cannot convert phar archive \"%s\", unable to open entry \"%s\" contents", entry->phar->fname, entry->filename);
}
return FAILURE;
}
/* copy old contents in entirety */
- phar_seek_efp(entry, 0, SEEK_SET, 0, 1 TSRMLS_CC);
+ phar_seek_efp(entry, 0, SEEK_SET, 0, 1);
offset = php_stream_tell(fp);
- link = phar_get_link_source(entry TSRMLS_CC);
+ link = phar_get_link_source(entry);
if (!link) {
link = entry;
}
- if (SUCCESS != php_stream_copy_to_stream_ex(phar_get_efp(link, 0 TSRMLS_CC), fp, link->uncompressed_filesize, NULL)) {
- zend_throw_exception_ex(spl_ce_UnexpectedValueException, 0 TSRMLS_CC,
+ if (SUCCESS != php_stream_copy_to_stream_ex(phar_get_efp(link, 0), fp, link->uncompressed_filesize, NULL)) {
+ zend_throw_exception_ex(spl_ce_UnexpectedValueException, 0,
"Cannot convert phar archive \"%s\", unable to copy entry \"%s\" contents", entry->phar->fname, entry->filename);
return FAILURE;
}
@@ -1989,7 +1989,7 @@ static int phar_copy_file_contents(phar_entry_info *entry, php_stream *fp TSRMLS
}
/* }}} */
-static zend_object *phar_rename_archive(phar_archive_data *phar, char *ext, zend_bool compress TSRMLS_DC) /* {{{ */
+static zend_object *phar_rename_archive(phar_archive_data *phar, char *ext, zend_bool compress) /* {{{ */
{
const char *oldname = NULL;
char *oldpath = NULL;
@@ -2053,9 +2053,9 @@ static zend_object *phar_rename_archive(phar_archive_data *phar, char *ext, zend
} else if (phar_path_check(&ext, (int *)&ext_len, &pcr_error) > pcr_is_ok) {
if (phar->is_data) {
- zend_throw_exception_ex(spl_ce_BadMethodCallException, 0 TSRMLS_CC, "data phar converted from \"%s\" has invalid extension %s", phar->fname, ext);
+ zend_throw_exception_ex(spl_ce_BadMethodCallException, 0, "data phar converted from \"%s\" has invalid extension %s", phar->fname, ext);
} else {
- zend_throw_exception_ex(spl_ce_BadMethodCallException, 0 TSRMLS_CC, "phar converted from \"%s\" has invalid extension %s", phar->fname, ext);
+ zend_throw_exception_ex(spl_ce_BadMethodCallException, 0, "phar converted from \"%s\" has invalid extension %s", phar->fname, ext);
}
return NULL;
}
@@ -2084,7 +2084,7 @@ static zend_object *phar_rename_archive(phar_archive_data *phar, char *ext, zend
if (PHAR_G(manifest_cached) && NULL != (pphar = zend_hash_str_find_ptr(&cached_phars, newpath, phar->fname_len))) {
efree(oldpath);
- zend_throw_exception_ex(spl_ce_BadMethodCallException, 0 TSRMLS_CC, "Unable to add newly converted phar \"%s\" to the list of phars, new phar name is in phar.cache_list", phar->fname);
+ zend_throw_exception_ex(spl_ce_BadMethodCallException, 0, "Unable to add newly converted phar \"%s\" to the list of phars, new phar name is in phar.cache_list", phar->fname);
return NULL;
}
@@ -2097,7 +2097,7 @@ static zend_object *phar_rename_archive(phar_archive_data *phar, char *ext, zend
pphar->flags = phar->flags;
pphar->fp = phar->fp;
phar->fp = NULL;
- phar_destroy_phar_data(phar TSRMLS_CC);
+ phar_destroy_phar_data(phar);
phar = pphar;
phar->refcount++;
newpath = oldpath;
@@ -2106,19 +2106,19 @@ static zend_object *phar_rename_archive(phar_archive_data *phar, char *ext, zend
}
efree(oldpath);
- zend_throw_exception_ex(spl_ce_BadMethodCallException, 0 TSRMLS_CC, "Unable to add newly converted phar \"%s\" to the list of phars, a phar with that name already exists", phar->fname);
+ zend_throw_exception_ex(spl_ce_BadMethodCallException, 0, "Unable to add newly converted phar \"%s\" to the list of phars, a phar with that name already exists", phar->fname);
return NULL;
}
its_ok:
if (SUCCESS == php_stream_stat_path(newpath, &ssb)) {
efree(oldpath);
- zend_throw_exception_ex(spl_ce_BadMethodCallException, 0 TSRMLS_CC, "phar \"%s\" exists and must be unlinked prior to conversion", newpath);
+ zend_throw_exception_ex(spl_ce_BadMethodCallException, 0, "phar \"%s\" exists and must be unlinked prior to conversion", newpath);
return NULL;
}
if (!phar->is_data) {
- if (SUCCESS != phar_detect_phar_fname_ext(newpath, phar->fname_len, (const char **) &(phar->ext), &(phar->ext_len), 1, 1, 1 TSRMLS_CC)) {
+ if (SUCCESS != phar_detect_phar_fname_ext(newpath, phar->fname_len, (const char **) &(phar->ext), &(phar->ext_len), 1, 1, 1)) {
efree(oldpath);
- zend_throw_exception_ex(spl_ce_BadMethodCallException, 0 TSRMLS_CC, "phar \"%s\" has invalid extension %s", phar->fname, ext);
+ zend_throw_exception_ex(spl_ce_BadMethodCallException, 0, "phar \"%s\" has invalid extension %s", phar->fname, ext);
return NULL;
}
@@ -2136,9 +2136,9 @@ its_ok:
} else {
- if (SUCCESS != phar_detect_phar_fname_ext(newpath, phar->fname_len, (const char **) &(phar->ext), &(phar->ext_len), 0, 1, 1 TSRMLS_CC)) {
+ if (SUCCESS != phar_detect_phar_fname_ext(newpath, phar->fname_len, (const char **) &(phar->ext), &(phar->ext_len), 0, 1, 1)) {
efree(oldpath);
- zend_throw_exception_ex(spl_ce_BadMethodCallException, 0 TSRMLS_CC, "data phar \"%s\" has invalid extension %s", phar->fname, ext);
+ zend_throw_exception_ex(spl_ce_BadMethodCallException, 0, "data phar \"%s\" has invalid extension %s", phar->fname, ext);
return NULL;
}
@@ -2148,14 +2148,14 @@ its_ok:
if ((!pphar || phar == pphar) && NULL == zend_hash_str_update_ptr(&(PHAR_GLOBALS->phar_fname_map), newpath, phar->fname_len, phar)) {
efree(oldpath);
- zend_throw_exception_ex(spl_ce_BadMethodCallException, 0 TSRMLS_CC, "Unable to add newly converted phar \"%s\" to the list of phars", phar->fname);
+ zend_throw_exception_ex(spl_ce_BadMethodCallException, 0, "Unable to add newly converted phar \"%s\" to the list of phars", phar->fname);
return NULL;
}
- phar_flush(phar, 0, 0, 1, &error TSRMLS_CC);
+ phar_flush(phar, 0, 0, 1, &error);
if (error) {
- zend_throw_exception_ex(spl_ce_BadMethodCallException, 0 TSRMLS_CC, "%s", error);
+ zend_throw_exception_ex(spl_ce_BadMethodCallException, 0, "%s", error);
efree(error);
efree(oldpath);
return NULL;
@@ -2172,7 +2172,7 @@ its_ok:
ZVAL_NULL(&ret);
if (SUCCESS != object_init_ex(&ret, ce)) {
zval_dtor(&ret);
- zend_throw_exception_ex(spl_ce_BadMethodCallException, 0 TSRMLS_CC, "Unable to instantiate phar object when converting archive \"%s\"", phar->fname);
+ zend_throw_exception_ex(spl_ce_BadMethodCallException, 0, "Unable to instantiate phar object when converting archive \"%s\"", phar->fname);
return NULL;
}
@@ -2184,7 +2184,7 @@ its_ok:
}
/* }}} */
-static zend_object *phar_convert_to_other(phar_archive_data *source, int convert, char *ext, php_uint32 flags TSRMLS_DC) /* {{{ */
+static zend_object *phar_convert_to_other(phar_archive_data *source, int convert, char *ext, php_uint32 flags) /* {{{ */
{
phar_archive_data *phar;
phar_entry_info *entry, newentry;
@@ -2220,7 +2220,7 @@ static zend_object *phar_convert_to_other(phar_archive_data *source, int convert
phar->fp = php_stream_fopen_tmpfile();
if (phar->fp == NULL) {
- zend_throw_exception_ex(phar_ce_PharException, 0 TSRMLS_CC, "unable to create temporary file");
+ zend_throw_exception_ex(phar_ce_PharException, 0, "unable to create temporary file");
return NULL;
}
phar->fname = source->fname;
@@ -2250,7 +2250,7 @@ static zend_object *phar_convert_to_other(phar_archive_data *source, int convert
newentry.metadata_str.s = NULL;
- if (FAILURE == phar_copy_file_contents(&newentry, phar->fp TSRMLS_CC)) {
+ if (FAILURE == phar_copy_file_contents(&newentry, phar->fp)) {
zend_hash_destroy(&(phar->manifest));
php_stream_close(phar->fp);
efree(phar);
@@ -2275,12 +2275,12 @@ no_copy:
newentry.is_modified = 1;
newentry.phar = phar;
newentry.old_flags = newentry.flags & ~PHAR_ENT_COMPRESSION_MASK; /* remove compression from old_flags */
- phar_set_inode(&newentry TSRMLS_CC);
+ phar_set_inode(&newentry);
zend_hash_str_add_mem(&(phar->manifest), newentry.filename, newentry.filename_len, (void*)&newentry, sizeof(phar_entry_info));
- phar_add_virtual_dirs(phar, newentry.filename, newentry.filename_len TSRMLS_CC);
+ phar_add_virtual_dirs(phar, newentry.filename, newentry.filename_len);
} ZEND_HASH_FOREACH_END();
- if ((ret = phar_rename_archive(phar, ext, 0 TSRMLS_CC))) {
+ if ((ret = phar_rename_archive(phar, ext, 0))) {
return ret;
} else {
zend_hash_destroy(&(phar->manifest));
@@ -2310,12 +2310,12 @@ PHP_METHOD(Phar, convertToExecutable)
zend_long format = 9021976, method = 9021976;
PHAR_ARCHIVE_OBJECT();
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "|lls", &format, &method, &ext, &ext_len) == FAILURE) {
+ if (zend_parse_parameters(ZEND_NUM_ARGS(), "|lls", &format, &method, &ext, &ext_len) == FAILURE) {
return;
}
if (PHAR_G(readonly)) {
- zend_throw_exception_ex(spl_ce_UnexpectedValueException, 0 TSRMLS_CC,
+ zend_throw_exception_ex(spl_ce_UnexpectedValueException, 0,
"Cannot write out executable phar archive, phar is read-only");
return;
}
@@ -2337,7 +2337,7 @@ PHP_METHOD(Phar, convertToExecutable)
case PHAR_FORMAT_ZIP:
break;
default:
- zend_throw_exception_ex(spl_ce_BadMethodCallException, 0 TSRMLS_CC,
+ zend_throw_exception_ex(spl_ce_BadMethodCallException, 0,
"Unknown file format specified, please pass one of Phar::PHAR, Phar::TAR or Phar::ZIP");
return;
}
@@ -2351,13 +2351,13 @@ PHP_METHOD(Phar, convertToExecutable)
break;
case PHAR_ENT_COMPRESSED_GZ:
if (format == PHAR_FORMAT_ZIP) {
- zend_throw_exception_ex(spl_ce_BadMethodCallException, 0 TSRMLS_CC,
+ zend_throw_exception_ex(spl_ce_BadMethodCallException, 0,
"Cannot compress entire archive with gzip, zip archives do not support whole-archive compression");
return;
}
if (!PHAR_G(has_zlib)) {
- zend_throw_exception_ex(spl_ce_BadMethodCallException, 0 TSRMLS_CC,
+ zend_throw_exception_ex(spl_ce_BadMethodCallException, 0,
"Cannot compress entire archive with gzip, enable ext/zlib in php.ini");
return;
}
@@ -2366,13 +2366,13 @@ PHP_METHOD(Phar, convertToExecutable)
break;
case PHAR_ENT_COMPRESSED_BZ2:
if (format == PHAR_FORMAT_ZIP) {
- zend_throw_exception_ex(spl_ce_BadMethodCallException, 0 TSRMLS_CC,
+ zend_throw_exception_ex(spl_ce_BadMethodCallException, 0,
"Cannot compress entire archive with bz2, zip archives do not support whole-archive compression");
return;
}
if (!PHAR_G(has_bz2)) {
- zend_throw_exception_ex(spl_ce_BadMethodCallException, 0 TSRMLS_CC,
+ zend_throw_exception_ex(spl_ce_BadMethodCallException, 0,
"Cannot compress entire archive with bz2, enable ext/bz2 in php.ini");
return;
}
@@ -2380,14 +2380,14 @@ PHP_METHOD(Phar, convertToExecutable)
flags = PHAR_FILE_COMPRESSED_BZ2;
break;
default:
- zend_throw_exception_ex(spl_ce_BadMethodCallException, 0 TSRMLS_CC,
+ zend_throw_exception_ex(spl_ce_BadMethodCallException, 0,
"Unknown compression specified, please pass one of Phar::GZ or Phar::BZ2");
return;
}
is_data = phar_obj->archive->is_data;
phar_obj->archive->is_data = 0;
- ret = phar_convert_to_other(phar_obj->archive, format, ext, flags TSRMLS_CC);
+ ret = phar_convert_to_other(phar_obj->archive, format, ext, flags);
phar_obj->archive->is_data = is_data;
if (ret) {
@@ -2414,7 +2414,7 @@ PHP_METHOD(Phar, convertToData)
zend_long format = 9021976, method = 9021976;
PHAR_ARCHIVE_OBJECT();
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "|lls", &format, &method, &ext, &ext_len) == FAILURE) {
+ if (zend_parse_parameters(ZEND_NUM_ARGS(), "|lls", &format, &method, &ext, &ext_len) == FAILURE) {
return;
}
@@ -2427,20 +2427,20 @@ PHP_METHOD(Phar, convertToData)
} else if (phar_obj->archive->is_zip) {
format = PHAR_FORMAT_ZIP;
} else {
- zend_throw_exception_ex(spl_ce_UnexpectedValueException, 0 TSRMLS_CC,
+ zend_throw_exception_ex(spl_ce_UnexpectedValueException, 0,
"Cannot write out data phar archive, use Phar::TAR or Phar::ZIP");
return;
}
break;
case PHAR_FORMAT_PHAR:
- zend_throw_exception_ex(spl_ce_UnexpectedValueException, 0 TSRMLS_CC,
+ zend_throw_exception_ex(spl_ce_UnexpectedValueException, 0,
"Cannot write out data phar archive, use Phar::TAR or Phar::ZIP");
return;
case PHAR_FORMAT_TAR:
case PHAR_FORMAT_ZIP:
break;
default:
- zend_throw_exception_ex(spl_ce_BadMethodCallException, 0 TSRMLS_CC,
+ zend_throw_exception_ex(spl_ce_BadMethodCallException, 0,
"Unknown file format specified, please pass one of Phar::TAR or Phar::ZIP");
return;
}
@@ -2454,13 +2454,13 @@ PHP_METHOD(Phar, convertToData)
break;
case PHAR_ENT_COMPRESSED_GZ:
if (format == PHAR_FORMAT_ZIP) {
- zend_throw_exception_ex(spl_ce_BadMethodCallException, 0 TSRMLS_CC,
+ zend_throw_exception_ex(spl_ce_BadMethodCallException, 0,
"Cannot compress entire archive with gzip, zip archives do not support whole-archive compression");
return;
}
if (!PHAR_G(has_zlib)) {
- zend_throw_exception_ex(spl_ce_BadMethodCallException, 0 TSRMLS_CC,
+ zend_throw_exception_ex(spl_ce_BadMethodCallException, 0,
"Cannot compress entire archive with gzip, enable ext/zlib in php.ini");
return;
}
@@ -2469,13 +2469,13 @@ PHP_METHOD(Phar, convertToData)
break;
case PHAR_ENT_COMPRESSED_BZ2:
if (format == PHAR_FORMAT_ZIP) {
- zend_throw_exception_ex(spl_ce_BadMethodCallException, 0 TSRMLS_CC,
+ zend_throw_exception_ex(spl_ce_BadMethodCallException, 0,
"Cannot compress entire archive with bz2, zip archives do not support whole-archive compression");
return;
}
if (!PHAR_G(has_bz2)) {
- zend_throw_exception_ex(spl_ce_BadMethodCallException, 0 TSRMLS_CC,
+ zend_throw_exception_ex(spl_ce_BadMethodCallException, 0,
"Cannot compress entire archive with bz2, enable ext/bz2 in php.ini");
return;
}
@@ -2483,14 +2483,14 @@ PHP_METHOD(Phar, convertToData)
flags = PHAR_FILE_COMPRESSED_BZ2;
break;
default:
- zend_throw_exception_ex(spl_ce_BadMethodCallException, 0 TSRMLS_CC,
+ zend_throw_exception_ex(spl_ce_BadMethodCallException, 0,
"Unknown compression specified, please pass one of Phar::GZ or Phar::BZ2");
return;
}
is_data = phar_obj->archive->is_data;
phar_obj->archive->is_data = 1;
- ret = phar_convert_to_other(phar_obj->archive, format, ext, flags TSRMLS_CC);
+ ret = phar_convert_to_other(phar_obj->archive, format, ext, flags);
phar_obj->archive->is_data = is_data;
if (ret) {
@@ -2565,17 +2565,17 @@ PHP_METHOD(Phar, delete)
PHAR_ARCHIVE_OBJECT();
if (PHAR_G(readonly) && !phar_obj->archive->is_data) {
- zend_throw_exception_ex(spl_ce_UnexpectedValueException, 0 TSRMLS_CC,
+ zend_throw_exception_ex(spl_ce_UnexpectedValueException, 0,
"Cannot write out phar archive, phar is read-only");
return;
}
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s", &fname, &fname_len) == FAILURE) {
+ if (zend_parse_parameters(ZEND_NUM_ARGS(), "s", &fname, &fname_len) == FAILURE) {
RETURN_FALSE;
}
- if (phar_obj->archive->is_persistent && FAILURE == phar_copy_on_write(&(phar_obj->archive) TSRMLS_CC)) {
- zend_throw_exception_ex(phar_ce_PharException, 0 TSRMLS_CC, "phar \"%s\" is persistent, unable to copy on write", phar_obj->archive->fname);
+ if (phar_obj->archive->is_persistent && FAILURE == phar_copy_on_write(&(phar_obj->archive))) {
+ zend_throw_exception_ex(phar_ce_PharException, 0, "phar \"%s\" is persistent, unable to copy on write", phar_obj->archive->fname);
return;
}
if (zend_hash_str_exists(&phar_obj->archive->manifest, fname, (uint) fname_len)) {
@@ -2590,13 +2590,13 @@ PHP_METHOD(Phar, delete)
}
}
} else {
- zend_throw_exception_ex(spl_ce_BadMethodCallException, 0 TSRMLS_CC, "Entry %s does not exist and cannot be deleted", fname);
+ zend_throw_exception_ex(spl_ce_BadMethodCallException, 0, "Entry %s does not exist and cannot be deleted", fname);
RETURN_FALSE;
}
- phar_flush(phar_obj->archive, NULL, 0, 0, &error TSRMLS_CC);
+ phar_flush(phar_obj->archive, NULL, 0, 0, &error);
if (error) {
- zend_throw_exception_ex(phar_ce_PharException, 0 TSRMLS_CC, "%s", error);
+ zend_throw_exception_ex(phar_ce_PharException, 0, "%s", error);
efree(error);
}
@@ -2650,7 +2650,7 @@ PHP_METHOD(Phar, setAlias)
PHAR_ARCHIVE_OBJECT();
if (PHAR_G(readonly) && !phar_obj->archive->is_data) {
- zend_throw_exception_ex(spl_ce_UnexpectedValueException, 0 TSRMLS_CC,
+ zend_throw_exception_ex(spl_ce_UnexpectedValueException, 0,
"Cannot write out phar archive, phar is read-only");
RETURN_FALSE;
}
@@ -2661,37 +2661,37 @@ PHP_METHOD(Phar, setAlias)
if (phar_obj->archive->is_data) {
if (phar_obj->archive->is_tar) {
- zend_throw_exception_ex(spl_ce_UnexpectedValueException, 0 TSRMLS_CC,
+ zend_throw_exception_ex(spl_ce_UnexpectedValueException, 0,
"A Phar alias cannot be set in a plain tar archive");
} else {
- zend_throw_exception_ex(spl_ce_UnexpectedValueException, 0 TSRMLS_CC,
+ zend_throw_exception_ex(spl_ce_UnexpectedValueException, 0,
"A Phar alias cannot be set in a plain zip archive");
}
RETURN_FALSE;
}
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s", &alias, &alias_len) == SUCCESS) {
+ if (zend_parse_parameters(ZEND_NUM_ARGS(), "s", &alias, &alias_len) == SUCCESS) {
if (alias_len == phar_obj->archive->alias_len && memcmp(phar_obj->archive->alias, alias, alias_len) == 0) {
RETURN_TRUE;
}
if (alias_len && NULL != (fd_ptr = zend_hash_str_find_ptr(&(PHAR_GLOBALS->phar_alias_map), alias, alias_len))) {
spprintf(&error, 0, "alias \"%s\" is already used for archive \"%s\" and cannot be used for other archives", alias, fd_ptr->fname);
- if (SUCCESS == phar_free_alias(fd_ptr, alias, alias_len TSRMLS_CC)) {
+ if (SUCCESS == phar_free_alias(fd_ptr, alias, alias_len)) {
efree(error);
goto valid_alias;
}
- zend_throw_exception_ex(phar_ce_PharException, 0 TSRMLS_CC, "%s", error);
+ zend_throw_exception_ex(phar_ce_PharException, 0, "%s", error);
efree(error);
RETURN_FALSE;
}
if (!phar_validate_alias(alias, alias_len)) {
- zend_throw_exception_ex(spl_ce_UnexpectedValueException, 0 TSRMLS_CC,
+ zend_throw_exception_ex(spl_ce_UnexpectedValueException, 0,
"Invalid alias \"%s\" specified for phar \"%s\"", alias, phar_obj->archive->fname);
RETURN_FALSE;
}
valid_alias:
- if (phar_obj->archive->is_persistent && FAILURE == phar_copy_on_write(&(phar_obj->archive) TSRMLS_CC)) {
- zend_throw_exception_ex(phar_ce_PharException, 0 TSRMLS_CC, "phar \"%s\" is persistent, unable to copy on write", phar_obj->archive->fname);
+ if (phar_obj->archive->is_persistent && FAILURE == phar_copy_on_write(&(phar_obj->archive))) {
+ zend_throw_exception_ex(phar_ce_PharException, 0, "phar \"%s\" is persistent, unable to copy on write", phar_obj->archive->fname);
return;
}
if (phar_obj->archive->alias_len && NULL != (fd_ptr = zend_hash_str_find_ptr(&(PHAR_GLOBALS->phar_alias_map), phar_obj->archive->alias, phar_obj->archive->alias_len))) {
@@ -2711,13 +2711,13 @@ valid_alias:
phar_obj->archive->alias_len = alias_len;
phar_obj->archive->is_temporary_alias = 0;
- phar_flush(phar_obj->archive, NULL, 0, 0, &error TSRMLS_CC);
+ phar_flush(phar_obj->archive, NULL, 0, 0, &error);
if (error) {
phar_obj->archive->alias = oldalias;
phar_obj->archive->alias_len = oldalias_len;
phar_obj->archive->is_temporary_alias = old_temp;
- zend_throw_exception_ex(phar_ce_PharException, 0 TSRMLS_CC, "%s", error);
+ zend_throw_exception_ex(phar_ce_PharException, 0, "%s", error);
if (readd) {
zend_hash_str_add_ptr(&(PHAR_GLOBALS->phar_alias_map), oldalias, oldalias_len, phar_obj->archive);
}
@@ -2797,16 +2797,16 @@ PHP_METHOD(Phar, stopBuffering)
}
if (PHAR_G(readonly) && !phar_obj->archive->is_data) {
- zend_throw_exception_ex(spl_ce_UnexpectedValueException, 0 TSRMLS_CC,
+ zend_throw_exception_ex(spl_ce_UnexpectedValueException, 0,
"Cannot write out phar archive, phar is read-only");
return;
}
phar_obj->archive->donotflush = 0;
- phar_flush(phar_obj->archive, 0, 0, 0, &error TSRMLS_CC);
+ phar_flush(phar_obj->archive, 0, 0, 0, &error);
if (error) {
- zend_throw_exception_ex(phar_ce_PharException, 0 TSRMLS_CC, "%s", error);
+ zend_throw_exception_ex(phar_ce_PharException, 0, "%s", error);
efree(error);
}
}
@@ -2826,52 +2826,52 @@ PHP_METHOD(Phar, setStub)
PHAR_ARCHIVE_OBJECT();
if (PHAR_G(readonly) && !phar_obj->archive->is_data) {
- zend_throw_exception_ex(spl_ce_UnexpectedValueException, 0 TSRMLS_CC,
+ zend_throw_exception_ex(spl_ce_UnexpectedValueException, 0,
"Cannot change stub, phar is read-only");
return;
}
if (phar_obj->archive->is_data) {
if (phar_obj->archive->is_tar) {
- zend_throw_exception_ex(spl_ce_UnexpectedValueException, 0 TSRMLS_CC,
+ zend_throw_exception_ex(spl_ce_UnexpectedValueException, 0,
"A Phar stub cannot be set in a plain tar archive");
} else {
- zend_throw_exception_ex(spl_ce_UnexpectedValueException, 0 TSRMLS_CC,
+ zend_throw_exception_ex(spl_ce_UnexpectedValueException, 0,
"A Phar stub cannot be set in a plain zip archive");
}
return;
}
- if (zend_parse_parameters_ex(ZEND_PARSE_PARAMS_QUIET, ZEND_NUM_ARGS() TSRMLS_CC, "r|l", &zstub, &len) == SUCCESS) {
+ if (zend_parse_parameters_ex(ZEND_PARSE_PARAMS_QUIET, ZEND_NUM_ARGS(), "r|l", &zstub, &len) == SUCCESS) {
if ((php_stream_from_zval_no_verify(stream, zstub)) != NULL) {
if (len > 0) {
len = -len;
} else {
len = -1;
}
- if (phar_obj->archive->is_persistent && FAILURE == phar_copy_on_write(&(phar_obj->archive) TSRMLS_CC)) {
- zend_throw_exception_ex(phar_ce_PharException, 0 TSRMLS_CC, "phar \"%s\" is persistent, unable to copy on write", phar_obj->archive->fname);
+ if (phar_obj->archive->is_persistent && FAILURE == phar_copy_on_write(&(phar_obj->archive))) {
+ zend_throw_exception_ex(phar_ce_PharException, 0, "phar \"%s\" is persistent, unable to copy on write", phar_obj->archive->fname);
return;
}
- phar_flush(phar_obj->archive, (char *) zstub, len, 0, &error TSRMLS_CC);
+ phar_flush(phar_obj->archive, (char *) zstub, len, 0, &error);
if (error) {
- zend_throw_exception_ex(phar_ce_PharException, 0 TSRMLS_CC, "%s", error);
+ zend_throw_exception_ex(phar_ce_PharException, 0, "%s", error);
efree(error);
}
RETURN_TRUE;
} else {
- zend_throw_exception_ex(spl_ce_UnexpectedValueException, 0 TSRMLS_CC,
+ zend_throw_exception_ex(spl_ce_UnexpectedValueException, 0,
"Cannot change stub, unable to read from input stream");
}
- } else if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s", &stub, &stub_len) == SUCCESS) {
- if (phar_obj->archive->is_persistent && FAILURE == phar_copy_on_write(&(phar_obj->archive) TSRMLS_CC)) {
- zend_throw_exception_ex(phar_ce_PharException, 0 TSRMLS_CC, "phar \"%s\" is persistent, unable to copy on write", phar_obj->archive->fname);
+ } else if (zend_parse_parameters(ZEND_NUM_ARGS(), "s", &stub, &stub_len) == SUCCESS) {
+ if (phar_obj->archive->is_persistent && FAILURE == phar_copy_on_write(&(phar_obj->archive))) {
+ zend_throw_exception_ex(phar_ce_PharException, 0, "phar \"%s\" is persistent, unable to copy on write", phar_obj->archive->fname);
return;
}
- phar_flush(phar_obj->archive, stub, stub_len, 0, &error TSRMLS_CC);
+ phar_flush(phar_obj->archive, stub, stub_len, 0, &error);
if (error) {
- zend_throw_exception_ex(phar_ce_PharException, 0 TSRMLS_CC, "%s", error);
+ zend_throw_exception_ex(phar_ce_PharException, 0, "%s", error);
efree(error);
}
@@ -2905,35 +2905,35 @@ PHP_METHOD(Phar, setDefaultStub)
if (phar_obj->archive->is_data) {
if (phar_obj->archive->is_tar) {
- zend_throw_exception_ex(spl_ce_UnexpectedValueException, 0 TSRMLS_CC,
+ zend_throw_exception_ex(spl_ce_UnexpectedValueException, 0,
"A Phar stub cannot be set in a plain tar archive");
} else {
- zend_throw_exception_ex(spl_ce_UnexpectedValueException, 0 TSRMLS_CC,
+ zend_throw_exception_ex(spl_ce_UnexpectedValueException, 0,
"A Phar stub cannot be set in a plain zip archive");
}
return;
}
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "|s!s", &index, &index_len, &webindex, &webindex_len) == FAILURE) {
+ if (zend_parse_parameters(ZEND_NUM_ARGS(), "|s!s", &index, &index_len, &webindex, &webindex_len) == FAILURE) {
RETURN_FALSE;
}
if (ZEND_NUM_ARGS() > 0 && (phar_obj->archive->is_tar || phar_obj->archive->is_zip)) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "method accepts no arguments for a tar- or zip-based phar stub, %d given", ZEND_NUM_ARGS());
+ php_error_docref(NULL, E_WARNING, "method accepts no arguments for a tar- or zip-based phar stub, %d given", ZEND_NUM_ARGS());
RETURN_FALSE;
}
if (PHAR_G(readonly)) {
- zend_throw_exception_ex(spl_ce_UnexpectedValueException, 0 TSRMLS_CC,
+ zend_throw_exception_ex(spl_ce_UnexpectedValueException, 0,
"Cannot change stub: phar.readonly=1");
RETURN_FALSE;
}
if (!phar_obj->archive->is_tar && !phar_obj->archive->is_zip) {
- stub = phar_create_default_stub(index, webindex, &stub_len, &error TSRMLS_CC);
+ stub = phar_create_default_stub(index, webindex, &stub_len, &error);
if (error) {
- zend_throw_exception_ex(spl_ce_UnexpectedValueException, 0 TSRMLS_CC, "%s", error);
+ zend_throw_exception_ex(spl_ce_UnexpectedValueException, 0, "%s", error);
efree(error);
if (stub) {
efree(stub);
@@ -2944,18 +2944,18 @@ PHP_METHOD(Phar, setDefaultStub)
created_stub = 1;
}
- if (phar_obj->archive->is_persistent && FAILURE == phar_copy_on_write(&(phar_obj->archive) TSRMLS_CC)) {
- zend_throw_exception_ex(phar_ce_PharException, 0 TSRMLS_CC, "phar \"%s\" is persistent, unable to copy on write", phar_obj->archive->fname);
+ if (phar_obj->archive->is_persistent && FAILURE == phar_copy_on_write(&(phar_obj->archive))) {
+ zend_throw_exception_ex(phar_ce_PharException, 0, "phar \"%s\" is persistent, unable to copy on write", phar_obj->archive->fname);
return;
}
- phar_flush(phar_obj->archive, stub, stub_len, 1, &error TSRMLS_CC);
+ phar_flush(phar_obj->archive, stub, stub_len, 1, &error);
if (created_stub) {
efree(stub);
}
if (error) {
- zend_throw_exception_ex(phar_ce_PharException, 0 TSRMLS_CC, "%s", error);
+ zend_throw_exception_ex(phar_ce_PharException, 0, "%s", error);
efree(error);
RETURN_FALSE;
}
@@ -2979,12 +2979,12 @@ PHP_METHOD(Phar, setSignatureAlgorithm)
PHAR_ARCHIVE_OBJECT();
if (PHAR_G(readonly) && !phar_obj->archive->is_data) {
- zend_throw_exception_ex(spl_ce_UnexpectedValueException, 0 TSRMLS_CC,
+ zend_throw_exception_ex(spl_ce_UnexpectedValueException, 0,
"Cannot set signature algorithm, phar is read-only");
return;
}
- if (zend_parse_parameters_ex(ZEND_PARSE_PARAMS_QUIET, ZEND_NUM_ARGS() TSRMLS_CC, "l|s", &algo, &key, &key_len) != SUCCESS) {
+ if (zend_parse_parameters_ex(ZEND_PARSE_PARAMS_QUIET, ZEND_NUM_ARGS(), "l|s", &algo, &key, &key_len) != SUCCESS) {
return;
}
@@ -2992,15 +2992,15 @@ PHP_METHOD(Phar, setSignatureAlgorithm)
case PHAR_SIG_SHA256:
case PHAR_SIG_SHA512:
#ifndef PHAR_HASH_OK
- zend_throw_exception_ex(spl_ce_UnexpectedValueException, 0 TSRMLS_CC,
+ zend_throw_exception_ex(spl_ce_UnexpectedValueException, 0,
"SHA-256 and SHA-512 signatures are only supported if the hash extension is enabled and built non-shared");
return;
#endif
case PHAR_SIG_MD5:
case PHAR_SIG_SHA1:
case PHAR_SIG_OPENSSL:
- if (phar_obj->archive->is_persistent && FAILURE == phar_copy_on_write(&(phar_obj->archive) TSRMLS_CC)) {
- zend_throw_exception_ex(phar_ce_PharException, 0 TSRMLS_CC, "phar \"%s\" is persistent, unable to copy on write", phar_obj->archive->fname);
+ if (phar_obj->archive->is_persistent && FAILURE == phar_copy_on_write(&(phar_obj->archive))) {
+ zend_throw_exception_ex(phar_ce_PharException, 0, "phar \"%s\" is persistent, unable to copy on write", phar_obj->archive->fname);
return;
}
phar_obj->archive->sig_flags = algo;
@@ -3008,14 +3008,14 @@ PHP_METHOD(Phar, setSignatureAlgorithm)
PHAR_G(openssl_privatekey) = key;
PHAR_G(openssl_privatekey_len) = key_len;
- phar_flush(phar_obj->archive, 0, 0, 0, &error TSRMLS_CC);
+ phar_flush(phar_obj->archive, 0, 0, 0, &error);
if (error) {
- zend_throw_exception_ex(phar_ce_PharException, 0 TSRMLS_CC, "%s", error);
+ zend_throw_exception_ex(phar_ce_PharException, 0, "%s", error);
efree(error);
}
break;
default:
- zend_throw_exception_ex(spl_ce_UnexpectedValueException, 0 TSRMLS_CC,
+ zend_throw_exception_ex(spl_ce_UnexpectedValueException, 0,
"Unknown signature algorithm specified");
}
}
@@ -3079,7 +3079,7 @@ PHP_METHOD(Phar, getModified)
}
/* }}} */
-static int phar_set_compression(zval *zv, void *argument TSRMLS_DC) /* {{{ */
+static int phar_set_compression(zval *zv, void *argument) /* {{{ */
{
phar_entry_info *entry = (phar_entry_info *)Z_PTR_P(zv);
php_uint32 compress = *(php_uint32 *)argument;
@@ -3096,7 +3096,7 @@ static int phar_set_compression(zval *zv, void *argument TSRMLS_DC) /* {{{ */
}
/* }}} */
-static int phar_test_compression(zval *zv, void *argument TSRMLS_DC) /* {{{ */
+static int phar_test_compression(zval *zv, void *argument) /* {{{ */
{
phar_entry_info *entry = (phar_entry_info *)Z_PTR_P(zv);
@@ -3120,18 +3120,18 @@ static int phar_test_compression(zval *zv, void *argument TSRMLS_DC) /* {{{ */
}
/* }}} */
-static void pharobj_set_compression(HashTable *manifest, php_uint32 compress TSRMLS_DC) /* {{{ */
+static void pharobj_set_compression(HashTable *manifest, php_uint32 compress) /* {{{ */
{
- zend_hash_apply_with_argument(manifest, phar_set_compression, &compress TSRMLS_CC);
+ zend_hash_apply_with_argument(manifest, phar_set_compression, &compress);
}
/* }}} */
-static int pharobj_cancompress(HashTable *manifest TSRMLS_DC) /* {{{ */
+static int pharobj_cancompress(HashTable *manifest) /* {{{ */
{
int test;
test = 1;
- zend_hash_apply_with_argument(manifest, phar_test_compression, &test TSRMLS_CC);
+ zend_hash_apply_with_argument(manifest, phar_test_compression, &test);
return test;
}
/* }}} */
@@ -3150,18 +3150,18 @@ PHP_METHOD(Phar, compress)
zend_object *ret;
PHAR_ARCHIVE_OBJECT();
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "l|s", &method, &ext, &ext_len) == FAILURE) {
+ if (zend_parse_parameters(ZEND_NUM_ARGS(), "l|s", &method, &ext, &ext_len) == FAILURE) {
return;
}
if (PHAR_G(readonly) && !phar_obj->archive->is_data) {
- zend_throw_exception_ex(spl_ce_UnexpectedValueException, 0 TSRMLS_CC,
+ zend_throw_exception_ex(spl_ce_UnexpectedValueException, 0,
"Cannot compress phar archive, phar is read-only");
return;
}
if (phar_obj->archive->is_zip) {
- zend_throw_exception_ex(spl_ce_UnexpectedValueException, 0 TSRMLS_CC,
+ zend_throw_exception_ex(spl_ce_UnexpectedValueException, 0,
"Cannot compress zip-based archives with whole-archive compression");
return;
}
@@ -3172,7 +3172,7 @@ PHP_METHOD(Phar, compress)
break;
case PHAR_ENT_COMPRESSED_GZ:
if (!PHAR_G(has_zlib)) {
- zend_throw_exception_ex(spl_ce_BadMethodCallException, 0 TSRMLS_CC,
+ zend_throw_exception_ex(spl_ce_BadMethodCallException, 0,
"Cannot compress entire archive with gzip, enable ext/zlib in php.ini");
return;
}
@@ -3181,22 +3181,22 @@ PHP_METHOD(Phar, compress)
case PHAR_ENT_COMPRESSED_BZ2:
if (!PHAR_G(has_bz2)) {
- zend_throw_exception_ex(spl_ce_BadMethodCallException, 0 TSRMLS_CC,
+ zend_throw_exception_ex(spl_ce_BadMethodCallException, 0,
"Cannot compress entire archive with bz2, enable ext/bz2 in php.ini");
return;
}
flags = PHAR_FILE_COMPRESSED_BZ2;
break;
default:
- zend_throw_exception_ex(spl_ce_BadMethodCallException, 0 TSRMLS_CC,
+ zend_throw_exception_ex(spl_ce_BadMethodCallException, 0,
"Unknown compression specified, please pass one of Phar::GZ or Phar::BZ2");
return;
}
if (phar_obj->archive->is_tar) {
- ret = phar_convert_to_other(phar_obj->archive, PHAR_FORMAT_TAR, ext, flags TSRMLS_CC);
+ ret = phar_convert_to_other(phar_obj->archive, PHAR_FORMAT_TAR, ext, flags);
} else {
- ret = phar_convert_to_other(phar_obj->archive, PHAR_FORMAT_PHAR, ext, flags TSRMLS_CC);
+ ret = phar_convert_to_other(phar_obj->archive, PHAR_FORMAT_PHAR, ext, flags);
}
if (ret) {
@@ -3217,26 +3217,26 @@ PHP_METHOD(Phar, decompress)
zend_object *ret;
PHAR_ARCHIVE_OBJECT();
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "|s", &ext, &ext_len) == FAILURE) {
+ if (zend_parse_parameters(ZEND_NUM_ARGS(), "|s", &ext, &ext_len) == FAILURE) {
return;
}
if (PHAR_G(readonly) && !phar_obj->archive->is_data) {
- zend_throw_exception_ex(spl_ce_UnexpectedValueException, 0 TSRMLS_CC,
+ zend_throw_exception_ex(spl_ce_UnexpectedValueException, 0,
"Cannot decompress phar archive, phar is read-only");
return;
}
if (phar_obj->archive->is_zip) {
- zend_throw_exception_ex(spl_ce_UnexpectedValueException, 0 TSRMLS_CC,
+ zend_throw_exception_ex(spl_ce_UnexpectedValueException, 0,
"Cannot decompress zip-based archives with whole-archive compression");
return;
}
if (phar_obj->archive->is_tar) {
- ret = phar_convert_to_other(phar_obj->archive, PHAR_FORMAT_TAR, ext, PHAR_FILE_COMPRESSED_NONE TSRMLS_CC);
+ ret = phar_convert_to_other(phar_obj->archive, PHAR_FORMAT_TAR, ext, PHAR_FILE_COMPRESSED_NONE);
} else {
- ret = phar_convert_to_other(phar_obj->archive, PHAR_FORMAT_PHAR, ext, PHAR_FILE_COMPRESSED_NONE TSRMLS_CC);
+ ret = phar_convert_to_other(phar_obj->archive, PHAR_FORMAT_PHAR, ext, PHAR_FILE_COMPRESSED_NONE);
}
if (ret) {
@@ -3259,12 +3259,12 @@ PHP_METHOD(Phar, compressFiles)
zend_long method;
PHAR_ARCHIVE_OBJECT();
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "l", &method) == FAILURE) {
+ if (zend_parse_parameters(ZEND_NUM_ARGS(), "l", &method) == FAILURE) {
return;
}
if (PHAR_G(readonly) && !phar_obj->archive->is_data) {
- zend_throw_exception_ex(spl_ce_BadMethodCallException, 0 TSRMLS_CC,
+ zend_throw_exception_ex(spl_ce_BadMethodCallException, 0,
"Phar is readonly, cannot change compression");
return;
}
@@ -3272,7 +3272,7 @@ PHP_METHOD(Phar, compressFiles)
switch (method) {
case PHAR_ENT_COMPRESSED_GZ:
if (!PHAR_G(has_zlib)) {
- zend_throw_exception_ex(spl_ce_BadMethodCallException, 0 TSRMLS_CC,
+ zend_throw_exception_ex(spl_ce_BadMethodCallException, 0,
"Cannot compress files within archive with gzip, enable ext/zlib in php.ini");
return;
}
@@ -3281,45 +3281,45 @@ PHP_METHOD(Phar, compressFiles)
case PHAR_ENT_COMPRESSED_BZ2:
if (!PHAR_G(has_bz2)) {
- zend_throw_exception_ex(spl_ce_BadMethodCallException, 0 TSRMLS_CC,
+ zend_throw_exception_ex(spl_ce_BadMethodCallException, 0,
"Cannot compress files within archive with bz2, enable ext/bz2 in php.ini");
return;
}
flags = PHAR_ENT_COMPRESSED_BZ2;
break;
default:
- zend_throw_exception_ex(spl_ce_BadMethodCallException, 0 TSRMLS_CC,
+ zend_throw_exception_ex(spl_ce_BadMethodCallException, 0,
"Unknown compression specified, please pass one of Phar::GZ or Phar::BZ2");
return;
}
if (phar_obj->archive->is_tar) {
- zend_throw_exception_ex(spl_ce_BadMethodCallException, 0 TSRMLS_CC,
+ zend_throw_exception_ex(spl_ce_BadMethodCallException, 0,
"Cannot compress with Gzip compression, tar archives cannot compress individual files, use compress() to compress the whole archive");
return;
}
- if (!pharobj_cancompress(&phar_obj->archive->manifest TSRMLS_CC)) {
+ if (!pharobj_cancompress(&phar_obj->archive->manifest)) {
if (flags == PHAR_FILE_COMPRESSED_GZ) {
- zend_throw_exception_ex(spl_ce_BadMethodCallException, 0 TSRMLS_CC,
+ zend_throw_exception_ex(spl_ce_BadMethodCallException, 0,
"Cannot compress all files as Gzip, some are compressed as bzip2 and cannot be decompressed");
} else {
- zend_throw_exception_ex(spl_ce_BadMethodCallException, 0 TSRMLS_CC,
+ zend_throw_exception_ex(spl_ce_BadMethodCallException, 0,
"Cannot compress all files as Bzip2, some are compressed as gzip and cannot be decompressed");
}
return;
}
- if (phar_obj->archive->is_persistent && FAILURE == phar_copy_on_write(&(phar_obj->archive) TSRMLS_CC)) {
- zend_throw_exception_ex(phar_ce_PharException, 0 TSRMLS_CC, "phar \"%s\" is persistent, unable to copy on write", phar_obj->archive->fname);
+ if (phar_obj->archive->is_persistent && FAILURE == phar_copy_on_write(&(phar_obj->archive))) {
+ zend_throw_exception_ex(phar_ce_PharException, 0, "phar \"%s\" is persistent, unable to copy on write", phar_obj->archive->fname);
return;
}
- pharobj_set_compression(&phar_obj->archive->manifest, flags TSRMLS_CC);
+ pharobj_set_compression(&phar_obj->archive->manifest, flags);
phar_obj->archive->is_modified = 1;
- phar_flush(phar_obj->archive, 0, 0, 0, &error TSRMLS_CC);
+ phar_flush(phar_obj->archive, 0, 0, 0, &error);
if (error) {
- zend_throw_exception_ex(spl_ce_BadMethodCallException, 0 TSRMLS_CC, "%s", error);
+ zend_throw_exception_ex(spl_ce_BadMethodCallException, 0, "%s", error);
efree(error);
}
}
@@ -3338,13 +3338,13 @@ PHP_METHOD(Phar, decompressFiles)
}
if (PHAR_G(readonly) && !phar_obj->archive->is_data) {
- zend_throw_exception_ex(spl_ce_BadMethodCallException, 0 TSRMLS_CC,
+ zend_throw_exception_ex(spl_ce_BadMethodCallException, 0,
"Phar is readonly, cannot change compression");
return;
}
- if (!pharobj_cancompress(&phar_obj->archive->manifest TSRMLS_CC)) {
- zend_throw_exception_ex(spl_ce_BadMethodCallException, 0 TSRMLS_CC,
+ if (!pharobj_cancompress(&phar_obj->archive->manifest)) {
+ zend_throw_exception_ex(spl_ce_BadMethodCallException, 0,
"Cannot decompress all files, some are compressed as bzip2 or gzip and cannot be decompressed");
return;
}
@@ -3352,18 +3352,18 @@ PHP_METHOD(Phar, decompressFiles)
if (phar_obj->archive->is_tar) {
RETURN_TRUE;
} else {
- if (phar_obj->archive->is_persistent && FAILURE == phar_copy_on_write(&(phar_obj->archive) TSRMLS_CC)) {
- zend_throw_exception_ex(phar_ce_PharException, 0 TSRMLS_CC, "phar \"%s\" is persistent, unable to copy on write", phar_obj->archive->fname);
+ if (phar_obj->archive->is_persistent && FAILURE == phar_copy_on_write(&(phar_obj->archive))) {
+ zend_throw_exception_ex(phar_ce_PharException, 0, "phar \"%s\" is persistent, unable to copy on write", phar_obj->archive->fname);
return;
}
- pharobj_set_compression(&phar_obj->archive->manifest, PHAR_ENT_COMPRESSED_NONE TSRMLS_CC);
+ pharobj_set_compression(&phar_obj->archive->manifest, PHAR_ENT_COMPRESSED_NONE);
}
phar_obj->archive->is_modified = 1;
- phar_flush(phar_obj->archive, 0, 0, 0, &error TSRMLS_CC);
+ phar_flush(phar_obj->archive, 0, 0, 0, &error);
if (error) {
- zend_throw_exception_ex(spl_ce_BadMethodCallException, 0 TSRMLS_CC, "%s", error);
+ zend_throw_exception_ex(spl_ce_BadMethodCallException, 0, "%s", error);
efree(error);
}
@@ -3384,39 +3384,39 @@ PHP_METHOD(Phar, copy)
PHAR_ARCHIVE_OBJECT();
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "ss", &oldfile, &oldfile_len, &newfile, &newfile_len) == FAILURE) {
+ if (zend_parse_parameters(ZEND_NUM_ARGS(), "ss", &oldfile, &oldfile_len, &newfile, &newfile_len) == FAILURE) {
return;
}
if (PHAR_G(readonly) && !phar_obj->archive->is_data) {
- zend_throw_exception_ex(spl_ce_UnexpectedValueException, 0 TSRMLS_CC,
+ zend_throw_exception_ex(spl_ce_UnexpectedValueException, 0,
"Cannot copy \"%s\" to \"%s\", phar is read-only", oldfile, newfile);
RETURN_FALSE;
}
if (oldfile_len >= sizeof(".phar")-1 && !memcmp(oldfile, ".phar", sizeof(".phar")-1)) {
/* can't copy a meta file */
- zend_throw_exception_ex(spl_ce_UnexpectedValueException, 0 TSRMLS_CC,
+ zend_throw_exception_ex(spl_ce_UnexpectedValueException, 0,
"file \"%s\" cannot be copied to file \"%s\", cannot copy Phar meta-file in %s", oldfile, newfile, phar_obj->archive->fname);
RETURN_FALSE;
}
if (newfile_len >= sizeof(".phar")-1 && !memcmp(newfile, ".phar", sizeof(".phar")-1)) {
/* can't copy a meta file */
- zend_throw_exception_ex(spl_ce_UnexpectedValueException, 0 TSRMLS_CC,
+ zend_throw_exception_ex(spl_ce_UnexpectedValueException, 0,
"file \"%s\" cannot be copied to file \"%s\", cannot copy to Phar meta-file in %s", oldfile, newfile, phar_obj->archive->fname);
RETURN_FALSE;
}
if (!zend_hash_str_exists(&phar_obj->archive->manifest, oldfile, (uint) oldfile_len) || NULL == (oldentry = zend_hash_str_find_ptr(&phar_obj->archive->manifest, oldfile, (uint) oldfile_len)) || oldentry->is_deleted) {
- zend_throw_exception_ex(spl_ce_UnexpectedValueException, 0 TSRMLS_CC,
+ zend_throw_exception_ex(spl_ce_UnexpectedValueException, 0,
"file \"%s\" cannot be copied to file \"%s\", file does not exist in %s", oldfile, newfile, phar_obj->archive->fname);
RETURN_FALSE;
}
if (zend_hash_str_exists(&phar_obj->archive->manifest, newfile, (uint) newfile_len)) {
if (NULL != (temp = zend_hash_str_find_ptr(&phar_obj->archive->manifest, newfile, (uint) newfile_len)) || !temp->is_deleted) {
- zend_throw_exception_ex(spl_ce_UnexpectedValueException, 0 TSRMLS_CC,
+ zend_throw_exception_ex(spl_ce_UnexpectedValueException, 0,
"file \"%s\" cannot be copied to file \"%s\", file must not already exist in phar %s", oldfile, newfile, phar_obj->archive->fname);
RETURN_FALSE;
}
@@ -3424,15 +3424,15 @@ PHP_METHOD(Phar, copy)
tmp_len = (int)newfile_len;
if (phar_path_check(&newfile, &tmp_len, &pcr_error) > pcr_is_ok) {
- zend_throw_exception_ex(spl_ce_UnexpectedValueException, 0 TSRMLS_CC,
+ zend_throw_exception_ex(spl_ce_UnexpectedValueException, 0,
"file \"%s\" contains invalid characters %s, cannot be copied from \"%s\" in phar %s", newfile, pcr_error, oldfile, phar_obj->archive->fname);
RETURN_FALSE;
}
newfile_len = tmp_len;
if (phar_obj->archive->is_persistent) {
- if (FAILURE == phar_copy_on_write(&(phar_obj->archive) TSRMLS_CC)) {
- zend_throw_exception_ex(phar_ce_PharException, 0 TSRMLS_CC, "phar \"%s\" is persistent, unable to copy on write", phar_obj->archive->fname);
+ if (FAILURE == phar_copy_on_write(&(phar_obj->archive))) {
+ zend_throw_exception_ex(phar_ce_PharException, 0, "phar \"%s\" is persistent, unable to copy on write", phar_obj->archive->fname);
return;
}
/* re-populate with copied-on-write entry */
@@ -3451,10 +3451,10 @@ PHP_METHOD(Phar, copy)
newentry.fp_refcount = 0;
if (oldentry->fp_type != PHAR_FP) {
- if (FAILURE == phar_copy_entry_fp(oldentry, &newentry, &error TSRMLS_CC)) {
+ if (FAILURE == phar_copy_entry_fp(oldentry, &newentry, &error)) {
efree(newentry.filename);
php_stream_close(newentry.fp);
- zend_throw_exception_ex(phar_ce_PharException, 0 TSRMLS_CC, "%s", error);
+ zend_throw_exception_ex(phar_ce_PharException, 0, "%s", error);
efree(error);
return;
}
@@ -3462,10 +3462,10 @@ PHP_METHOD(Phar, copy)
zend_hash_str_add_mem(&oldentry->phar->manifest, newfile, newfile_len, &newentry, sizeof(phar_entry_info));
phar_obj->archive->is_modified = 1;
- phar_flush(phar_obj->archive, 0, 0, 0, &error TSRMLS_CC);
+ phar_flush(phar_obj->archive, 0, 0, 0, &error);
if (error) {
- zend_throw_exception_ex(phar_ce_PharException, 0 TSRMLS_CC, "%s", error);
+ zend_throw_exception_ex(phar_ce_PharException, 0, "%s", error);
efree(error);
}
@@ -3484,7 +3484,7 @@ PHP_METHOD(Phar, offsetExists)
PHAR_ARCHIVE_OBJECT();
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s", &fname, &fname_len) == FAILURE) {
+ if (zend_parse_parameters(ZEND_NUM_ARGS(), "s", &fname, &fname_len) == FAILURE) {
return;
}
@@ -3522,26 +3522,26 @@ PHP_METHOD(Phar, offsetGet)
zend_string *sfname;
PHAR_ARCHIVE_OBJECT();
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s", &fname, &fname_len) == FAILURE) {
+ if (zend_parse_parameters(ZEND_NUM_ARGS(), "s", &fname, &fname_len) == FAILURE) {
return;
}
/* security is 0 here so that we can get a better error message than "entry doesn't exist" */
- if (!(entry = phar_get_entry_info_dir(phar_obj->archive, fname, fname_len, 1, &error, 0 TSRMLS_CC))) {
- zend_throw_exception_ex(spl_ce_BadMethodCallException, 0 TSRMLS_CC, "Entry %s does not exist%s%s", fname, error?", ":"", error?error:"");
+ if (!(entry = phar_get_entry_info_dir(phar_obj->archive, fname, fname_len, 1, &error, 0))) {
+ zend_throw_exception_ex(spl_ce_BadMethodCallException, 0, "Entry %s does not exist%s%s", fname, error?", ":"", error?error:"");
} else {
if (fname_len == sizeof(".phar/stub.php")-1 && !memcmp(fname, ".phar/stub.php", sizeof(".phar/stub.php")-1)) {
- zend_throw_exception_ex(spl_ce_BadMethodCallException, 0 TSRMLS_CC, "Cannot get stub \".phar/stub.php\" directly in phar \"%s\", use getStub", phar_obj->archive->fname);
+ zend_throw_exception_ex(spl_ce_BadMethodCallException, 0, "Cannot get stub \".phar/stub.php\" directly in phar \"%s\", use getStub", phar_obj->archive->fname);
return;
}
if (fname_len == sizeof(".phar/alias.txt")-1 && !memcmp(fname, ".phar/alias.txt", sizeof(".phar/alias.txt")-1)) {
- zend_throw_exception_ex(spl_ce_BadMethodCallException, 0 TSRMLS_CC, "Cannot get alias \".phar/alias.txt\" directly in phar \"%s\", use getAlias", phar_obj->archive->fname);
+ zend_throw_exception_ex(spl_ce_BadMethodCallException, 0, "Cannot get alias \".phar/alias.txt\" directly in phar \"%s\", use getAlias", phar_obj->archive->fname);
return;
}
if (fname_len >= sizeof(".phar")-1 && !memcmp(fname, ".phar", sizeof(".phar")-1)) {
- zend_throw_exception_ex(spl_ce_BadMethodCallException, 0 TSRMLS_CC, "Cannot directly get any files or directories in magic \".phar\" directory", phar_obj->archive->fname);
+ zend_throw_exception_ex(spl_ce_BadMethodCallException, 0, "Cannot directly get any files or directories in magic \".phar\" directory", phar_obj->archive->fname);
return;
}
@@ -3552,7 +3552,7 @@ PHP_METHOD(Phar, offsetGet)
sfname = strpprintf(0, "phar://%s/%s", phar_obj->archive->fname, fname);
ZVAL_NEW_STR(&zfname, sfname);
- spl_instantiate_arg_ex1(phar_obj->spl.info_class, return_value, &zfname TSRMLS_CC);
+ spl_instantiate_arg_ex1(phar_obj->spl.info_class, return_value, &zfname);
zval_ptr_dtor(&zfname);
}
}
@@ -3560,7 +3560,7 @@ PHP_METHOD(Phar, offsetGet)
/* {{{ add a file within the phar archive from a string or resource
*/
-static void phar_add_file(phar_archive_data **pphar, char *filename, int filename_len, char *cont_str, size_t cont_len, zval *zresource TSRMLS_DC)
+static void phar_add_file(phar_archive_data **pphar, char *filename, int filename_len, char *cont_str, size_t cont_len, zval *zresource)
{
char *error;
size_t contents_len;
@@ -3568,16 +3568,16 @@ static void phar_add_file(phar_archive_data **pphar, char *filename, int filenam
php_stream *contents_file;
if (filename_len >= sizeof(".phar")-1 && !memcmp(filename, ".phar", sizeof(".phar")-1)) {
- zend_throw_exception_ex(spl_ce_BadMethodCallException, 0 TSRMLS_CC, "Cannot create any files in magic \".phar\" directory", (*pphar)->fname);
+ zend_throw_exception_ex(spl_ce_BadMethodCallException, 0, "Cannot create any files in magic \".phar\" directory", (*pphar)->fname);
return;
}
- if (!(data = phar_get_or_create_entry_data((*pphar)->fname, (*pphar)->fname_len, filename, filename_len, "w+b", 0, &error, 1 TSRMLS_CC))) {
+ if (!(data = phar_get_or_create_entry_data((*pphar)->fname, (*pphar)->fname_len, filename, filename_len, "w+b", 0, &error, 1))) {
if (error) {
- zend_throw_exception_ex(spl_ce_BadMethodCallException, 0 TSRMLS_CC, "Entry %s does not exist and cannot be created: %s", filename, error);
+ zend_throw_exception_ex(spl_ce_BadMethodCallException, 0, "Entry %s does not exist and cannot be created: %s", filename, error);
efree(error);
} else {
- zend_throw_exception_ex(spl_ce_BadMethodCallException, 0 TSRMLS_CC, "Entry %s does not exist and cannot be created", filename);
+ zend_throw_exception_ex(spl_ce_BadMethodCallException, 0, "Entry %s does not exist and cannot be created", filename);
}
return;
} else {
@@ -3589,12 +3589,12 @@ static void phar_add_file(phar_archive_data **pphar, char *filename, int filenam
if (cont_str) {
contents_len = php_stream_write(data->fp, cont_str, cont_len);
if (contents_len != cont_len) {
- zend_throw_exception_ex(spl_ce_BadMethodCallException, 0 TSRMLS_CC, "Entry %s could not be written to", filename);
+ zend_throw_exception_ex(spl_ce_BadMethodCallException, 0, "Entry %s could not be written to", filename);
return;
}
} else {
if (!(php_stream_from_zval_no_verify(contents_file, zresource))) {
- zend_throw_exception_ex(spl_ce_BadMethodCallException, 0 TSRMLS_CC, "Entry %s could not be written to", filename);
+ zend_throw_exception_ex(spl_ce_BadMethodCallException, 0, "Entry %s could not be written to", filename);
return;
}
php_stream_copy_to_stream_ex(contents_file, data->fp, PHP_STREAM_COPY_ALL, &contents_len);
@@ -3607,11 +3607,11 @@ static void phar_add_file(phar_archive_data **pphar, char *filename, int filenam
if (pphar[0] != data->phar) {
*pphar = data->phar;
}
- phar_entry_delref(data TSRMLS_CC);
- phar_flush(*pphar, 0, 0, 0, &error TSRMLS_CC);
+ phar_entry_delref(data);
+ phar_flush(*pphar, 0, 0, 0, &error);
if (error) {
- zend_throw_exception_ex(phar_ce_PharException, 0 TSRMLS_CC, "%s", error);
+ zend_throw_exception_ex(phar_ce_PharException, 0, "%s", error);
efree(error);
}
}
@@ -3620,17 +3620,17 @@ static void phar_add_file(phar_archive_data **pphar, char *filename, int filenam
/* {{{ create a directory within the phar archive
*/
-static void phar_mkdir(phar_archive_data **pphar, char *dirname, int dirname_len TSRMLS_DC)
+static void phar_mkdir(phar_archive_data **pphar, char *dirname, int dirname_len)
{
char *error;
phar_entry_data *data;
- if (!(data = phar_get_or_create_entry_data((*pphar)->fname, (*pphar)->fname_len, dirname, dirname_len, "w+b", 2, &error, 1 TSRMLS_CC))) {
+ if (!(data = phar_get_or_create_entry_data((*pphar)->fname, (*pphar)->fname_len, dirname, dirname_len, "w+b", 2, &error, 1))) {
if (error) {
- zend_throw_exception_ex(spl_ce_BadMethodCallException, 0 TSRMLS_CC, "Directory %s does not exist and cannot be created: %s", dirname, error);
+ zend_throw_exception_ex(spl_ce_BadMethodCallException, 0, "Directory %s does not exist and cannot be created: %s", dirname, error);
efree(error);
} else {
- zend_throw_exception_ex(spl_ce_BadMethodCallException, 0 TSRMLS_CC, "Directory %s does not exist and cannot be created", dirname);
+ zend_throw_exception_ex(spl_ce_BadMethodCallException, 0, "Directory %s does not exist and cannot be created", dirname);
}
return;
@@ -3643,11 +3643,11 @@ static void phar_mkdir(phar_archive_data **pphar, char *dirname, int dirname_len
if (data->phar != *pphar) {
*pphar = data->phar;
}
- phar_entry_delref(data TSRMLS_CC);
- phar_flush(*pphar, 0, 0, 0, &error TSRMLS_CC);
+ phar_entry_delref(data);
+ phar_flush(*pphar, 0, 0, 0, &error);
if (error) {
- zend_throw_exception_ex(phar_ce_PharException, 0 TSRMLS_CC, "%s", error);
+ zend_throw_exception_ex(phar_ce_PharException, 0, "%s", error);
efree(error);
}
}
@@ -3665,31 +3665,31 @@ PHP_METHOD(Phar, offsetSet)
PHAR_ARCHIVE_OBJECT();
if (PHAR_G(readonly) && !phar_obj->archive->is_data) {
- zend_throw_exception_ex(spl_ce_BadMethodCallException, 0 TSRMLS_CC, "Write operations disabled by the php.ini setting phar.readonly");
+ zend_throw_exception_ex(spl_ce_BadMethodCallException, 0, "Write operations disabled by the php.ini setting phar.readonly");
return;
}
- if (zend_parse_parameters_ex(ZEND_PARSE_PARAMS_QUIET, ZEND_NUM_ARGS() TSRMLS_CC, "sr", &fname, &fname_len, &zresource) == FAILURE
- && zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "ss", &fname, &fname_len, &cont_str, &cont_len) == FAILURE) {
+ if (zend_parse_parameters_ex(ZEND_PARSE_PARAMS_QUIET, ZEND_NUM_ARGS(), "sr", &fname, &fname_len, &zresource) == FAILURE
+ && zend_parse_parameters(ZEND_NUM_ARGS(), "ss", &fname, &fname_len, &cont_str, &cont_len) == FAILURE) {
return;
}
if (fname_len == sizeof(".phar/stub.php")-1 && !memcmp(fname, ".phar/stub.php", sizeof(".phar/stub.php")-1)) {
- zend_throw_exception_ex(spl_ce_BadMethodCallException, 0 TSRMLS_CC, "Cannot set stub \".phar/stub.php\" directly in phar \"%s\", use setStub", phar_obj->archive->fname);
+ zend_throw_exception_ex(spl_ce_BadMethodCallException, 0, "Cannot set stub \".phar/stub.php\" directly in phar \"%s\", use setStub", phar_obj->archive->fname);
return;
}
if (fname_len == sizeof(".phar/alias.txt")-1 && !memcmp(fname, ".phar/alias.txt", sizeof(".phar/alias.txt")-1)) {
- zend_throw_exception_ex(spl_ce_BadMethodCallException, 0 TSRMLS_CC, "Cannot set alias \".phar/alias.txt\" directly in phar \"%s\", use setAlias", phar_obj->archive->fname);
+ zend_throw_exception_ex(spl_ce_BadMethodCallException, 0, "Cannot set alias \".phar/alias.txt\" directly in phar \"%s\", use setAlias", phar_obj->archive->fname);
return;
}
if (fname_len >= sizeof(".phar")-1 && !memcmp(fname, ".phar", sizeof(".phar")-1)) {
- zend_throw_exception_ex(spl_ce_BadMethodCallException, 0 TSRMLS_CC, "Cannot set any files or directories in magic \".phar\" directory", phar_obj->archive->fname);
+ zend_throw_exception_ex(spl_ce_BadMethodCallException, 0, "Cannot set any files or directories in magic \".phar\" directory", phar_obj->archive->fname);
return;
}
- phar_add_file(&(phar_obj->archive), fname, fname_len, cont_str, cont_len, zresource TSRMLS_CC);
+ phar_add_file(&(phar_obj->archive), fname, fname_len, cont_str, cont_len, zresource);
}
/* }}} */
@@ -3704,11 +3704,11 @@ PHP_METHOD(Phar, offsetUnset)
PHAR_ARCHIVE_OBJECT();
if (PHAR_G(readonly) && !phar_obj->archive->is_data) {
- zend_throw_exception_ex(spl_ce_BadMethodCallException, 0 TSRMLS_CC, "Write operations disabled by the php.ini setting phar.readonly");
+ zend_throw_exception_ex(spl_ce_BadMethodCallException, 0, "Write operations disabled by the php.ini setting phar.readonly");
return;
}
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s", &fname, &fname_len) == FAILURE) {
+ if (zend_parse_parameters(ZEND_NUM_ARGS(), "s", &fname, &fname_len) == FAILURE) {
return;
}
@@ -3720,8 +3720,8 @@ PHP_METHOD(Phar, offsetUnset)
}
if (phar_obj->archive->is_persistent) {
- if (FAILURE == phar_copy_on_write(&(phar_obj->archive) TSRMLS_CC)) {
- zend_throw_exception_ex(phar_ce_PharException, 0 TSRMLS_CC, "phar \"%s\" is persistent, unable to copy on write", phar_obj->archive->fname);
+ if (FAILURE == phar_copy_on_write(&(phar_obj->archive))) {
+ zend_throw_exception_ex(phar_ce_PharException, 0, "phar \"%s\" is persistent, unable to copy on write", phar_obj->archive->fname);
return;
}
/* re-populate entry after copy on write */
@@ -3730,10 +3730,10 @@ PHP_METHOD(Phar, offsetUnset)
entry->is_modified = 0;
entry->is_deleted = 1;
/* we need to "flush" the stream to save the newly deleted file on disk */
- phar_flush(phar_obj->archive, 0, 0, 0, &error TSRMLS_CC);
+ phar_flush(phar_obj->archive, 0, 0, 0, &error);
if (error) {
- zend_throw_exception_ex(phar_ce_PharException, 0 TSRMLS_CC, "%s", error);
+ zend_throw_exception_ex(phar_ce_PharException, 0, "%s", error);
efree(error);
}
@@ -3755,16 +3755,16 @@ PHP_METHOD(Phar, addEmptyDir)
PHAR_ARCHIVE_OBJECT();
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s", &dirname, &dirname_len) == FAILURE) {
+ if (zend_parse_parameters(ZEND_NUM_ARGS(), "s", &dirname, &dirname_len) == FAILURE) {
return;
}
if (dirname_len >= sizeof(".phar")-1 && !memcmp(dirname, ".phar", sizeof(".phar")-1)) {
- zend_throw_exception_ex(spl_ce_BadMethodCallException, 0 TSRMLS_CC, "Cannot create a directory in magic \".phar\" directory");
+ zend_throw_exception_ex(spl_ce_BadMethodCallException, 0, "Cannot create a directory in magic \".phar\" directory");
return;
}
- phar_mkdir(&phar_obj->archive, dirname, dirname_len TSRMLS_CC);
+ phar_mkdir(&phar_obj->archive, dirname, dirname_len);
}
/* }}} */
@@ -3780,24 +3780,24 @@ PHP_METHOD(Phar, addFile)
PHAR_ARCHIVE_OBJECT();
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s|s", &fname, &fname_len, &localname, &localname_len) == FAILURE) {
+ if (zend_parse_parameters(ZEND_NUM_ARGS(), "s|s", &fname, &fname_len, &localname, &localname_len) == FAILURE) {
return;
}
#if PHP_API_VERSION < 20100412
if (PG(safe_mode) && (!php_checkuid(fname, NULL, CHECKUID_ALLOW_ONLY_FILE))) {
- zend_throw_exception_ex(spl_ce_RuntimeException, 0 TSRMLS_CC, "phar error: unable to open file \"%s\" to add to phar archive, safe_mode restrictions prevent this", fname);
+ zend_throw_exception_ex(spl_ce_RuntimeException, 0, "phar error: unable to open file \"%s\" to add to phar archive, safe_mode restrictions prevent this", fname);
return;
}
#endif
- if (!strstr(fname, "://") && php_check_open_basedir(fname TSRMLS_CC)) {
- zend_throw_exception_ex(spl_ce_RuntimeException, 0 TSRMLS_CC, "phar error: unable to open file \"%s\" to add to phar archive, open_basedir restrictions prevent this", fname);
+ if (!strstr(fname, "://") && php_check_open_basedir(fname)) {
+ zend_throw_exception_ex(spl_ce_RuntimeException, 0, "phar error: unable to open file \"%s\" to add to phar archive, open_basedir restrictions prevent this", fname);
return;
}
if (!(resource = php_stream_open_wrapper(fname, "rb", 0, NULL))) {
- zend_throw_exception_ex(spl_ce_RuntimeException, 0 TSRMLS_CC, "phar error: unable to open file \"%s\" to add to phar archive", fname);
+ zend_throw_exception_ex(spl_ce_RuntimeException, 0, "phar error: unable to open file \"%s\" to add to phar archive", fname);
return;
}
@@ -3807,7 +3807,7 @@ PHP_METHOD(Phar, addFile)
}
php_stream_to_zval(resource, &zresource);
- phar_add_file(&(phar_obj->archive), fname, fname_len, NULL, 0, &zresource TSRMLS_CC);
+ phar_add_file(&(phar_obj->archive), fname, fname_len, NULL, 0, &zresource);
zval_ptr_dtor(&zresource);
}
/* }}} */
@@ -3822,11 +3822,11 @@ PHP_METHOD(Phar, addFromString)
PHAR_ARCHIVE_OBJECT();
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "ss", &localname, &localname_len, &cont_str, &cont_len) == FAILURE) {
+ if (zend_parse_parameters(ZEND_NUM_ARGS(), "ss", &localname, &localname_len, &cont_str, &cont_len) == FAILURE) {
return;
}
- phar_add_file(&(phar_obj->archive), localname, localname_len, cont_str, cont_len, NULL TSRMLS_CC);
+ phar_add_file(&(phar_obj->archive), localname, localname_len, cont_str, cont_len, NULL);
}
/* }}} */
@@ -3854,19 +3854,19 @@ PHP_METHOD(Phar, getStub)
fp = phar_obj->archive->fp;
} else {
if (!(fp = php_stream_open_wrapper(phar_obj->archive->fname, "rb", 0, NULL))) {
- zend_throw_exception_ex(spl_ce_UnexpectedValueException, 0 TSRMLS_CC, "phar error: unable to open phar \"%s\"", phar_obj->archive->fname);
+ zend_throw_exception_ex(spl_ce_UnexpectedValueException, 0, "phar error: unable to open phar \"%s\"", phar_obj->archive->fname);
return;
}
if (stub->flags & PHAR_ENT_COMPRESSION_MASK) {
char *filter_name;
if ((filter_name = phar_decompress_filter(stub, 0)) != NULL) {
- filter = php_stream_filter_create(filter_name, NULL, php_stream_is_persistent(fp) TSRMLS_CC);
+ filter = php_stream_filter_create(filter_name, NULL, php_stream_is_persistent(fp));
} else {
filter = NULL;
}
if (!filter) {
- zend_throw_exception_ex(spl_ce_UnexpectedValueException, 0 TSRMLS_CC, "phar error: unable to read stub of phar \"%s\" (cannot create %s filter)", phar_obj->archive->fname, phar_decompress_filter(stub, 1));
+ zend_throw_exception_ex(spl_ce_UnexpectedValueException, 0, "phar error: unable to read stub of phar \"%s\" (cannot create %s filter)", phar_obj->archive->fname, phar_decompress_filter(stub, 1));
return;
}
php_stream_filter_append(&fp->readfilters, filter);
@@ -3874,7 +3874,7 @@ PHP_METHOD(Phar, getStub)
}
if (!fp) {
- zend_throw_exception_ex(spl_ce_RuntimeException, 0 TSRMLS_CC,
+ zend_throw_exception_ex(spl_ce_RuntimeException, 0,
"Unable to read stub");
return;
}
@@ -3895,7 +3895,7 @@ PHP_METHOD(Phar, getStub)
}
if (!fp) {
- zend_throw_exception_ex(spl_ce_RuntimeException, 0 TSRMLS_CC,
+ zend_throw_exception_ex(spl_ce_RuntimeException, 0,
"Unable to read stub");
return;
}
@@ -3908,7 +3908,7 @@ carry_on:
if (fp != phar_obj->archive->fp) {
php_stream_close(fp);
}
- zend_throw_exception_ex(spl_ce_RuntimeException, 0 TSRMLS_CC,
+ zend_throw_exception_ex(spl_ce_RuntimeException, 0,
"Unable to read stub");
zend_string_release(buf);
return;
@@ -3916,7 +3916,7 @@ carry_on:
if (filter) {
php_stream_filter_flush(filter, 1);
- php_stream_filter_remove(filter, 1 TSRMLS_CC);
+ php_stream_filter_remove(filter, 1);
}
if (fp != phar_obj->archive->fp) {
@@ -3956,7 +3956,7 @@ PHP_METHOD(Phar, getMetadata)
zval ret;
char *buf = estrndup((char *) Z_PTR(phar_obj->archive->metadata), phar_obj->archive->metadata_len);
/* assume success, we would have failed before */
- phar_parse_metadata(&buf, &ret, phar_obj->archive->metadata_len TSRMLS_CC);
+ phar_parse_metadata(&buf, &ret, phar_obj->archive->metadata_len);
efree(buf);
RETURN_ZVAL(&ret, 0, 1);
}
@@ -3976,16 +3976,16 @@ PHP_METHOD(Phar, setMetadata)
PHAR_ARCHIVE_OBJECT();
if (PHAR_G(readonly) && !phar_obj->archive->is_data) {
- zend_throw_exception_ex(spl_ce_BadMethodCallException, 0 TSRMLS_CC, "Write operations disabled by the php.ini setting phar.readonly");
+ zend_throw_exception_ex(spl_ce_BadMethodCallException, 0, "Write operations disabled by the php.ini setting phar.readonly");
return;
}
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "z", &metadata) == FAILURE) {
+ if (zend_parse_parameters(ZEND_NUM_ARGS(), "z", &metadata) == FAILURE) {
return;
}
- if (phar_obj->archive->is_persistent && FAILURE == phar_copy_on_write(&(phar_obj->archive) TSRMLS_CC)) {
- zend_throw_exception_ex(phar_ce_PharException, 0 TSRMLS_CC, "phar \"%s\" is persistent, unable to copy on write", phar_obj->archive->fname);
+ if (phar_obj->archive->is_persistent && FAILURE == phar_copy_on_write(&(phar_obj->archive))) {
+ zend_throw_exception_ex(phar_ce_PharException, 0, "phar \"%s\" is persistent, unable to copy on write", phar_obj->archive->fname);
return;
}
if (Z_TYPE(phar_obj->archive->metadata) != IS_UNDEF) {
@@ -3995,10 +3995,10 @@ PHP_METHOD(Phar, setMetadata)
ZVAL_ZVAL(&phar_obj->archive->metadata, metadata, 1, 0);
phar_obj->archive->is_modified = 1;
- phar_flush(phar_obj->archive, 0, 0, 0, &error TSRMLS_CC);
+ phar_flush(phar_obj->archive, 0, 0, 0, &error);
if (error) {
- zend_throw_exception_ex(phar_ce_PharException, 0 TSRMLS_CC, "%s", error);
+ zend_throw_exception_ex(phar_ce_PharException, 0, "%s", error);
efree(error);
}
}
@@ -4014,7 +4014,7 @@ PHP_METHOD(Phar, delMetadata)
PHAR_ARCHIVE_OBJECT();
if (PHAR_G(readonly) && !phar_obj->archive->is_data) {
- zend_throw_exception_ex(spl_ce_BadMethodCallException, 0 TSRMLS_CC, "Write operations disabled by the php.ini setting phar.readonly");
+ zend_throw_exception_ex(spl_ce_BadMethodCallException, 0, "Write operations disabled by the php.ini setting phar.readonly");
return;
}
@@ -4022,10 +4022,10 @@ PHP_METHOD(Phar, delMetadata)
zval_ptr_dtor(&phar_obj->archive->metadata);
ZVAL_UNDEF(&phar_obj->archive->metadata);
phar_obj->archive->is_modified = 1;
- phar_flush(phar_obj->archive, 0, 0, 0, &error TSRMLS_CC);
+ phar_flush(phar_obj->archive, 0, 0, 0, &error);
if (error) {
- zend_throw_exception_ex(phar_ce_PharException, 0 TSRMLS_CC, "%s", error);
+ zend_throw_exception_ex(phar_ce_PharException, 0, "%s", error);
efree(error);
RETURN_FALSE;
} else {
@@ -4039,13 +4039,13 @@ PHP_METHOD(Phar, delMetadata)
/* }}} */
#if PHP_API_VERSION < 20100412
#define PHAR_OPENBASEDIR_CHECKPATH(filename) \
- (PG(safe_mode) && (!php_checkuid(filename, NULL, CHECKUID_CHECK_FILE_AND_DIR))) || php_check_open_basedir(filename TSRMLS_CC)
+ (PG(safe_mode) && (!php_checkuid(filename, NULL, CHECKUID_CHECK_FILE_AND_DIR))) || php_check_open_basedir(filename)
#else
#define PHAR_OPENBASEDIR_CHECKPATH(filename) \
- php_check_open_basedir(filename TSRMLS_CC)
+ php_check_open_basedir(filename)
#endif
-static int phar_extract_file(zend_bool overwrite, phar_entry_info *entry, char *dest, int dest_len, char **error TSRMLS_DC) /* {{{ */
+static int phar_extract_file(zend_bool overwrite, phar_entry_info *entry, char *dest, int dest_len, char **error) /* {{{ */
{
php_stream_statbuf ssb;
int len;
@@ -4148,8 +4148,8 @@ static int phar_extract_file(zend_bool overwrite, phar_entry_info *entry, char *
return FAILURE;
}
- if (!phar_get_efp(entry, 0 TSRMLS_CC)) {
- if (FAILURE == phar_open_entry_fp(entry, error, 1 TSRMLS_CC)) {
+ if (!phar_get_efp(entry, 0)) {
+ if (FAILURE == phar_open_entry_fp(entry, error, 1)) {
if (error) {
spprintf(error, 4096, "Cannot extract \"%s\" to \"%s\", unable to open internal file pointer: %s", entry->filename, fullpath, *error);
} else {
@@ -4161,14 +4161,14 @@ static int phar_extract_file(zend_bool overwrite, phar_entry_info *entry, char *
}
}
- if (FAILURE == phar_seek_efp(entry, 0, SEEK_SET, 0, 0 TSRMLS_CC)) {
+ if (FAILURE == phar_seek_efp(entry, 0, SEEK_SET, 0, 0)) {
spprintf(error, 4096, "Cannot extract \"%s\" to \"%s\", unable to seek internal file pointer", entry->filename, fullpath);
efree(fullpath);
php_stream_close(fp);
return FAILURE;
}
- if (SUCCESS != php_stream_copy_to_stream_ex(phar_get_efp(entry, 0 TSRMLS_CC), fp, entry->uncompressed_filesize, NULL)) {
+ if (SUCCESS != php_stream_copy_to_stream_ex(phar_get_efp(entry, 0), fp, entry->uncompressed_filesize, NULL)) {
spprintf(error, 4096, "Cannot extract \"%s\" to \"%s\", copying contents failed", entry->filename, fullpath);
efree(fullpath);
php_stream_close(fp);
@@ -4207,14 +4207,14 @@ PHP_METHOD(Phar, extractTo)
PHAR_ARCHIVE_OBJECT();
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s|z!b", &pathto, &pathto_len, &zval_files, &overwrite) == FAILURE) {
+ if (zend_parse_parameters(ZEND_NUM_ARGS(), "s|z!b", &pathto, &pathto_len, &zval_files, &overwrite) == FAILURE) {
return;
}
fp = php_stream_open_wrapper(phar_obj->archive->fname, "rb", IGNORE_URL|STREAM_MUST_SEEK, &actual);
if (!fp) {
- zend_throw_exception_ex(spl_ce_InvalidArgumentException, 0 TSRMLS_CC,
+ zend_throw_exception_ex(spl_ce_InvalidArgumentException, 0,
"Invalid argument, %s cannot be found", phar_obj->archive->fname);
return;
}
@@ -4223,7 +4223,7 @@ PHP_METHOD(Phar, extractTo)
php_stream_close(fp);
if (pathto_len < 1) {
- zend_throw_exception_ex(spl_ce_InvalidArgumentException, 0 TSRMLS_CC,
+ zend_throw_exception_ex(spl_ce_InvalidArgumentException, 0,
"Invalid argument, extraction path must be non-zero length");
return;
}
@@ -4231,7 +4231,7 @@ PHP_METHOD(Phar, extractTo)
if (pathto_len >= MAXPATHLEN) {
char *tmp = estrndup(pathto, 50);
/* truncate for error message */
- zend_throw_exception_ex(spl_ce_InvalidArgumentException, 0 TSRMLS_CC, "Cannot extract to \"%s...\", destination directory is too long for filesystem", tmp);
+ zend_throw_exception_ex(spl_ce_InvalidArgumentException, 0, "Cannot extract to \"%s...\", destination directory is too long for filesystem", tmp);
efree(tmp);
return;
}
@@ -4239,12 +4239,12 @@ PHP_METHOD(Phar, extractTo)
if (php_stream_stat_path(pathto, &ssb) < 0) {
ret = php_stream_mkdir(pathto, 0777, PHP_STREAM_MKDIR_RECURSIVE, NULL);
if (!ret) {
- zend_throw_exception_ex(spl_ce_RuntimeException, 0 TSRMLS_CC,
+ zend_throw_exception_ex(spl_ce_RuntimeException, 0,
"Unable to create path \"%s\" for extraction", pathto);
return;
}
} else if (!(ssb.sb.st_mode & S_IFDIR)) {
- zend_throw_exception_ex(spl_ce_RuntimeException, 0 TSRMLS_CC,
+ zend_throw_exception_ex(spl_ce_RuntimeException, 0,
"Unable to use path \"%s\" for extraction, it is a file, must be a directory", pathto);
return;
}
@@ -4269,16 +4269,16 @@ PHP_METHOD(Phar, extractTo)
case IS_STRING:
break;
default:
- zend_throw_exception_ex(spl_ce_InvalidArgumentException, 0 TSRMLS_CC,
+ zend_throw_exception_ex(spl_ce_InvalidArgumentException, 0,
"Invalid argument, array of filenames to extract contains non-string value");
return;
}
if (NULL == (entry = zend_hash_find_ptr(&phar_obj->archive->manifest, Z_STR_P(zval_file)))) {
- zend_throw_exception_ex(phar_ce_PharException, 0 TSRMLS_CC,
+ zend_throw_exception_ex(phar_ce_PharException, 0,
"Phar Error: attempted to extract non-existent file \"%s\" from phar \"%s\"", Z_STRVAL_P(zval_file), phar_obj->archive->fname);
}
- if (FAILURE == phar_extract_file(overwrite, entry, pathto, pathto_len, &error TSRMLS_CC)) {
- zend_throw_exception_ex(phar_ce_PharException, 0 TSRMLS_CC,
+ if (FAILURE == phar_extract_file(overwrite, entry, pathto, pathto_len, &error)) {
+ zend_throw_exception_ex(phar_ce_PharException, 0,
"Extraction from phar \"%s\" failed: %s", phar_obj->archive->fname, error);
efree(error);
return;
@@ -4287,19 +4287,19 @@ PHP_METHOD(Phar, extractTo)
}
RETURN_TRUE;
default:
- zend_throw_exception_ex(spl_ce_InvalidArgumentException, 0 TSRMLS_CC,
+ zend_throw_exception_ex(spl_ce_InvalidArgumentException, 0,
"Invalid argument, expected a filename (string) or array of filenames");
return;
}
if (NULL == (entry = zend_hash_str_find_ptr(&phar_obj->archive->manifest, filename, filename_len))) {
- zend_throw_exception_ex(phar_ce_PharException, 0 TSRMLS_CC,
+ zend_throw_exception_ex(phar_ce_PharException, 0,
"Phar Error: attempted to extract non-existent file \"%s\" from phar \"%s\"", filename, phar_obj->archive->fname);
return;
}
- if (FAILURE == phar_extract_file(overwrite, entry, pathto, pathto_len, &error TSRMLS_CC)) {
- zend_throw_exception_ex(phar_ce_PharException, 0 TSRMLS_CC,
+ if (FAILURE == phar_extract_file(overwrite, entry, pathto, pathto_len, &error)) {
+ zend_throw_exception_ex(phar_ce_PharException, 0,
"Extraction from phar \"%s\" failed: %s", phar_obj->archive->fname, error);
efree(error);
return;
@@ -4314,8 +4314,8 @@ all_files:
}
ZEND_HASH_FOREACH_PTR(&phar->manifest, entry) {
- if (FAILURE == phar_extract_file(overwrite, entry, pathto, pathto_len, &error TSRMLS_CC)) {
- zend_throw_exception_ex(phar_ce_PharException, 0 TSRMLS_CC,
+ if (FAILURE == phar_extract_file(overwrite, entry, pathto, pathto_len, &error)) {
+ zend_throw_exception_ex(phar_ce_PharException, 0,
"Extraction from phar \"%s\" failed: %s", phar->fname, error);
efree(error);
return;
@@ -4340,39 +4340,39 @@ PHP_METHOD(PharFileInfo, __construct)
phar_archive_data *phar_data;
zval *zobj = getThis(), arg1;
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s", &fname, &fname_len) == FAILURE) {
+ if (zend_parse_parameters(ZEND_NUM_ARGS(), "s", &fname, &fname_len) == FAILURE) {
return;
}
entry_obj = (phar_entry_object*)((char*)Z_OBJ_P(zobj) - Z_OBJ_P(zobj)->handlers->offset);
if (entry_obj->entry) {
- zend_throw_exception_ex(spl_ce_BadMethodCallException, 0 TSRMLS_CC, "Cannot call constructor twice");
+ zend_throw_exception_ex(spl_ce_BadMethodCallException, 0, "Cannot call constructor twice");
return;
}
- if (fname_len < 7 || memcmp(fname, "phar://", 7) || phar_split_fname(fname, (int)fname_len, &arch, &arch_len, &entry, &entry_len, 2, 0 TSRMLS_CC) == FAILURE) {
- zend_throw_exception_ex(spl_ce_RuntimeException, 0 TSRMLS_CC,
+ if (fname_len < 7 || memcmp(fname, "phar://", 7) || phar_split_fname(fname, (int)fname_len, &arch, &arch_len, &entry, &entry_len, 2, 0) == FAILURE) {
+ zend_throw_exception_ex(spl_ce_RuntimeException, 0,
"'%s' is not a valid phar archive URL (must have at least phar://filename.phar)", fname);
return;
}
- if (phar_open_from_filename(arch, arch_len, NULL, 0, REPORT_ERRORS, &phar_data, &error TSRMLS_CC) == FAILURE) {
+ if (phar_open_from_filename(arch, arch_len, NULL, 0, REPORT_ERRORS, &phar_data, &error) == FAILURE) {
efree(arch);
efree(entry);
if (error) {
- zend_throw_exception_ex(spl_ce_RuntimeException, 0 TSRMLS_CC,
+ zend_throw_exception_ex(spl_ce_RuntimeException, 0,
"Cannot open phar file '%s': %s", fname, error);
efree(error);
} else {
- zend_throw_exception_ex(spl_ce_RuntimeException, 0 TSRMLS_CC,
+ zend_throw_exception_ex(spl_ce_RuntimeException, 0,
"Cannot open phar file '%s'", fname);
}
return;
}
- if ((entry_info = phar_get_entry_info_dir(phar_data, entry, entry_len, 1, &error, 1 TSRMLS_CC)) == NULL) {
- zend_throw_exception_ex(spl_ce_RuntimeException, 0 TSRMLS_CC,
+ if ((entry_info = phar_get_entry_info_dir(phar_data, entry, entry_len, 1, &error, 1)) == NULL) {
+ zend_throw_exception_ex(spl_ce_RuntimeException, 0,
"Cannot access phar file entry '%s' in archive '%s'%s%s", entry, arch, error ? ", " : "", error ? error : "");
efree(arch);
efree(entry);
@@ -4397,7 +4397,7 @@ PHP_METHOD(PharFileInfo, __construct)
zval *zobj = getThis(); \
phar_entry_object *entry_obj = (phar_entry_object*)((char*)Z_OBJ_P(zobj) - Z_OBJ_P(zobj)->handlers->offset); \
if (!entry_obj->entry) { \
- zend_throw_exception_ex(spl_ce_BadMethodCallException, 0 TSRMLS_CC, \
+ zend_throw_exception_ex(spl_ce_BadMethodCallException, 0, \
"Cannot call method on an uninitialized PharFileInfo object"); \
return; \
}
@@ -4446,7 +4446,7 @@ PHP_METHOD(PharFileInfo, isCompressed)
zend_long method = 9021976;
PHAR_ENTRY_OBJECT();
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "|l", &method) == FAILURE) {
+ if (zend_parse_parameters(ZEND_NUM_ARGS(), "|l", &method) == FAILURE) {
return;
}
@@ -4458,7 +4458,7 @@ PHP_METHOD(PharFileInfo, isCompressed)
case PHAR_ENT_COMPRESSED_BZ2:
RETURN_BOOL(entry_obj->entry->flags & PHAR_ENT_COMPRESSED_BZ2);
default:
- zend_throw_exception_ex(spl_ce_BadMethodCallException, 0 TSRMLS_CC, \
+ zend_throw_exception_ex(spl_ce_BadMethodCallException, 0, \
"Unknown compression type specified"); \
}
}
@@ -4476,7 +4476,7 @@ PHP_METHOD(PharFileInfo, getCRC32)
}
if (entry_obj->entry->is_dir) {
- zend_throw_exception_ex(spl_ce_BadMethodCallException, 0 TSRMLS_CC, \
+ zend_throw_exception_ex(spl_ce_BadMethodCallException, 0, \
"Phar entry is a directory, does not have a CRC"); \
return;
}
@@ -4484,7 +4484,7 @@ PHP_METHOD(PharFileInfo, getCRC32)
if (entry_obj->entry->is_crc_checked) {
RETURN_LONG(entry_obj->entry->crc32);
} else {
- zend_throw_exception_ex(spl_ce_BadMethodCallException, 0 TSRMLS_CC, \
+ zend_throw_exception_ex(spl_ce_BadMethodCallException, 0, \
"Phar entry was not CRC checked"); \
}
}
@@ -4530,25 +4530,25 @@ PHP_METHOD(PharFileInfo, chmod)
PHAR_ENTRY_OBJECT();
if (entry_obj->entry->is_temp_dir) {
- zend_throw_exception_ex(spl_ce_BadMethodCallException, 0 TSRMLS_CC, \
+ zend_throw_exception_ex(spl_ce_BadMethodCallException, 0, \
"Phar entry \"%s\" is a temporary directory (not an actual entry in the archive), cannot chmod", entry_obj->entry->filename); \
return;
}
if (PHAR_G(readonly) && !entry_obj->entry->phar->is_data) {
- zend_throw_exception_ex(phar_ce_PharException, 0 TSRMLS_CC, "Cannot modify permissions for file \"%s\" in phar \"%s\", write operations are prohibited", entry_obj->entry->filename, entry_obj->entry->phar->fname);
+ zend_throw_exception_ex(phar_ce_PharException, 0, "Cannot modify permissions for file \"%s\" in phar \"%s\", write operations are prohibited", entry_obj->entry->filename, entry_obj->entry->phar->fname);
return;
}
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "l", &perms) == FAILURE) {
+ if (zend_parse_parameters(ZEND_NUM_ARGS(), "l", &perms) == FAILURE) {
return;
}
if (entry_obj->entry->is_persistent) {
phar_archive_data *phar = entry_obj->entry->phar;
- if (FAILURE == phar_copy_on_write(&phar TSRMLS_CC)) {
- zend_throw_exception_ex(phar_ce_PharException, 0 TSRMLS_CC, "phar \"%s\" is persistent, unable to copy on write", phar->fname);
+ if (FAILURE == phar_copy_on_write(&phar)) {
+ zend_throw_exception_ex(phar_ce_PharException, 0, "phar \"%s\" is persistent, unable to copy on write", phar->fname);
return;
}
/* re-populate after copy-on-write */
@@ -4574,10 +4574,10 @@ PHP_METHOD(PharFileInfo, chmod)
BG(CurrentLStatFile) = NULL;
BG(CurrentStatFile) = NULL;
- phar_flush(entry_obj->entry->phar, 0, 0, 0, &error TSRMLS_CC);
+ phar_flush(entry_obj->entry->phar, 0, 0, 0, &error);
if (error) {
- zend_throw_exception_ex(phar_ce_PharException, 0 TSRMLS_CC, "%s", error);
+ zend_throw_exception_ex(phar_ce_PharException, 0, "%s", error);
efree(error);
}
}
@@ -4614,7 +4614,7 @@ PHP_METHOD(PharFileInfo, getMetadata)
zval ret;
char *buf = estrndup((char *) Z_PTR(entry_obj->entry->metadata), entry_obj->entry->metadata_len);
/* assume success, we would have failed before */
- phar_parse_metadata(&buf, &ret, entry_obj->entry->metadata_len TSRMLS_CC);
+ phar_parse_metadata(&buf, &ret, entry_obj->entry->metadata_len);
efree(buf);
RETURN_ZVAL(&ret, 0, 1);
}
@@ -4634,25 +4634,25 @@ PHP_METHOD(PharFileInfo, setMetadata)
PHAR_ENTRY_OBJECT();
if (PHAR_G(readonly) && !entry_obj->entry->phar->is_data) {
- zend_throw_exception_ex(spl_ce_BadMethodCallException, 0 TSRMLS_CC, "Write operations disabled by the php.ini setting phar.readonly");
+ zend_throw_exception_ex(spl_ce_BadMethodCallException, 0, "Write operations disabled by the php.ini setting phar.readonly");
return;
}
if (entry_obj->entry->is_temp_dir) {
- zend_throw_exception_ex(spl_ce_BadMethodCallException, 0 TSRMLS_CC, \
+ zend_throw_exception_ex(spl_ce_BadMethodCallException, 0, \
"Phar entry is a temporary directory (not an actual entry in the archive), cannot set metadata"); \
return;
}
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "z", &metadata) == FAILURE) {
+ if (zend_parse_parameters(ZEND_NUM_ARGS(), "z", &metadata) == FAILURE) {
return;
}
if (entry_obj->entry->is_persistent) {
phar_archive_data *phar = entry_obj->entry->phar;
- if (FAILURE == phar_copy_on_write(&phar TSRMLS_CC)) {
- zend_throw_exception_ex(phar_ce_PharException, 0 TSRMLS_CC, "phar \"%s\" is persistent, unable to copy on write", phar->fname);
+ if (FAILURE == phar_copy_on_write(&phar)) {
+ zend_throw_exception_ex(phar_ce_PharException, 0, "phar \"%s\" is persistent, unable to copy on write", phar->fname);
return;
}
/* re-populate after copy-on-write */
@@ -4667,10 +4667,10 @@ PHP_METHOD(PharFileInfo, setMetadata)
entry_obj->entry->is_modified = 1;
entry_obj->entry->phar->is_modified = 1;
- phar_flush(entry_obj->entry->phar, 0, 0, 0, &error TSRMLS_CC);
+ phar_flush(entry_obj->entry->phar, 0, 0, 0, &error);
if (error) {
- zend_throw_exception_ex(phar_ce_PharException, 0 TSRMLS_CC, "%s", error);
+ zend_throw_exception_ex(phar_ce_PharException, 0, "%s", error);
efree(error);
}
}
@@ -4690,12 +4690,12 @@ PHP_METHOD(PharFileInfo, delMetadata)
}
if (PHAR_G(readonly) && !entry_obj->entry->phar->is_data) {
- zend_throw_exception_ex(spl_ce_BadMethodCallException, 0 TSRMLS_CC, "Write operations disabled by the php.ini setting phar.readonly");
+ zend_throw_exception_ex(spl_ce_BadMethodCallException, 0, "Write operations disabled by the php.ini setting phar.readonly");
return;
}
if (entry_obj->entry->is_temp_dir) {
- zend_throw_exception_ex(spl_ce_BadMethodCallException, 0 TSRMLS_CC, \
+ zend_throw_exception_ex(spl_ce_BadMethodCallException, 0, \
"Phar entry is a temporary directory (not an actual entry in the archive), cannot delete metadata"); \
return;
}
@@ -4704,8 +4704,8 @@ PHP_METHOD(PharFileInfo, delMetadata)
if (entry_obj->entry->is_persistent) {
phar_archive_data *phar = entry_obj->entry->phar;
- if (FAILURE == phar_copy_on_write(&phar TSRMLS_CC)) {
- zend_throw_exception_ex(phar_ce_PharException, 0 TSRMLS_CC, "phar \"%s\" is persistent, unable to copy on write", phar->fname);
+ if (FAILURE == phar_copy_on_write(&phar)) {
+ zend_throw_exception_ex(phar_ce_PharException, 0, "phar \"%s\" is persistent, unable to copy on write", phar->fname);
return;
}
/* re-populate after copy-on-write */
@@ -4716,10 +4716,10 @@ PHP_METHOD(PharFileInfo, delMetadata)
entry_obj->entry->is_modified = 1;
entry_obj->entry->phar->is_modified = 1;
- phar_flush(entry_obj->entry->phar, 0, 0, 0, &error TSRMLS_CC);
+ phar_flush(entry_obj->entry->phar, 0, 0, 0, &error);
if (error) {
- zend_throw_exception_ex(phar_ce_PharException, 0 TSRMLS_CC, "%s", error);
+ zend_throw_exception_ex(phar_ce_PharException, 0, "%s", error);
efree(error);
RETURN_FALSE;
} else {
@@ -4749,31 +4749,31 @@ PHP_METHOD(PharFileInfo, getContent)
}
if (entry_obj->entry->is_dir) {
- zend_throw_exception_ex(spl_ce_BadMethodCallException, 0 TSRMLS_CC,
+ zend_throw_exception_ex(spl_ce_BadMethodCallException, 0,
"Phar error: Cannot retrieve contents, \"%s\" in phar \"%s\" is a directory", entry_obj->entry->filename, entry_obj->entry->phar->fname);
return;
}
- link = phar_get_link_source(entry_obj->entry TSRMLS_CC);
+ link = phar_get_link_source(entry_obj->entry);
if (!link) {
link = entry_obj->entry;
}
- if (SUCCESS != phar_open_entry_fp(link, &error, 0 TSRMLS_CC)) {
- zend_throw_exception_ex(spl_ce_BadMethodCallException, 0 TSRMLS_CC,
+ if (SUCCESS != phar_open_entry_fp(link, &error, 0)) {
+ zend_throw_exception_ex(spl_ce_BadMethodCallException, 0,
"Phar error: Cannot retrieve contents, \"%s\" in phar \"%s\": %s", entry_obj->entry->filename, entry_obj->entry->phar->fname, error);
efree(error);
return;
}
- if (!(fp = phar_get_efp(link, 0 TSRMLS_CC))) {
- zend_throw_exception_ex(spl_ce_BadMethodCallException, 0 TSRMLS_CC,
+ if (!(fp = phar_get_efp(link, 0))) {
+ zend_throw_exception_ex(spl_ce_BadMethodCallException, 0,
"Phar error: Cannot retrieve contents of \"%s\" in phar \"%s\"", entry_obj->entry->filename, entry_obj->entry->phar->fname);
return;
}
- phar_seek_efp(link, 0, SEEK_SET, 0, 0 TSRMLS_CC);
+ phar_seek_efp(link, 0, SEEK_SET, 0, 0);
str = php_stream_copy_to_mem(fp, link->uncompressed_filesize, 0);
if (str) {
RETURN_STR(str);
@@ -4792,30 +4792,30 @@ PHP_METHOD(PharFileInfo, compress)
char *error;
PHAR_ENTRY_OBJECT();
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "l", &method) == FAILURE) {
+ if (zend_parse_parameters(ZEND_NUM_ARGS(), "l", &method) == FAILURE) {
return;
}
if (entry_obj->entry->is_tar) {
- zend_throw_exception_ex(spl_ce_BadMethodCallException, 0 TSRMLS_CC,
+ zend_throw_exception_ex(spl_ce_BadMethodCallException, 0,
"Cannot compress with Gzip compression, not possible with tar-based phar archives");
return;
}
if (entry_obj->entry->is_dir) {
- zend_throw_exception_ex(spl_ce_BadMethodCallException, 0 TSRMLS_CC, \
+ zend_throw_exception_ex(spl_ce_BadMethodCallException, 0, \
"Phar entry is a directory, cannot set compression"); \
return;
}
if (PHAR_G(readonly) && !entry_obj->entry->phar->is_data) {
- zend_throw_exception_ex(spl_ce_BadMethodCallException, 0 TSRMLS_CC,
+ zend_throw_exception_ex(spl_ce_BadMethodCallException, 0,
"Phar is readonly, cannot change compression");
return;
}
if (entry_obj->entry->is_deleted) {
- zend_throw_exception_ex(spl_ce_BadMethodCallException, 0 TSRMLS_CC,
+ zend_throw_exception_ex(spl_ce_BadMethodCallException, 0,
"Cannot compress deleted file");
return;
}
@@ -4823,8 +4823,8 @@ PHP_METHOD(PharFileInfo, compress)
if (entry_obj->entry->is_persistent) {
phar_archive_data *phar = entry_obj->entry->phar;
- if (FAILURE == phar_copy_on_write(&phar TSRMLS_CC)) {
- zend_throw_exception_ex(phar_ce_PharException, 0 TSRMLS_CC, "phar \"%s\" is persistent, unable to copy on write", phar->fname);
+ if (FAILURE == phar_copy_on_write(&phar)) {
+ zend_throw_exception_ex(phar_ce_PharException, 0, "phar \"%s\" is persistent, unable to copy on write", phar->fname);
return;
}
/* re-populate after copy-on-write */
@@ -4838,14 +4838,14 @@ PHP_METHOD(PharFileInfo, compress)
if ((entry_obj->entry->flags & PHAR_ENT_COMPRESSED_BZ2) != 0) {
if (!PHAR_G(has_bz2)) {
- zend_throw_exception_ex(spl_ce_BadMethodCallException, 0 TSRMLS_CC,
+ zend_throw_exception_ex(spl_ce_BadMethodCallException, 0,
"Cannot compress with gzip compression, file is already compressed with bzip2 compression and bz2 extension is not enabled, cannot decompress");
return;
}
/* decompress this file indirectly */
- if (SUCCESS != phar_open_entry_fp(entry_obj->entry, &error, 1 TSRMLS_CC)) {
- zend_throw_exception_ex(spl_ce_BadMethodCallException, 0 TSRMLS_CC,
+ if (SUCCESS != phar_open_entry_fp(entry_obj->entry, &error, 1)) {
+ zend_throw_exception_ex(spl_ce_BadMethodCallException, 0,
"Phar error: Cannot decompress bzip2-compressed file \"%s\" in phar \"%s\" in order to compress with gzip: %s", entry_obj->entry->filename, entry_obj->entry->phar->fname, error);
efree(error);
return;
@@ -4853,7 +4853,7 @@ PHP_METHOD(PharFileInfo, compress)
}
if (!PHAR_G(has_zlib)) {
- zend_throw_exception_ex(spl_ce_BadMethodCallException, 0 TSRMLS_CC,
+ zend_throw_exception_ex(spl_ce_BadMethodCallException, 0,
"Cannot compress with gzip compression, zlib extension is not enabled");
return;
}
@@ -4869,14 +4869,14 @@ PHP_METHOD(PharFileInfo, compress)
if ((entry_obj->entry->flags & PHAR_ENT_COMPRESSED_GZ) != 0) {
if (!PHAR_G(has_zlib)) {
- zend_throw_exception_ex(spl_ce_BadMethodCallException, 0 TSRMLS_CC,
+ zend_throw_exception_ex(spl_ce_BadMethodCallException, 0,
"Cannot compress with bzip2 compression, file is already compressed with gzip compression and zlib extension is not enabled, cannot decompress");
return;
}
/* decompress this file indirectly */
- if (SUCCESS != phar_open_entry_fp(entry_obj->entry, &error, 1 TSRMLS_CC)) {
- zend_throw_exception_ex(spl_ce_BadMethodCallException, 0 TSRMLS_CC,
+ if (SUCCESS != phar_open_entry_fp(entry_obj->entry, &error, 1)) {
+ zend_throw_exception_ex(spl_ce_BadMethodCallException, 0,
"Phar error: Cannot decompress gzip-compressed file \"%s\" in phar \"%s\" in order to compress with bzip2: %s", entry_obj->entry->filename, entry_obj->entry->phar->fname, error);
efree(error);
return;
@@ -4884,7 +4884,7 @@ PHP_METHOD(PharFileInfo, compress)
}
if (!PHAR_G(has_bz2)) {
- zend_throw_exception_ex(spl_ce_BadMethodCallException, 0 TSRMLS_CC,
+ zend_throw_exception_ex(spl_ce_BadMethodCallException, 0,
"Cannot compress with bzip2 compression, bz2 extension is not enabled");
return;
}
@@ -4893,16 +4893,16 @@ PHP_METHOD(PharFileInfo, compress)
entry_obj->entry->flags |= PHAR_ENT_COMPRESSED_BZ2;
break;
default:
- zend_throw_exception_ex(spl_ce_BadMethodCallException, 0 TSRMLS_CC, \
+ zend_throw_exception_ex(spl_ce_BadMethodCallException, 0, \
"Unknown compression type specified"); \
}
entry_obj->entry->phar->is_modified = 1;
entry_obj->entry->is_modified = 1;
- phar_flush(entry_obj->entry->phar, 0, 0, 0, &error TSRMLS_CC);
+ phar_flush(entry_obj->entry->phar, 0, 0, 0, &error);
if (error) {
- zend_throw_exception_ex(phar_ce_PharException, 0 TSRMLS_CC, "%s", error);
+ zend_throw_exception_ex(phar_ce_PharException, 0, "%s", error);
efree(error);
}
@@ -4923,7 +4923,7 @@ PHP_METHOD(PharFileInfo, decompress)
}
if (entry_obj->entry->is_dir) {
- zend_throw_exception_ex(spl_ce_BadMethodCallException, 0 TSRMLS_CC, \
+ zend_throw_exception_ex(spl_ce_BadMethodCallException, 0, \
"Phar entry is a directory, cannot set compression"); \
return;
}
@@ -4933,25 +4933,25 @@ PHP_METHOD(PharFileInfo, decompress)
}
if (PHAR_G(readonly) && !entry_obj->entry->phar->is_data) {
- zend_throw_exception_ex(spl_ce_BadMethodCallException, 0 TSRMLS_CC,
+ zend_throw_exception_ex(spl_ce_BadMethodCallException, 0,
"Phar is readonly, cannot decompress");
return;
}
if (entry_obj->entry->is_deleted) {
- zend_throw_exception_ex(spl_ce_BadMethodCallException, 0 TSRMLS_CC,
+ zend_throw_exception_ex(spl_ce_BadMethodCallException, 0,
"Cannot compress deleted file");
return;
}
if ((entry_obj->entry->flags & PHAR_ENT_COMPRESSED_GZ) != 0 && !PHAR_G(has_zlib)) {
- zend_throw_exception_ex(spl_ce_BadMethodCallException, 0 TSRMLS_CC,
+ zend_throw_exception_ex(spl_ce_BadMethodCallException, 0,
"Cannot decompress Gzip-compressed file, zlib extension is not enabled");
return;
}
if ((entry_obj->entry->flags & PHAR_ENT_COMPRESSED_BZ2) != 0 && !PHAR_G(has_bz2)) {
- zend_throw_exception_ex(spl_ce_BadMethodCallException, 0 TSRMLS_CC,
+ zend_throw_exception_ex(spl_ce_BadMethodCallException, 0,
"Cannot decompress Bzip2-compressed file, bz2 extension is not enabled");
return;
}
@@ -4959,16 +4959,16 @@ PHP_METHOD(PharFileInfo, decompress)
if (entry_obj->entry->is_persistent) {
phar_archive_data *phar = entry_obj->entry->phar;
- if (FAILURE == phar_copy_on_write(&phar TSRMLS_CC)) {
- zend_throw_exception_ex(phar_ce_PharException, 0 TSRMLS_CC, "phar \"%s\" is persistent, unable to copy on write", phar->fname);
+ if (FAILURE == phar_copy_on_write(&phar)) {
+ zend_throw_exception_ex(phar_ce_PharException, 0, "phar \"%s\" is persistent, unable to copy on write", phar->fname);
return;
}
/* re-populate after copy-on-write */
entry_obj->entry = zend_hash_str_find_ptr(&phar->manifest, entry_obj->entry->filename, entry_obj->entry->filename_len);
}
if (!entry_obj->entry->fp) {
- if (FAILURE == phar_open_archive_fp(entry_obj->entry->phar TSRMLS_CC)) {
- zend_throw_exception_ex(spl_ce_BadMethodCallException, 0 TSRMLS_CC, "Cannot decompress entry \"%s\", phar error: Cannot open phar archive \"%s\" for reading", entry_obj->entry->filename, entry_obj->entry->phar->fname);
+ if (FAILURE == phar_open_archive_fp(entry_obj->entry->phar)) {
+ zend_throw_exception_ex(spl_ce_BadMethodCallException, 0, "Cannot decompress entry \"%s\", phar error: Cannot open phar archive \"%s\" for reading", entry_obj->entry->filename, entry_obj->entry->phar->fname);
return;
}
entry_obj->entry->fp_type = PHAR_FP;
@@ -4978,10 +4978,10 @@ PHP_METHOD(PharFileInfo, decompress)
entry_obj->entry->flags &= ~PHAR_ENT_COMPRESSION_MASK;
entry_obj->entry->phar->is_modified = 1;
entry_obj->entry->is_modified = 1;
- phar_flush(entry_obj->entry->phar, 0, 0, 0, &error TSRMLS_CC);
+ phar_flush(entry_obj->entry->phar, 0, 0, 0, &error);
if (error) {
- zend_throw_exception_ex(phar_ce_PharException, 0 TSRMLS_CC, "%s", error);
+ zend_throw_exception_ex(phar_ce_PharException, 0, "%s", error);
efree(error);
}
RETURN_TRUE;
@@ -5281,37 +5281,37 @@ zend_function_entry phar_exception_methods[] = {
/* }}} */
#define REGISTER_PHAR_CLASS_CONST_LONG(class_name, const_name, value) \
- zend_declare_class_constant_long(class_name, const_name, sizeof(const_name)-1, (zend_long)value TSRMLS_CC);
+ zend_declare_class_constant_long(class_name, const_name, sizeof(const_name)-1, (zend_long)value);
-#define phar_exception_get_default() zend_exception_get_default(TSRMLS_C)
+#define phar_exception_get_default() zend_exception_get_default()
-void phar_object_init(TSRMLS_D) /* {{{ */
+void phar_object_init(void) /* {{{ */
{
zend_class_entry ce;
INIT_CLASS_ENTRY(ce, "PharException", phar_exception_methods);
- phar_ce_PharException = zend_register_internal_class_ex(&ce, phar_exception_get_default() TSRMLS_CC);
+ phar_ce_PharException = zend_register_internal_class_ex(&ce, phar_exception_get_default());
#if HAVE_SPL
INIT_CLASS_ENTRY(ce, "Phar", php_archive_methods);
- phar_ce_archive = zend_register_internal_class_ex(&ce, spl_ce_RecursiveDirectoryIterator TSRMLS_CC);
+ phar_ce_archive = zend_register_internal_class_ex(&ce, spl_ce_RecursiveDirectoryIterator);
- zend_class_implements(phar_ce_archive TSRMLS_CC, 2, spl_ce_Countable, zend_ce_arrayaccess);
+ zend_class_implements(phar_ce_archive, 2, spl_ce_Countable, zend_ce_arrayaccess);
INIT_CLASS_ENTRY(ce, "PharData", php_archive_methods);
- phar_ce_data = zend_register_internal_class_ex(&ce, spl_ce_RecursiveDirectoryIterator TSRMLS_CC);
+ phar_ce_data = zend_register_internal_class_ex(&ce, spl_ce_RecursiveDirectoryIterator);
- zend_class_implements(phar_ce_data TSRMLS_CC, 2, spl_ce_Countable, zend_ce_arrayaccess);
+ zend_class_implements(phar_ce_data, 2, spl_ce_Countable, zend_ce_arrayaccess);
INIT_CLASS_ENTRY(ce, "PharFileInfo", php_entry_methods);
- phar_ce_entry = zend_register_internal_class_ex(&ce, spl_ce_SplFileInfo TSRMLS_CC);
+ phar_ce_entry = zend_register_internal_class_ex(&ce, spl_ce_SplFileInfo);
#else
INIT_CLASS_ENTRY(ce, "Phar", php_archive_methods);
- phar_ce_archive = zend_register_internal_class(&ce TSRMLS_CC);
+ phar_ce_archive = zend_register_internal_class(&ce);
phar_ce_archive->ce_flags |= ZEND_ACC_FINAL;
INIT_CLASS_ENTRY(ce, "PharData", php_archive_methods);
- phar_ce_data = zend_register_internal_class(&ce TSRMLS_CC);
+ phar_ce_data = zend_register_internal_class(&ce);
phar_ce_data->ce_flags |= ZEND_ACC_FINAL;
#endif
diff --git a/ext/phar/php_phar.h b/ext/phar/php_phar.h
index 41c379bfa9..cb1a08d83b 100644
--- a/ext/phar/php_phar.h
+++ b/ext/phar/php_phar.h
@@ -34,7 +34,7 @@ extern zend_module_entry phar_module_entry;
#define PHP_PHAR_API PHPAPI
#endif
-PHP_PHAR_API int phar_resolve_alias(char *alias, int alias_len, char **filename, int *filename_len TSRMLS_DC);
+PHP_PHAR_API int phar_resolve_alias(char *alias, int alias_len, char **filename, int *filename_len);
#endif /* PHP_PHAR_H */
diff --git a/ext/phar/stream.c b/ext/phar/stream.c
index eb2fa607ee..5fb72522ad 100644
--- a/ext/phar/stream.c
+++ b/ext/phar/stream.c
@@ -56,7 +56,7 @@ php_stream_wrapper php_stream_phar_wrapper = {
/**
* Open a phar file for streams API
*/
-php_url* phar_parse_url(php_stream_wrapper *wrapper, const char *filename, const char *mode, int options TSRMLS_DC) /* {{{ */
+php_url* phar_parse_url(php_stream_wrapper *wrapper, const char *filename, const char *mode, int options) /* {{{ */
{
php_url *resource;
char *arch = NULL, *entry = NULL, *error;
@@ -67,17 +67,17 @@ php_url* phar_parse_url(php_stream_wrapper *wrapper, const char *filename, const
}
if (mode[0] == 'a') {
if (!(options & PHP_STREAM_URL_STAT_QUIET)) {
- php_stream_wrapper_log_error(wrapper, options TSRMLS_CC, "phar error: open mode append not supported");
+ php_stream_wrapper_log_error(wrapper, options, "phar error: open mode append not supported");
}
return NULL;
}
- if (phar_split_fname(filename, strlen(filename), &arch, &arch_len, &entry, &entry_len, 2, (mode[0] == 'w' ? 2 : 0) TSRMLS_CC) == FAILURE) {
+ if (phar_split_fname(filename, strlen(filename), &arch, &arch_len, &entry, &entry_len, 2, (mode[0] == 'w' ? 2 : 0)) == FAILURE) {
if (!(options & PHP_STREAM_URL_STAT_QUIET)) {
if (arch && !entry) {
- php_stream_wrapper_log_error(wrapper, options TSRMLS_CC, "phar error: no directory in \"%s\", must have at least phar://%s/ for root directory (always use full path to a new phar)", filename, arch);
+ php_stream_wrapper_log_error(wrapper, options, "phar error: no directory in \"%s\", must have at least phar://%s/ for root directory (always use full path to a new phar)", filename, arch);
arch = NULL;
} else {
- php_stream_wrapper_log_error(wrapper, options TSRMLS_CC, "phar error: invalid url or non-existent phar \"%s\"", filename);
+ php_stream_wrapper_log_error(wrapper, options, "phar error: invalid url or non-existent phar \"%s\"", filename);
}
}
return NULL;
@@ -108,27 +108,27 @@ php_url* phar_parse_url(php_stream_wrapper *wrapper, const char *filename, const
}
if (PHAR_G(readonly) && (!pphar || !pphar->is_data)) {
if (!(options & PHP_STREAM_URL_STAT_QUIET)) {
- php_stream_wrapper_log_error(wrapper, options TSRMLS_CC, "phar error: write operations disabled by the php.ini setting phar.readonly");
+ php_stream_wrapper_log_error(wrapper, options, "phar error: write operations disabled by the php.ini setting phar.readonly");
}
php_url_free(resource);
return NULL;
}
- if (phar_open_or_create_filename(resource->host, arch_len, NULL, 0, 0, options, &phar, &error TSRMLS_CC) == FAILURE)
+ if (phar_open_or_create_filename(resource->host, arch_len, NULL, 0, 0, options, &phar, &error) == FAILURE)
{
if (error) {
if (!(options & PHP_STREAM_URL_STAT_QUIET)) {
- php_stream_wrapper_log_error(wrapper, options TSRMLS_CC, "%s", error);
+ php_stream_wrapper_log_error(wrapper, options, "%s", error);
}
efree(error);
}
php_url_free(resource);
return NULL;
}
- if (phar->is_persistent && FAILURE == phar_copy_on_write(&phar TSRMLS_CC)) {
+ if (phar->is_persistent && FAILURE == phar_copy_on_write(&phar)) {
if (error) {
spprintf(&error, 0, "Cannot open cached phar '%s' as writeable, copy on write failed", resource->host);
if (!(options & PHP_STREAM_URL_STAT_QUIET)) {
- php_stream_wrapper_log_error(wrapper, options TSRMLS_CC, "%s", error);
+ php_stream_wrapper_log_error(wrapper, options, "%s", error);
}
efree(error);
}
@@ -136,11 +136,11 @@ php_url* phar_parse_url(php_stream_wrapper *wrapper, const char *filename, const
return NULL;
}
} else {
- if (phar_open_from_filename(resource->host, arch_len, NULL, 0, options, NULL, &error TSRMLS_CC) == FAILURE)
+ if (phar_open_from_filename(resource->host, arch_len, NULL, 0, options, NULL, &error) == FAILURE)
{
if (error) {
if (!(options & PHP_STREAM_URL_STAT_QUIET)) {
- php_stream_wrapper_log_error(wrapper, options TSRMLS_CC, "%s", error);
+ php_stream_wrapper_log_error(wrapper, options, "%s", error);
}
efree(error);
}
@@ -155,7 +155,7 @@ php_url* phar_parse_url(php_stream_wrapper *wrapper, const char *filename, const
/**
* used for fopen('phar://...') and company
*/
-static php_stream * phar_wrapper_open_url(php_stream_wrapper *wrapper, const char *path, const char *mode, int options, char **opened_path, php_stream_context *context STREAMS_DC TSRMLS_DC) /* {{{ */
+static php_stream * phar_wrapper_open_url(php_stream_wrapper *wrapper, const char *path, const char *mode, int options, char **opened_path, php_stream_context *context STREAMS_DC) /* {{{ */
{
phar_archive_data *phar;
phar_entry_data *idata;
@@ -167,35 +167,35 @@ static php_stream * phar_wrapper_open_url(php_stream_wrapper *wrapper, const cha
zval *pzoption, *metadata;
uint host_len;
- if ((resource = phar_parse_url(wrapper, path, mode, options TSRMLS_CC)) == NULL) {
+ if ((resource = phar_parse_url(wrapper, path, mode, options)) == NULL) {
return NULL;
}
/* we must have at the very least phar://alias.phar/internalfile.php */
if (!resource->scheme || !resource->host || !resource->path) {
php_url_free(resource);
- php_stream_wrapper_log_error(wrapper, options TSRMLS_CC, "phar error: invalid url \"%s\"", path);
+ php_stream_wrapper_log_error(wrapper, options, "phar error: invalid url \"%s\"", path);
return NULL;
}
if (strcasecmp("phar", resource->scheme)) {
php_url_free(resource);
- php_stream_wrapper_log_error(wrapper, options TSRMLS_CC, "phar error: not a phar stream url \"%s\"", path);
+ php_stream_wrapper_log_error(wrapper, options, "phar error: not a phar stream url \"%s\"", path);
return NULL;
}
host_len = strlen(resource->host);
- phar_request_initialize(TSRMLS_C);
+ phar_request_initialize();
/* strip leading "/" */
internal_file = estrdup(resource->path + 1);
if (mode[0] == 'w' || (mode[0] == 'r' && mode[1] == '+')) {
- if (NULL == (idata = phar_get_or_create_entry_data(resource->host, host_len, internal_file, strlen(internal_file), mode, 0, &error, 1 TSRMLS_CC))) {
+ if (NULL == (idata = phar_get_or_create_entry_data(resource->host, host_len, internal_file, strlen(internal_file), mode, 0, &error, 1))) {
if (error) {
- php_stream_wrapper_log_error(wrapper, options TSRMLS_CC, "%s", error);
+ php_stream_wrapper_log_error(wrapper, options, "%s", error);
efree(error);
} else {
- php_stream_wrapper_log_error(wrapper, options TSRMLS_CC, "phar error: file \"%s\" could not be created in phar \"%s\"", internal_file, resource->host);
+ php_stream_wrapper_log_error(wrapper, options, "phar error: file \"%s\" could not be created in phar \"%s\"", internal_file, resource->host);
}
efree(internal_file);
php_url_free(resource);
@@ -237,14 +237,14 @@ static php_stream * phar_wrapper_open_url(php_stream_wrapper *wrapper, const cha
} else {
if (!*internal_file && (options & STREAM_OPEN_FOR_INCLUDE)) {
/* retrieve the stub */
- if (FAILURE == phar_get_archive(&phar, resource->host, host_len, NULL, 0, NULL TSRMLS_CC)) {
- php_stream_wrapper_log_error(wrapper, options TSRMLS_CC, "file %s is not a valid phar archive", resource->host);
+ if (FAILURE == phar_get_archive(&phar, resource->host, host_len, NULL, 0, NULL)) {
+ php_stream_wrapper_log_error(wrapper, options, "file %s is not a valid phar archive", resource->host);
efree(internal_file);
php_url_free(resource);
return NULL;
}
if (phar->is_tar || phar->is_zip) {
- if ((FAILURE == phar_get_entry_data(&idata, resource->host, host_len, ".phar/stub.php", sizeof(".phar/stub.php")-1, "r", 0, &error, 0 TSRMLS_CC)) || !idata) {
+ if ((FAILURE == phar_get_entry_data(&idata, resource->host, host_len, ".phar/stub.php", sizeof(".phar/stub.php")-1, "r", 0, &error, 0)) || !idata) {
goto idata_error;
}
efree(internal_file);
@@ -266,7 +266,7 @@ static php_stream * phar_wrapper_open_url(php_stream_wrapper *wrapper, const cha
entry->is_crc_checked = 1;
idata = (phar_entry_data *) ecalloc(1, sizeof(phar_entry_data));
- idata->fp = phar_get_pharfp(phar TSRMLS_CC);
+ idata->fp = phar_get_pharfp(phar);
idata->phar = phar;
idata->internal_file = entry;
if (!phar->is_persistent) {
@@ -282,13 +282,13 @@ static php_stream * phar_wrapper_open_url(php_stream_wrapper *wrapper, const cha
}
}
/* read-only access is allowed to magic files in .phar directory */
- if ((FAILURE == phar_get_entry_data(&idata, resource->host, host_len, internal_file, strlen(internal_file), "r", 0, &error, 0 TSRMLS_CC)) || !idata) {
+ if ((FAILURE == phar_get_entry_data(&idata, resource->host, host_len, internal_file, strlen(internal_file), "r", 0, &error, 0)) || !idata) {
idata_error:
if (error) {
- php_stream_wrapper_log_error(wrapper, options TSRMLS_CC, "%s", error);
+ php_stream_wrapper_log_error(wrapper, options, "%s", error);
efree(error);
} else {
- php_stream_wrapper_log_error(wrapper, options TSRMLS_CC, "phar error: \"%s\" is not a file in phar \"%s\"", internal_file, resource->host);
+ php_stream_wrapper_log_error(wrapper, options, "phar error: \"%s\" is not a file in phar \"%s\"", internal_file, resource->host);
}
efree(internal_file);
php_url_free(resource);
@@ -307,10 +307,10 @@ idata_error:
#endif
/* check length, crc32 */
- if (!idata->internal_file->is_crc_checked && phar_postprocess_file(idata, idata->internal_file->crc32, &error, 2 TSRMLS_CC) != SUCCESS) {
- php_stream_wrapper_log_error(wrapper, options TSRMLS_CC, "%s", error);
+ if (!idata->internal_file->is_crc_checked && phar_postprocess_file(idata, idata->internal_file->crc32, &error, 2) != SUCCESS) {
+ php_stream_wrapper_log_error(wrapper, options, "%s", error);
efree(error);
- phar_entry_delref(idata TSRMLS_CC);
+ phar_entry_delref(idata);
efree(internal_file);
return NULL;
}
@@ -344,9 +344,9 @@ phar_stub:
/**
* Used for fclose($fp) where $fp is a phar archive
*/
-static int phar_stream_close(php_stream *stream, int close_handle TSRMLS_DC) /* {{{ */
+static int phar_stream_close(php_stream *stream, int close_handle) /* {{{ */
{
- phar_entry_delref((phar_entry_data *)stream->abstract TSRMLS_CC);
+ phar_entry_delref((phar_entry_data *)stream->abstract);
return 0;
}
@@ -355,14 +355,14 @@ static int phar_stream_close(php_stream *stream, int close_handle TSRMLS_DC) /*
/**
* used for fread($fp) and company on a fopen()ed phar file handle
*/
-static size_t phar_stream_read(php_stream *stream, char *buf, size_t count TSRMLS_DC) /* {{{ */
+static size_t phar_stream_read(php_stream *stream, char *buf, size_t count) /* {{{ */
{
phar_entry_data *data = (phar_entry_data *)stream->abstract;
size_t got;
phar_entry_info *entry;
if (data->internal_file->link) {
- entry = phar_get_link_source(data->internal_file TSRMLS_CC);
+ entry = phar_get_link_source(data->internal_file);
} else {
entry = data->internal_file;
}
@@ -386,7 +386,7 @@ static size_t phar_stream_read(php_stream *stream, char *buf, size_t count TSRML
/**
* Used for fseek($fp) on a phar file handle
*/
-static int phar_stream_seek(php_stream *stream, zend_off_t offset, int whence, zend_off_t *newoffset TSRMLS_DC) /* {{{ */
+static int phar_stream_seek(php_stream *stream, zend_off_t offset, int whence, zend_off_t *newoffset) /* {{{ */
{
phar_entry_data *data = (phar_entry_data *)stream->abstract;
phar_entry_info *entry;
@@ -394,7 +394,7 @@ static int phar_stream_seek(php_stream *stream, zend_off_t offset, int whence, z
zend_off_t temp;
if (data->internal_file->link) {
- entry = phar_get_link_source(data->internal_file TSRMLS_CC);
+ entry = phar_get_link_source(data->internal_file);
} else {
entry = data->internal_file;
}
@@ -430,13 +430,13 @@ static int phar_stream_seek(php_stream *stream, zend_off_t offset, int whence, z
/**
* Used for writing to a phar file
*/
-static size_t phar_stream_write(php_stream *stream, const char *buf, size_t count TSRMLS_DC) /* {{{ */
+static size_t phar_stream_write(php_stream *stream, const char *buf, size_t count) /* {{{ */
{
phar_entry_data *data = (phar_entry_data *) stream->abstract;
php_stream_seek(data->fp, data->position, SEEK_SET);
if (count != php_stream_write(data->fp, buf, count)) {
- php_stream_wrapper_log_error(stream->wrapper, stream->flags TSRMLS_CC, "phar error: Could not write %d characters to \"%s\" in phar \"%s\"", (int) count, data->internal_file->filename, data->phar->fname);
+ php_stream_wrapper_log_error(stream->wrapper, stream->flags, "phar error: Could not write %d characters to \"%s\" in phar \"%s\"", (int) count, data->internal_file->filename, data->phar->fname);
return -1;
}
data->position = php_stream_tell(data->fp);
@@ -453,7 +453,7 @@ static size_t phar_stream_write(php_stream *stream, const char *buf, size_t coun
/**
* Used to save work done on a writeable phar
*/
-static int phar_stream_flush(php_stream *stream TSRMLS_DC) /* {{{ */
+static int phar_stream_flush(php_stream *stream) /* {{{ */
{
char *error;
int ret;
@@ -461,9 +461,9 @@ static int phar_stream_flush(php_stream *stream TSRMLS_DC) /* {{{ */
if (data->internal_file->is_modified) {
data->internal_file->timestamp = time(0);
- ret = phar_flush(data->phar, 0, 0, 0, &error TSRMLS_CC);
+ ret = phar_flush(data->phar, 0, 0, 0, &error);
if (error) {
- php_stream_wrapper_log_error(stream->wrapper, REPORT_ERRORS TSRMLS_CC, "%s", error);
+ php_stream_wrapper_log_error(stream->wrapper, REPORT_ERRORS, "%s", error);
efree(error);
}
return ret;
@@ -477,7 +477,7 @@ static int phar_stream_flush(php_stream *stream TSRMLS_DC) /* {{{ */
/**
* stat an opened phar file handle stream, used by phar_stat()
*/
-void phar_dostat(phar_archive_data *phar, phar_entry_info *data, php_stream_statbuf *ssb, zend_bool is_temp_dir TSRMLS_DC)
+void phar_dostat(phar_archive_data *phar, phar_entry_info *data, php_stream_statbuf *ssb, zend_bool is_temp_dir)
{
memset(ssb, 0, sizeof(php_stream_statbuf));
@@ -545,7 +545,7 @@ void phar_dostat(phar_archive_data *phar, phar_entry_info *data, php_stream_stat
/**
* Stat an opened phar file handle
*/
-static int phar_stream_stat(php_stream *stream, php_stream_statbuf *ssb TSRMLS_DC) /* {{{ */
+static int phar_stream_stat(php_stream *stream, php_stream_statbuf *ssb) /* {{{ */
{
phar_entry_data *data = (phar_entry_data *)stream->abstract;
@@ -554,7 +554,7 @@ static int phar_stream_stat(php_stream *stream, php_stream_statbuf *ssb TSRMLS_D
return -1;
}
- phar_dostat(data->phar, data->internal_file, ssb, 0 TSRMLS_CC);
+ phar_dostat(data->phar, data->internal_file, ssb, 0);
return 0;
}
/* }}} */
@@ -563,7 +563,7 @@ static int phar_stream_stat(php_stream *stream, php_stream_statbuf *ssb TSRMLS_D
* Stream wrapper stat implementation of stat()
*/
static int phar_wrapper_stat(php_stream_wrapper *wrapper, const char *url, int flags,
- php_stream_statbuf *ssb, php_stream_context *context TSRMLS_DC) /* {{{ */
+ php_stream_statbuf *ssb, php_stream_context *context) /* {{{ */
{
php_url *resource = NULL;
char *internal_file, *error;
@@ -572,7 +572,7 @@ static int phar_wrapper_stat(php_stream_wrapper *wrapper, const char *url, int f
uint host_len;
int internal_file_len;
- if ((resource = phar_parse_url(wrapper, url, "r", flags|PHP_STREAM_URL_STAT_QUIET TSRMLS_CC)) == NULL) {
+ if ((resource = phar_parse_url(wrapper, url, "r", flags|PHP_STREAM_URL_STAT_QUIET)) == NULL) {
return FAILURE;
}
@@ -588,11 +588,11 @@ static int phar_wrapper_stat(php_stream_wrapper *wrapper, const char *url, int f
}
host_len = strlen(resource->host);
- phar_request_initialize(TSRMLS_C);
+ phar_request_initialize();
internal_file = resource->path + 1; /* strip leading "/" */
/* find the phar in our trusty global hash indexed by alias (host of phar://blah.phar/file.whatever) */
- if (FAILURE == phar_get_archive(&phar, resource->host, host_len, NULL, 0, &error TSRMLS_CC)) {
+ if (FAILURE == phar_get_archive(&phar, resource->host, host_len, NULL, 0, &error)) {
php_url_free(resource);
if (error) {
efree(error);
@@ -604,7 +604,7 @@ static int phar_wrapper_stat(php_stream_wrapper *wrapper, const char *url, int f
}
if (*internal_file == '\0') {
/* root directory requested */
- phar_dostat(phar, NULL, ssb, 1 TSRMLS_CC);
+ phar_dostat(phar, NULL, ssb, 1);
php_url_free(resource);
return SUCCESS;
}
@@ -615,12 +615,12 @@ static int phar_wrapper_stat(php_stream_wrapper *wrapper, const char *url, int f
internal_file_len = strlen(internal_file);
/* search through the manifest of files, and if we have an exact match, it's a file */
if (NULL != (entry = zend_hash_str_find_ptr(&phar->manifest, internal_file, internal_file_len))) {
- phar_dostat(phar, entry, ssb, 0 TSRMLS_CC);
+ phar_dostat(phar, entry, ssb, 0);
php_url_free(resource);
return SUCCESS;
}
if (zend_hash_str_exists(&(phar->virtual_dirs), internal_file, internal_file_len)) {
- phar_dostat(phar, NULL, ssb, 1 TSRMLS_CC);
+ phar_dostat(phar, NULL, ssb, 1);
php_url_free(resource);
return SUCCESS;
}
@@ -648,7 +648,7 @@ static int phar_wrapper_stat(php_stream_wrapper *wrapper, const char *url, int f
continue;
}
/* mount the file/directory just in time */
- if (SUCCESS != phar_mount_entry(phar, test, test_len, internal_file, internal_file_len TSRMLS_CC)) {
+ if (SUCCESS != phar_mount_entry(phar, test, test_len, internal_file, internal_file_len)) {
efree(test);
goto free_resource;
}
@@ -656,7 +656,7 @@ static int phar_wrapper_stat(php_stream_wrapper *wrapper, const char *url, int f
if (NULL == (entry = zend_hash_str_find_ptr(&phar->manifest, internal_file, internal_file_len))) {
goto free_resource;
}
- phar_dostat(phar, entry, ssb, 0 TSRMLS_CC);
+ phar_dostat(phar, entry, ssb, 0);
php_url_free(resource);
return SUCCESS;
}
@@ -671,7 +671,7 @@ free_resource:
/**
* Unlink a file within a phar archive
*/
-static int phar_wrapper_unlink(php_stream_wrapper *wrapper, const char *url, int options, php_stream_context *context TSRMLS_DC) /* {{{ */
+static int phar_wrapper_unlink(php_stream_wrapper *wrapper, const char *url, int options, php_stream_context *context) /* {{{ */
{
php_url *resource;
char *internal_file, *error;
@@ -680,44 +680,44 @@ static int phar_wrapper_unlink(php_stream_wrapper *wrapper, const char *url, int
phar_archive_data *pphar;
uint host_len;
- if ((resource = phar_parse_url(wrapper, url, "rb", options TSRMLS_CC)) == NULL) {
- php_stream_wrapper_log_error(wrapper, options TSRMLS_CC, "phar error: unlink failed");
+ if ((resource = phar_parse_url(wrapper, url, "rb", options)) == NULL) {
+ php_stream_wrapper_log_error(wrapper, options, "phar error: unlink failed");
return 0;
}
/* we must have at the very least phar://alias.phar/internalfile.php */
if (!resource->scheme || !resource->host || !resource->path) {
php_url_free(resource);
- php_stream_wrapper_log_error(wrapper, options TSRMLS_CC, "phar error: invalid url \"%s\"", url);
+ php_stream_wrapper_log_error(wrapper, options, "phar error: invalid url \"%s\"", url);
return 0;
}
if (strcasecmp("phar", resource->scheme)) {
php_url_free(resource);
- php_stream_wrapper_log_error(wrapper, options TSRMLS_CC, "phar error: not a phar stream url \"%s\"", url);
+ php_stream_wrapper_log_error(wrapper, options, "phar error: not a phar stream url \"%s\"", url);
return 0;
}
host_len = strlen(resource->host);
- phar_request_initialize(TSRMLS_C);
+ phar_request_initialize();
pphar = zend_hash_str_find_ptr(&(PHAR_GLOBALS->phar_fname_map), resource->host, host_len);
if (PHAR_G(readonly) && (!pphar || !pphar->is_data)) {
php_url_free(resource);
- php_stream_wrapper_log_error(wrapper, options TSRMLS_CC, "phar error: write operations disabled by the php.ini setting phar.readonly");
+ php_stream_wrapper_log_error(wrapper, options, "phar error: write operations disabled by the php.ini setting phar.readonly");
return 0;
}
/* need to copy to strip leading "/", will get touched again */
internal_file = estrdup(resource->path + 1);
internal_file_len = strlen(internal_file);
- if (FAILURE == phar_get_entry_data(&idata, resource->host, host_len, internal_file, internal_file_len, "r", 0, &error, 1 TSRMLS_CC)) {
+ if (FAILURE == phar_get_entry_data(&idata, resource->host, host_len, internal_file, internal_file_len, "r", 0, &error, 1)) {
/* constraints of fp refcount were not met */
if (error) {
- php_stream_wrapper_log_error(wrapper, options TSRMLS_CC, "unlink of \"%s\" failed: %s", url, error);
+ php_stream_wrapper_log_error(wrapper, options, "unlink of \"%s\" failed: %s", url, error);
efree(error);
} else {
- php_stream_wrapper_log_error(wrapper, options TSRMLS_CC, "unlink of \"%s\" failed, file does not exist", url);
+ php_stream_wrapper_log_error(wrapper, options, "unlink of \"%s\" failed, file does not exist", url);
}
efree(internal_file);
php_url_free(resource);
@@ -728,24 +728,24 @@ static int phar_wrapper_unlink(php_stream_wrapper *wrapper, const char *url, int
}
if (idata->internal_file->fp_refcount > 1) {
/* more than just our fp resource is open for this file */
- php_stream_wrapper_log_error(wrapper, options TSRMLS_CC, "phar error: \"%s\" in phar \"%s\", has open file pointers, cannot unlink", internal_file, resource->host);
+ php_stream_wrapper_log_error(wrapper, options, "phar error: \"%s\" in phar \"%s\", has open file pointers, cannot unlink", internal_file, resource->host);
efree(internal_file);
php_url_free(resource);
- phar_entry_delref(idata TSRMLS_CC);
+ phar_entry_delref(idata);
return 0;
}
php_url_free(resource);
efree(internal_file);
- phar_entry_remove(idata, &error TSRMLS_CC);
+ phar_entry_remove(idata, &error);
if (error) {
- php_stream_wrapper_log_error(wrapper, options TSRMLS_CC, "%s", error);
+ php_stream_wrapper_log_error(wrapper, options, "%s", error);
efree(error);
}
return 1;
}
/* }}} */
-static int phar_wrapper_rename(php_stream_wrapper *wrapper, const char *url_from, const char *url_to, int options, php_stream_context *context TSRMLS_DC) /* {{{ */
+static int phar_wrapper_rename(php_stream_wrapper *wrapper, const char *url_from, const char *url_to, int options, php_stream_context *context) /* {{{ */
{
php_url *resource_from, *resource_to;
char *error;
@@ -757,11 +757,11 @@ static int phar_wrapper_rename(php_stream_wrapper *wrapper, const char *url_from
error = NULL;
- if ((resource_from = phar_parse_url(wrapper, url_from, "wb", options|PHP_STREAM_URL_STAT_QUIET TSRMLS_CC)) == NULL) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "phar error: cannot rename \"%s\" to \"%s\": invalid or non-writable url \"%s\"", url_from, url_to, url_from);
+ if ((resource_from = phar_parse_url(wrapper, url_from, "wb", options|PHP_STREAM_URL_STAT_QUIET)) == NULL) {
+ php_error_docref(NULL, E_WARNING, "phar error: cannot rename \"%s\" to \"%s\": invalid or non-writable url \"%s\"", url_from, url_to, url_from);
return 0;
}
- if (SUCCESS != phar_get_archive(&pfrom, resource_from->host, strlen(resource_from->host), NULL, 0, &error TSRMLS_CC)) {
+ if (SUCCESS != phar_get_archive(&pfrom, resource_from->host, strlen(resource_from->host), NULL, 0, &error)) {
pfrom = NULL;
if (error) {
efree(error);
@@ -769,16 +769,16 @@ static int phar_wrapper_rename(php_stream_wrapper *wrapper, const char *url_from
}
if (PHAR_G(readonly) && (!pfrom || !pfrom->is_data)) {
php_url_free(resource_from);
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "phar error: Write operations disabled by the php.ini setting phar.readonly");
+ php_error_docref(NULL, E_WARNING, "phar error: Write operations disabled by the php.ini setting phar.readonly");
return 0;
}
- if ((resource_to = phar_parse_url(wrapper, url_to, "wb", options|PHP_STREAM_URL_STAT_QUIET TSRMLS_CC)) == NULL) {
+ if ((resource_to = phar_parse_url(wrapper, url_to, "wb", options|PHP_STREAM_URL_STAT_QUIET)) == NULL) {
php_url_free(resource_from);
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "phar error: cannot rename \"%s\" to \"%s\": invalid or non-writable url \"%s\"", url_from, url_to, url_to);
+ php_error_docref(NULL, E_WARNING, "phar error: cannot rename \"%s\" to \"%s\": invalid or non-writable url \"%s\"", url_from, url_to, url_to);
return 0;
}
- if (SUCCESS != phar_get_archive(&pto, resource_to->host, strlen(resource_to->host), NULL, 0, &error TSRMLS_CC)) {
+ if (SUCCESS != phar_get_archive(&pto, resource_to->host, strlen(resource_to->host), NULL, 0, &error)) {
if (error) {
efree(error);
}
@@ -786,14 +786,14 @@ static int phar_wrapper_rename(php_stream_wrapper *wrapper, const char *url_from
}
if (PHAR_G(readonly) && (!pto || !pto->is_data)) {
php_url_free(resource_from);
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "phar error: Write operations disabled by the php.ini setting phar.readonly");
+ php_error_docref(NULL, E_WARNING, "phar error: Write operations disabled by the php.ini setting phar.readonly");
return 0;
}
if (strcmp(resource_from->host, resource_to->host)) {
php_url_free(resource_from);
php_url_free(resource_to);
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "phar error: cannot rename \"%s\" to \"%s\", not within the same phar archive", url_from, url_to);
+ php_error_docref(NULL, E_WARNING, "phar error: cannot rename \"%s\" to \"%s\", not within the same phar archive", url_from, url_to);
return 0;
}
@@ -801,45 +801,45 @@ static int phar_wrapper_rename(php_stream_wrapper *wrapper, const char *url_from
if (!resource_from->scheme || !resource_from->host || !resource_from->path) {
php_url_free(resource_from);
php_url_free(resource_to);
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "phar error: cannot rename \"%s\" to \"%s\": invalid url \"%s\"", url_from, url_to, url_from);
+ php_error_docref(NULL, E_WARNING, "phar error: cannot rename \"%s\" to \"%s\": invalid url \"%s\"", url_from, url_to, url_from);
return 0;
}
if (!resource_to->scheme || !resource_to->host || !resource_to->path) {
php_url_free(resource_from);
php_url_free(resource_to);
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "phar error: cannot rename \"%s\" to \"%s\": invalid url \"%s\"", url_from, url_to, url_to);
+ php_error_docref(NULL, E_WARNING, "phar error: cannot rename \"%s\" to \"%s\": invalid url \"%s\"", url_from, url_to, url_to);
return 0;
}
if (strcasecmp("phar", resource_from->scheme)) {
php_url_free(resource_from);
php_url_free(resource_to);
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "phar error: cannot rename \"%s\" to \"%s\": not a phar stream url \"%s\"", url_from, url_to, url_from);
+ php_error_docref(NULL, E_WARNING, "phar error: cannot rename \"%s\" to \"%s\": not a phar stream url \"%s\"", url_from, url_to, url_from);
return 0;
}
if (strcasecmp("phar", resource_to->scheme)) {
php_url_free(resource_from);
php_url_free(resource_to);
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "phar error: cannot rename \"%s\" to \"%s\": not a phar stream url \"%s\"", url_from, url_to, url_to);
+ php_error_docref(NULL, E_WARNING, "phar error: cannot rename \"%s\" to \"%s\": not a phar stream url \"%s\"", url_from, url_to, url_to);
return 0;
}
host_len = strlen(resource_from->host);
- if (SUCCESS != phar_get_archive(&phar, resource_from->host, host_len, NULL, 0, &error TSRMLS_CC)) {
+ if (SUCCESS != phar_get_archive(&phar, resource_from->host, host_len, NULL, 0, &error)) {
php_url_free(resource_from);
php_url_free(resource_to);
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "phar error: cannot rename \"%s\" to \"%s\": %s", url_from, url_to, error);
+ php_error_docref(NULL, E_WARNING, "phar error: cannot rename \"%s\" to \"%s\": %s", url_from, url_to, error);
efree(error);
return 0;
}
- if (phar->is_persistent && FAILURE == phar_copy_on_write(&phar TSRMLS_CC)) {
+ if (phar->is_persistent && FAILURE == phar_copy_on_write(&phar)) {
php_url_free(resource_from);
php_url_free(resource_to);
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "phar error: cannot rename \"%s\" to \"%s\": could not make cached phar writeable", url_from, url_to);
+ php_error_docref(NULL, E_WARNING, "phar error: cannot rename \"%s\" to \"%s\": could not make cached phar writeable", url_from, url_to);
return 0;
}
@@ -850,7 +850,7 @@ static int phar_wrapper_rename(php_stream_wrapper *wrapper, const char *url_from
if (entry->is_deleted) {
php_url_free(resource_from);
php_url_free(resource_to);
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "phar error: cannot rename \"%s\" to \"%s\" from extracted phar archive, source has been deleted", url_from, url_to);
+ php_error_docref(NULL, E_WARNING, "phar error: cannot rename \"%s\" to \"%s\" from extracted phar archive, source has been deleted", url_from, url_to);
return 0;
}
/* transfer all data over to the new entry */
@@ -866,10 +866,10 @@ static int phar_wrapper_rename(php_stream_wrapper *wrapper, const char *url_from
entry = zend_hash_str_add_mem(&(phar->manifest), resource_to->path+1, strlen(resource_to->path)-1, (void **)&new, sizeof(phar_entry_info));
entry->filename = estrdup(resource_to->path+1);
- if (FAILURE == phar_copy_entry_fp(source, entry, &error TSRMLS_CC)) {
+ if (FAILURE == phar_copy_entry_fp(source, entry, &error)) {
php_url_free(resource_from);
php_url_free(resource_to);
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "phar error: cannot rename \"%s\" to \"%s\": %s", url_from, url_to, error);
+ php_error_docref(NULL, E_WARNING, "phar error: cannot rename \"%s\" to \"%s\": %s", url_from, url_to, error);
efree(error);
zend_hash_str_del(&(phar->manifest), entry->filename, strlen(entry->filename));
return 0;
@@ -884,7 +884,7 @@ static int phar_wrapper_rename(php_stream_wrapper *wrapper, const char *url_from
/* file does not exist */
php_url_free(resource_from);
php_url_free(resource_to);
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "phar error: cannot rename \"%s\" to \"%s\" from extracted phar archive, source does not exist", url_from, url_to);
+ php_error_docref(NULL, E_WARNING, "phar error: cannot rename \"%s\" to \"%s\" from extracted phar archive, source does not exist", url_from, url_to);
return 0;
}
@@ -963,11 +963,11 @@ static int phar_wrapper_rename(php_stream_wrapper *wrapper, const char *url_from
}
if (is_modified) {
- phar_flush(phar, 0, 0, 0, &error TSRMLS_CC);
+ phar_flush(phar, 0, 0, 0, &error);
if (error) {
php_url_free(resource_from);
php_url_free(resource_to);
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "phar error: cannot rename \"%s\" to \"%s\": %s", url_from, url_to, error);
+ php_error_docref(NULL, E_WARNING, "phar error: cannot rename \"%s\" to \"%s\": %s", url_from, url_to, error);
efree(error);
return 0;
}
diff --git a/ext/phar/stream.h b/ext/phar/stream.h
index 0171010179..16156f08fb 100644
--- a/ext/phar/stream.h
+++ b/ext/phar/stream.h
@@ -21,21 +21,21 @@
BEGIN_EXTERN_C()
-php_url* phar_parse_url(php_stream_wrapper *wrapper, const char *filename, const char *mode, int options TSRMLS_DC);
-void phar_entry_remove(phar_entry_data *idata, char **error TSRMLS_DC);
+php_url* phar_parse_url(php_stream_wrapper *wrapper, const char *filename, const char *mode, int options);
+void phar_entry_remove(phar_entry_data *idata, char **error);
-static php_stream* phar_wrapper_open_url(php_stream_wrapper *wrapper, const char *path, const char *mode, int options, char **opened_path, php_stream_context *context STREAMS_DC TSRMLS_DC);
-static int phar_wrapper_rename(php_stream_wrapper *wrapper, const char *url_from, const char *url_to, int options, php_stream_context *context TSRMLS_DC);
-static int phar_wrapper_unlink(php_stream_wrapper *wrapper, const char *url, int options, php_stream_context *context TSRMLS_DC);
-static int phar_wrapper_stat(php_stream_wrapper *wrapper, const char *url, int flags, php_stream_statbuf *ssb, php_stream_context *context TSRMLS_DC);
+static php_stream* phar_wrapper_open_url(php_stream_wrapper *wrapper, const char *path, const char *mode, int options, char **opened_path, php_stream_context *context STREAMS_DC);
+static int phar_wrapper_rename(php_stream_wrapper *wrapper, const char *url_from, const char *url_to, int options, php_stream_context *context);
+static int phar_wrapper_unlink(php_stream_wrapper *wrapper, const char *url, int options, php_stream_context *context);
+static int phar_wrapper_stat(php_stream_wrapper *wrapper, const char *url, int flags, php_stream_statbuf *ssb, php_stream_context *context);
/* file/stream handlers */
-static size_t phar_stream_write(php_stream *stream, const char *buf, size_t count TSRMLS_DC);
-static size_t phar_stream_read( php_stream *stream, char *buf, size_t count TSRMLS_DC);
-static int phar_stream_close(php_stream *stream, int close_handle TSRMLS_DC);
-static int phar_stream_flush(php_stream *stream TSRMLS_DC);
-static int phar_stream_seek( php_stream *stream, zend_off_t offset, int whence, zend_off_t *newoffset TSRMLS_DC);
-static int phar_stream_stat( php_stream *stream, php_stream_statbuf *ssb TSRMLS_DC);
+static size_t phar_stream_write(php_stream *stream, const char *buf, size_t count);
+static size_t phar_stream_read( php_stream *stream, char *buf, size_t count);
+static int phar_stream_close(php_stream *stream, int close_handle);
+static int phar_stream_flush(php_stream *stream);
+static int phar_stream_seek( php_stream *stream, zend_off_t offset, int whence, zend_off_t *newoffset);
+static int phar_stream_stat( php_stream *stream, php_stream_statbuf *ssb);
END_EXTERN_C()
/*
diff --git a/ext/phar/stub.h b/ext/phar/stub.h
index 6d524c69d1..5a42883426 100644
--- a/ext/phar/stub.h
+++ b/ext/phar/stub.h
@@ -18,7 +18,7 @@
/* $Id$ */
-static inline void phar_get_stub(const char *index_php, const char *web, size_t *len, char **stub, const int name_len, const int web_len TSRMLS_DC)
+static inline void phar_get_stub(const char *index_php, const char *web, size_t *len, char **stub, const int name_len, const int web_len)
{
static const char newstub0[] = "<?php\n\n$web = '";
static const char newstub1_0[] = "';\n\nif (in_array('phar', stream_get_wrappers()) && class_exists('Phar', 0)) {\nPhar::interceptFileFuncs();\nset_include_path('phar://' . __FILE__ . PATH_SEPARATOR . get_include_path());\nPhar::webPhar(null, $web);\ninclude 'phar://' . __FILE__ . '/' . Extract_Phar::START;\nreturn;\n}\n\nif (@(isset($_SERVER['REQUEST_URI']) && isset($_SERVER['REQUEST_METHOD']) && ($_SERVER['REQUEST_METHOD'] == 'GET' || $_SERVER['REQUEST_METHOD'] == 'POST'))) {\nExtract_Phar::go(true);\n$mimes = array(\n'phps' => 2,\n'c' => 'text/plain',\n'cc' => 'text/plain',\n'cpp' => 'text/plain',\n'c++' => 'text/plain',\n'dtd' => 'text/plain',\n'h' => 'text/plain',\n'log' => 'text/plain',\n'rng' => 'text/plain',\n'txt' => 'text/plain',\n'xsd' => 'text/plain',\n'php' => 1,\n'inc' => 1,\n'avi' => 'video/avi',\n'bmp' => 'image/bmp',\n'css' => 'text/css',\n'gif' => 'image/gif',\n'htm' => 'text/html',\n'html' => 'text/html',\n'htmls' => 'text/html',\n'ico' => 'image/x-ico',\n'jpe' => 'image/jpeg',\n'jpg' => 'image/jpeg',\n'jpeg' => 'image/jpeg',\n'js' => 'application/x-javascript',\n'midi' => 'audio/midi',\n'mid' => 'audio/midi',\n'mod' => 'audio/mod',\n'mov' => 'movie/quicktime',\n'mp3' => 'audio/mp3',\n'mpg' => 'video/mpeg',\n'mpeg' => 'video/mpeg',\n'pdf' => 'application/pdf',\n'png' => 'image/png',\n'swf' => 'application/shockwave-flash',\n'tif' => 'image/tiff',\n'tiff' => 'image/tiff',\n'wav' => 'audio/wav',\n'xbm' => 'image/xbm',\n'xml' => 'text/xml',\n);\n\nheader(\"Cache-Control: no-cache, must-revalidate\");\nheader(\"Pragma: no-cache\");\n\n$basename = basename(__FILE__);\nif (!strpos($_SERVER['REQUEST_URI'], $basename)) {\nchdir(Extract_Phar::$temp);\ninclude $web;\nreturn;\n}\n$pt = substr($_SERVER['REQUEST_URI'], strpos($_SERVER['REQUEST_URI'], $basename) + strlen($basename));\nif (!$pt || $pt == '/') {\n$pt = $web;\nheader('HTTP/1.1 301 Moved Permanently');\nheader('Location: ' . $_SERVER['REQUEST_URI'] . '/' . $pt);\nexit;\n}\n$a = realpath(Extract_Phar::$temp . DIRECTORY_SEPARATOR . $pt);\nif (!$a || strlen(dirname($a)) < strlen(";
diff --git a/ext/phar/tar.c b/ext/phar/tar.c
index 76862f7cdb..2d55e347f3 100644
--- a/ext/phar/tar.c
+++ b/ext/phar/tar.c
@@ -121,10 +121,10 @@ int phar_is_tar(char *buf, char *fname) /* {{{ */
}
/* }}} */
-int phar_open_or_create_tar(char *fname, int fname_len, char *alias, int alias_len, int is_data, int options, phar_archive_data** pphar, char **error TSRMLS_DC) /* {{{ */
+int phar_open_or_create_tar(char *fname, int fname_len, char *alias, int alias_len, int is_data, int options, phar_archive_data** pphar, char **error) /* {{{ */
{
phar_archive_data *phar;
- int ret = phar_create_or_parse_filename(fname, fname_len, alias, alias_len, is_data, options, &phar, error TSRMLS_CC);
+ int ret = phar_create_or_parse_filename(fname, fname_len, alias, alias_len, is_data, options, &phar, error);
if (FAILURE == ret) {
return FAILURE;
@@ -155,7 +155,7 @@ int phar_open_or_create_tar(char *fname, int fname_len, char *alias, int alias_l
}
/* }}} */
-static int phar_tar_process_metadata(phar_entry_info *entry, php_stream *fp TSRMLS_DC) /* {{{ */
+static int phar_tar_process_metadata(phar_entry_info *entry, php_stream *fp) /* {{{ */
{
char *metadata;
size_t save = php_stream_tell(fp), read;
@@ -170,7 +170,7 @@ static int phar_tar_process_metadata(phar_entry_info *entry, php_stream *fp TSRM
return FAILURE;
}
- if (phar_parse_metadata(&metadata, &entry->metadata, entry->uncompressed_filesize TSRMLS_CC) == FAILURE) {
+ if (phar_parse_metadata(&metadata, &entry->metadata, entry->uncompressed_filesize) == FAILURE) {
/* if not valid serialized data, it is a regular string */
efree(metadata);
php_stream_seek(fp, save, SEEK_SET);
@@ -192,7 +192,7 @@ static int phar_tar_process_metadata(phar_entry_info *entry, php_stream *fp TSRM
}
/* }}} */
-int phar_parse_tarfile(php_stream* fp, char *fname, int fname_len, char *alias, int alias_len, phar_archive_data** pphar, int is_data, php_uint32 compression, char **error TSRMLS_DC) /* {{{ */
+int phar_parse_tarfile(php_stream* fp, char *fname, int fname_len, char *alias, int alias_len, phar_archive_data** pphar, int is_data, php_uint32 compression, char **error) /* {{{ */
{
char buf[512], *actual_alias = NULL, *p;
phar_entry_info entry = {0};
@@ -264,7 +264,7 @@ int phar_parse_tarfile(php_stream* fp, char *fname, int fname_len, char *alias,
}
bail:
php_stream_close(fp);
- phar_destroy_phar_data(myphar TSRMLS_CC);
+ phar_destroy_phar_data(myphar);
return FAILURE;
}
curloc = php_stream_tell(fp);
@@ -285,7 +285,7 @@ bail:
# define PHAR_GET_32(buffer) (php_uint32) *(buffer)
#endif
myphar->sig_flags = PHAR_GET_32(buf);
- if (FAILURE == phar_verify_signature(fp, php_stream_tell(fp) - size - 512, myphar->sig_flags, buf + 8, size - 8, fname, &myphar->signature, &myphar->sig_len, error TSRMLS_CC)) {
+ if (FAILURE == phar_verify_signature(fp, php_stream_tell(fp) - size - 512, myphar->sig_flags, buf + 8, size - 8, fname, &myphar->signature, &myphar->sig_len, error)) {
if (error) {
char *save = *error;
spprintf(error, 4096, "phar error: tar-based phar \"%s\" signature cannot be verified: %s", fname, save);
@@ -303,7 +303,7 @@ bail:
spprintf(error, 4096, "phar error: \"%s\" is a corrupted tar file (truncated)", fname);
}
php_stream_close(fp);
- phar_destroy_phar_data(myphar TSRMLS_CC);
+ phar_destroy_phar_data(myphar);
return FAILURE;
}
}
@@ -315,7 +315,7 @@ bail:
spprintf(error, 4096, "phar error: \"%s\" is a corrupted tar file (truncated)", fname);
}
php_stream_close(fp);
- phar_destroy_phar_data(myphar TSRMLS_CC);
+ phar_destroy_phar_data(myphar);
return FAILURE;
}
@@ -344,7 +344,7 @@ bail:
spprintf(error, 4096, "phar error: \"%s\" is a corrupted tar file (invalid entry size)", fname);
}
php_stream_close(fp);
- phar_destroy_phar_data(myphar TSRMLS_CC);
+ phar_destroy_phar_data(myphar);
return FAILURE;
}
entry.filename = pemalloc(entry.filename_len+1, myphar->is_persistent);
@@ -356,7 +356,7 @@ bail:
spprintf(error, 4096, "phar error: \"%s\" is a corrupted tar file (truncated)", fname);
}
php_stream_close(fp);
- phar_destroy_phar_data(myphar TSRMLS_CC);
+ phar_destroy_phar_data(myphar);
return FAILURE;
}
entry.filename[entry.filename_len] = '\0';
@@ -372,7 +372,7 @@ bail:
spprintf(error, 4096, "phar error: \"%s\" is a corrupted tar file (truncated)", fname);
}
php_stream_close(fp);
- phar_destroy_phar_data(myphar TSRMLS_CC);
+ phar_destroy_phar_data(myphar);
return FAILURE;
}
@@ -384,7 +384,7 @@ bail:
spprintf(error, 4096, "phar error: \"%s\" is a corrupted tar file (truncated)", fname);
}
php_stream_close(fp);
- phar_destroy_phar_data(myphar TSRMLS_CC);
+ phar_destroy_phar_data(myphar);
return FAILURE;
}
continue;
@@ -433,7 +433,7 @@ bail:
}
last_was_longlink = 0;
- phar_add_virtual_dirs(myphar, entry.filename, entry.filename_len TSRMLS_CC);
+ phar_add_virtual_dirs(myphar, entry.filename, entry.filename_len);
if (sum1 != sum2) {
if (error) {
@@ -441,7 +441,7 @@ bail:
}
pefree(entry.filename, myphar->is_persistent);
php_stream_close(fp);
- phar_destroy_phar_data(myphar TSRMLS_CC);
+ phar_destroy_phar_data(myphar);
return FAILURE;
}
@@ -473,14 +473,14 @@ bail:
}
pefree(entry.filename, entry.is_persistent);
php_stream_close(fp);
- phar_destroy_phar_data(myphar TSRMLS_CC);
+ phar_destroy_phar_data(myphar);
return FAILURE;
}
entry.link = estrdup(hdr->linkname);
} else if (entry.tar_type == TAR_SYMLINK) {
entry.link = estrdup(hdr->linkname);
}
- phar_set_inode(&entry TSRMLS_CC);
+ phar_set_inode(&entry);
newentry = zend_hash_str_add_mem(&myphar->manifest, entry.filename, entry.filename_len, (void*)&entry, sizeof(phar_entry_info));
if (entry.is_persistent) {
@@ -488,12 +488,12 @@ bail:
}
if (entry.filename_len >= sizeof(".phar/.metadata")-1 && !memcmp(entry.filename, ".phar/.metadata", sizeof(".phar/.metadata")-1)) {
- if (FAILURE == phar_tar_process_metadata(newentry, fp TSRMLS_CC)) {
+ if (FAILURE == phar_tar_process_metadata(newentry, fp)) {
if (error) {
spprintf(error, 4096, "phar error: tar-based phar \"%s\" has invalid metadata in magic file \"%s\"", fname, entry.filename);
}
php_stream_close(fp);
- phar_destroy_phar_data(myphar TSRMLS_CC);
+ phar_destroy_phar_data(myphar);
return FAILURE;
}
}
@@ -505,7 +505,7 @@ bail:
spprintf(error, 4096, "phar error: tar-based phar \"%s\" has alias that is larger than 511 bytes, cannot process", fname);
}
php_stream_close(fp);
- phar_destroy_phar_data(myphar TSRMLS_CC);
+ phar_destroy_phar_data(myphar);
return FAILURE;
}
@@ -526,7 +526,7 @@ bail:
}
php_stream_close(fp);
- phar_destroy_phar_data(myphar TSRMLS_CC);
+ phar_destroy_phar_data(myphar);
return FAILURE;
}
@@ -540,7 +540,7 @@ bail:
}
php_stream_close(fp);
- phar_destroy_phar_data(myphar TSRMLS_CC);
+ phar_destroy_phar_data(myphar);
return FAILURE;
}
}
@@ -555,7 +555,7 @@ bail:
spprintf(error, 4096, "phar error: \"%s\" is a corrupted tar file (truncated)", fname);
}
php_stream_close(fp);
- phar_destroy_phar_data(myphar TSRMLS_CC);
+ phar_destroy_phar_data(myphar);
return FAILURE;
}
}
@@ -567,7 +567,7 @@ bail:
spprintf(error, 4096, "phar error: \"%s\" is a corrupted tar file (truncated)", fname);
}
php_stream_close(fp);
- phar_destroy_phar_data(myphar TSRMLS_CC);
+ phar_destroy_phar_data(myphar);
return FAILURE;
}
} while (!php_stream_eof(fp));
@@ -581,7 +581,7 @@ bail:
/* ensure signature set */
if (!myphar->is_data && PHAR_G(require_hash) && !myphar->signature) {
php_stream_close(fp);
- phar_destroy_phar_data(myphar TSRMLS_CC);
+ phar_destroy_phar_data(myphar);
if (error) {
spprintf(error, 0, "tar-based phar \"%s\" does not have a signature", fname);
}
@@ -606,14 +606,14 @@ bail:
}
}
- phar_request_initialize(TSRMLS_C);
+ phar_request_initialize();
if (NULL == (actual = zend_hash_str_add_ptr(&(PHAR_GLOBALS->phar_fname_map), myphar->fname, fname_len, myphar))) {
if (error) {
spprintf(error, 4096, "phar error: Unable to add tar-based phar \"%s\" to phar registry", fname);
}
php_stream_close(fp);
- phar_destroy_phar_data(myphar TSRMLS_CC);
+ phar_destroy_phar_data(myphar);
return FAILURE;
}
@@ -625,7 +625,7 @@ bail:
myphar->is_temporary_alias = 0;
if (NULL != (fd_ptr = zend_hash_str_find_ptr(&(PHAR_GLOBALS->phar_alias_map), actual_alias, myphar->alias_len))) {
- if (SUCCESS != phar_free_alias(fd_ptr, actual_alias, myphar->alias_len TSRMLS_CC)) {
+ if (SUCCESS != phar_free_alias(fd_ptr, actual_alias, myphar->alias_len)) {
if (error) {
spprintf(error, 4096, "phar error: Unable to add tar-based phar \"%s\", alias is already in use", fname);
}
@@ -640,7 +640,7 @@ bail:
if (alias_len) {
if (NULL != (fd_ptr = zend_hash_str_find_ptr(&(PHAR_GLOBALS->phar_alias_map), alias, alias_len))) {
- if (SUCCESS != phar_free_alias(fd_ptr, alias, alias_len TSRMLS_CC)) {
+ if (SUCCESS != phar_free_alias(fd_ptr, alias, alias_len)) {
if (error) {
spprintf(error, 4096, "phar error: Unable to add tar-based phar \"%s\", alias is already in use", fname);
}
@@ -675,7 +675,7 @@ struct _phar_pass_tar_info {
char **error;
};
-static int phar_tar_writeheaders_int(phar_entry_info *entry, void *argument TSRMLS_DC) /* {{{ */
+static int phar_tar_writeheaders_int(phar_entry_info *entry, void *argument) /* {{{ */
{
tar_header header;
size_t pos;
@@ -695,7 +695,7 @@ static int phar_tar_writeheaders_int(phar_entry_info *entry, void *argument TSRM
}
}
- phar_add_virtual_dirs(entry->phar, entry->filename, entry->filename_len TSRMLS_CC);
+ phar_add_virtual_dirs(entry->phar, entry->filename, entry->filename_len);
memset((char *) &header, 0, sizeof(header));
if (entry->filename_len > 100) {
@@ -771,18 +771,18 @@ static int phar_tar_writeheaders_int(phar_entry_info *entry, void *argument TSRM
/* write contents */
if (entry->uncompressed_filesize) {
- if (FAILURE == phar_open_entry_fp(entry, fp->error, 0 TSRMLS_CC)) {
+ if (FAILURE == phar_open_entry_fp(entry, fp->error, 0)) {
return ZEND_HASH_APPLY_STOP;
}
- if (-1 == phar_seek_efp(entry, 0, SEEK_SET, 0, 0 TSRMLS_CC)) {
+ if (-1 == phar_seek_efp(entry, 0, SEEK_SET, 0, 0)) {
if (fp->error) {
spprintf(fp->error, 4096, "tar-based phar \"%s\" cannot be created, contents of file \"%s\" could not be written, seek failed", entry->phar->fname, entry->filename);
}
return ZEND_HASH_APPLY_STOP;
}
- if (SUCCESS != php_stream_copy_to_stream_ex(phar_get_efp(entry, 0 TSRMLS_CC), fp->new, entry->uncompressed_filesize, NULL)) {
+ if (SUCCESS != php_stream_copy_to_stream_ex(phar_get_efp(entry, 0), fp->new, entry->uncompressed_filesize, NULL)) {
if (fp->error) {
spprintf(fp->error, 4096, "tar-based phar \"%s\" cannot be created, contents of file \"%s\" could not be written", entry->phar->fname, entry->filename);
}
@@ -823,13 +823,13 @@ static int phar_tar_writeheaders_int(phar_entry_info *entry, void *argument TSRM
}
/* }}} */
-static int phar_tar_writeheaders(zval *zv, void *argument TSRMLS_DC) /* {{{ */
+static int phar_tar_writeheaders(zval *zv, void *argument) /* {{{ */
{
- return phar_tar_writeheaders_int(Z_PTR_P(zv), argument TSRMLS_CC);
+ return phar_tar_writeheaders_int(Z_PTR_P(zv), argument);
}
/* }}} */
-int phar_tar_setmetadata(zval *metadata, phar_entry_info *entry, char **error TSRMLS_DC) /* {{{ */
+int phar_tar_setmetadata(zval *metadata, phar_entry_info *entry, char **error) /* {{{ */
{
php_serialize_data_t metadata_hash;
@@ -839,7 +839,7 @@ int phar_tar_setmetadata(zval *metadata, phar_entry_info *entry, char **error TS
entry->metadata_str.s = NULL;
PHP_VAR_SERIALIZE_INIT(metadata_hash);
- php_var_serialize(&entry->metadata_str, metadata, &metadata_hash TSRMLS_CC);
+ php_var_serialize(&entry->metadata_str, metadata, &metadata_hash);
PHP_VAR_SERIALIZE_DESTROY(metadata_hash);
entry->uncompressed_filesize = entry->compressed_filesize = entry->metadata_str.s ? entry->metadata_str.s->len : 0;
@@ -865,7 +865,7 @@ int phar_tar_setmetadata(zval *metadata, phar_entry_info *entry, char **error TS
}
/* }}} */
-static int phar_tar_setupmetadata(zval *zv, void *argument TSRMLS_DC) /* {{{ */
+static int phar_tar_setupmetadata(zval *zv, void *argument) /* {{{ */
{
int lookfor_len;
struct _phar_pass_tar_info *i = (struct _phar_pass_tar_info *)argument;
@@ -874,7 +874,7 @@ static int phar_tar_setupmetadata(zval *zv, void *argument TSRMLS_DC) /* {{{ */
if (entry->filename_len >= sizeof(".phar/.metadata") && !memcmp(entry->filename, ".phar/.metadata", sizeof(".phar/.metadata")-1)) {
if (entry->filename_len == sizeof(".phar/.metadata.bin")-1 && !memcmp(entry->filename, ".phar/.metadata.bin", sizeof(".phar/.metadata.bin")-1)) {
- return phar_tar_setmetadata(&entry->phar->metadata, entry, error TSRMLS_CC);
+ return phar_tar_setmetadata(&entry->phar->metadata, entry, error);
}
/* search for the file this metadata entry references */
if (entry->filename_len >= sizeof(".phar/.metadata/") + sizeof("/.metadata.bin") - 1 && !zend_hash_str_exists(&(entry->phar->manifest), entry->filename + sizeof(".phar/.metadata/") - 1, entry->filename_len - (sizeof("/.metadata.bin") - 1 + sizeof(".phar/.metadata/") - 1))) {
@@ -900,7 +900,7 @@ static int phar_tar_setupmetadata(zval *zv, void *argument TSRMLS_DC) /* {{{ */
if (NULL != (metadata = zend_hash_str_find_ptr(&(entry->phar->manifest), lookfor, lookfor_len))) {
int ret;
- ret = phar_tar_setmetadata(&entry->metadata, metadata, error TSRMLS_CC);
+ ret = phar_tar_setmetadata(&entry->metadata, metadata, error);
efree(lookfor);
return ret;
}
@@ -917,11 +917,11 @@ static int phar_tar_setupmetadata(zval *zv, void *argument TSRMLS_DC) /* {{{ */
return ZEND_HASH_APPLY_STOP;
}
- return phar_tar_setmetadata(&entry->metadata, metadata, error TSRMLS_CC);
+ return phar_tar_setmetadata(&entry->metadata, metadata, error);
}
/* }}} */
-int phar_tar_flush(phar_archive_data *phar, char *user_stub, zend_long len, int defaultstub, char **error TSRMLS_DC) /* {{{ */
+int phar_tar_flush(phar_archive_data *phar, char *user_stub, zend_long len, int defaultstub, char **error) /* {{{ */
{
phar_entry_info entry = {0};
static const char newstub[] = "<?php // tar-based phar archive stub file\n__HALT_COMPILER();";
@@ -1137,7 +1137,7 @@ nostub:
if (Z_TYPE(phar->metadata) != IS_UNDEF) {
phar_entry_info *mentry;
if (NULL != (mentry = zend_hash_str_find_ptr(&(phar->manifest), ".phar/.metadata.bin", sizeof(".phar/.metadata.bin")-1))) {
- if (ZEND_HASH_APPLY_KEEP != phar_tar_setmetadata(&phar->metadata, mentry, error TSRMLS_CC)) {
+ if (ZEND_HASH_APPLY_KEEP != phar_tar_setmetadata(&phar->metadata, mentry, error)) {
if (closeoldfile) {
php_stream_close(oldfile);
}
@@ -1160,7 +1160,7 @@ nostub:
return EOF;
}
- if (ZEND_HASH_APPLY_KEEP != phar_tar_setmetadata(&phar->metadata, mentry, error TSRMLS_CC)) {
+ if (ZEND_HASH_APPLY_KEEP != phar_tar_setmetadata(&phar->metadata, mentry, error)) {
zend_hash_str_del(&(phar->manifest), ".phar/.metadata.bin", sizeof(".phar/.metadata.bin")-1);
if (closeoldfile) {
php_stream_close(oldfile);
@@ -1170,7 +1170,7 @@ nostub:
}
}
- zend_hash_apply_with_argument(&phar->manifest, phar_tar_setupmetadata, (void *) &pass TSRMLS_CC);
+ zend_hash_apply_with_argument(&phar->manifest, phar_tar_setupmetadata, (void *) &pass);
if (error && *error) {
if (closeoldfile) {
@@ -1182,11 +1182,11 @@ nostub:
return EOF;
}
- zend_hash_apply_with_argument(&phar->manifest, phar_tar_writeheaders, (void *) &pass TSRMLS_CC);
+ zend_hash_apply_with_argument(&phar->manifest, phar_tar_writeheaders, (void *) &pass);
/* add signature for executable tars or tars explicitly set with setSignatureAlgorithm */
if (!phar->is_data || phar->sig_flags) {
- if (FAILURE == phar_create_signature(phar, newfile, &signature, &signature_length, error TSRMLS_CC)) {
+ if (FAILURE == phar_create_signature(phar, newfile, &signature, &signature_length, error)) {
if (error) {
char *save = *error;
spprintf(error, 0, "phar error: unable to write signature to tar-based phar: %s", save);
@@ -1236,7 +1236,7 @@ nostub:
efree(signature);
entry.uncompressed_filesize = entry.compressed_filesize = signature_length + 8;
/* throw out return value and write the signature */
- entry.filename_len = phar_tar_writeheaders_int(&entry, (void *)&pass TSRMLS_CC);
+ entry.filename_len = phar_tar_writeheaders_int(&entry, (void *)&pass);
if (error && *error) {
if (closeoldfile) {
@@ -1301,7 +1301,7 @@ nostub:
#define MAX_WBITS 15
#endif
add_assoc_long(&filterparams, "window", MAX_WBITS + 16);
- filter = php_stream_filter_create("zlib.deflate", &filterparams, php_stream_is_persistent(phar->fp) TSRMLS_CC);
+ filter = php_stream_filter_create("zlib.deflate", &filterparams, php_stream_is_persistent(phar->fp));
zval_dtor(&filterparams);
if (!filter) {
@@ -1317,18 +1317,18 @@ nostub:
php_stream_filter_append(&phar->fp->writefilters, filter);
php_stream_copy_to_stream_ex(newfile, phar->fp, PHP_STREAM_COPY_ALL, NULL);
php_stream_filter_flush(filter, 1);
- php_stream_filter_remove(filter, 1 TSRMLS_CC);
+ php_stream_filter_remove(filter, 1);
php_stream_close(phar->fp);
/* use the temp stream as our base */
phar->fp = newfile;
} else if (phar->flags & PHAR_FILE_COMPRESSED_BZ2) {
php_stream_filter *filter;
- filter = php_stream_filter_create("bzip2.compress", NULL, php_stream_is_persistent(phar->fp) TSRMLS_CC);
+ filter = php_stream_filter_create("bzip2.compress", NULL, php_stream_is_persistent(phar->fp));
php_stream_filter_append(&phar->fp->writefilters, filter);
php_stream_copy_to_stream_ex(newfile, phar->fp, PHP_STREAM_COPY_ALL, NULL);
php_stream_filter_flush(filter, 1);
- php_stream_filter_remove(filter, 1 TSRMLS_CC);
+ php_stream_filter_remove(filter, 1);
php_stream_close(phar->fp);
/* use the temp stream as our base */
phar->fp = newfile;
diff --git a/ext/phar/util.c b/ext/phar/util.c
index f131aa99a2..56d168b072 100644
--- a/ext/phar/util.c
+++ b/ext/phar/util.c
@@ -38,11 +38,11 @@
#include <openssl/ssl.h>
#include <openssl/pkcs12.h>
#else
-static int phar_call_openssl_signverify(int is_sign, php_stream *fp, zend_off_t end, char *key, int key_len, char **signature, int *signature_len TSRMLS_DC);
+static int phar_call_openssl_signverify(int is_sign, php_stream *fp, zend_off_t end, char *key, int key_len, char **signature, int *signature_len);
#endif
/* for links to relative location, prepend cwd of the entry */
-static char *phar_get_link_location(phar_entry_info *entry TSRMLS_DC) /* {{{ */
+static char *phar_get_link_location(phar_entry_info *entry) /* {{{ */
{
char *p, *ret = NULL;
if (!entry->link) {
@@ -61,7 +61,7 @@ static char *phar_get_link_location(phar_entry_info *entry TSRMLS_DC) /* {{{ */
}
/* }}} */
-phar_entry_info *phar_get_link_source(phar_entry_info *entry TSRMLS_DC) /* {{{ */
+phar_entry_info *phar_get_link_source(phar_entry_info *entry) /* {{{ */
{
phar_entry_info *link_entry;
char *link;
@@ -70,13 +70,13 @@ phar_entry_info *phar_get_link_source(phar_entry_info *entry TSRMLS_DC) /* {{{ *
return entry;
}
- link = phar_get_link_location(entry TSRMLS_CC);
+ link = phar_get_link_location(entry);
if (NULL != (link_entry = zend_hash_str_find_ptr(&(entry->phar->manifest), entry->link, strlen(entry->link))) ||
NULL != (link_entry = zend_hash_str_find_ptr(&(entry->phar->manifest), link, strlen(link)))) {
if (link != entry->link) {
efree(link);
}
- return phar_get_link_source(link_entry TSRMLS_CC);
+ return phar_get_link_source(link_entry);
} else {
if (link != entry->link) {
efree(link);
@@ -87,24 +87,24 @@ phar_entry_info *phar_get_link_source(phar_entry_info *entry TSRMLS_DC) /* {{{ *
/* }}} */
/* retrieve a phar_entry_info's current file pointer for reading contents */
-php_stream *phar_get_efp(phar_entry_info *entry, int follow_links TSRMLS_DC) /* {{{ */
+php_stream *phar_get_efp(phar_entry_info *entry, int follow_links) /* {{{ */
{
if (follow_links && entry->link) {
- phar_entry_info *link_entry = phar_get_link_source(entry TSRMLS_CC);
+ phar_entry_info *link_entry = phar_get_link_source(entry);
if (link_entry && link_entry != entry) {
- return phar_get_efp(link_entry, 1 TSRMLS_CC);
+ return phar_get_efp(link_entry, 1);
}
}
- if (phar_get_fp_type(entry TSRMLS_CC) == PHAR_FP) {
- if (!phar_get_entrypfp(entry TSRMLS_CC)) {
+ if (phar_get_fp_type(entry) == PHAR_FP) {
+ if (!phar_get_entrypfp(entry)) {
/* re-open just in time for cases where our refcount reached 0 on the phar archive */
- phar_open_archive_fp(entry->phar TSRMLS_CC);
+ phar_open_archive_fp(entry->phar);
}
- return phar_get_entrypfp(entry TSRMLS_CC);
- } else if (phar_get_fp_type(entry TSRMLS_CC) == PHAR_UFP) {
- return phar_get_entrypufp(entry TSRMLS_CC);
+ return phar_get_entrypfp(entry);
+ } else if (phar_get_fp_type(entry) == PHAR_UFP) {
+ return phar_get_entrypufp(entry);
} else if (entry->fp_type == PHAR_MOD) {
return entry->fp;
} else {
@@ -117,9 +117,9 @@ php_stream *phar_get_efp(phar_entry_info *entry, int follow_links TSRMLS_DC) /*
}
/* }}} */
-int phar_seek_efp(phar_entry_info *entry, zend_off_t offset, int whence, zend_off_t position, int follow_links TSRMLS_DC) /* {{{ */
+int phar_seek_efp(phar_entry_info *entry, zend_off_t offset, int whence, zend_off_t position, int follow_links) /* {{{ */
{
- php_stream *fp = phar_get_efp(entry, follow_links TSRMLS_CC);
+ php_stream *fp = phar_get_efp(entry, follow_links);
zend_off_t temp, eoffset;
if (!fp) {
@@ -128,7 +128,7 @@ int phar_seek_efp(phar_entry_info *entry, zend_off_t offset, int whence, zend_of
if (follow_links) {
phar_entry_info *t;
- t = phar_get_link_source(entry TSRMLS_CC);
+ t = phar_get_link_source(entry);
if (t) {
entry = t;
}
@@ -138,7 +138,7 @@ int phar_seek_efp(phar_entry_info *entry, zend_off_t offset, int whence, zend_of
return 0;
}
- eoffset = phar_get_fp_offset(entry TSRMLS_CC);
+ eoffset = phar_get_fp_offset(entry);
switch (whence) {
case SEEK_END:
@@ -167,7 +167,7 @@ int phar_seek_efp(phar_entry_info *entry, zend_off_t offset, int whence, zend_of
/* }}} */
/* mount an absolute path or uri to a path internal to the phar archive */
-int phar_mount_entry(phar_archive_data *phar, char *filename, int filename_len, char *path, int path_len TSRMLS_DC) /* {{{ */
+int phar_mount_entry(phar_archive_data *phar, char *filename, int filename_len, char *path, int path_len) /* {{{ */
{
phar_entry_info entry = {0};
php_stream_statbuf ssb;
@@ -194,7 +194,7 @@ int phar_mount_entry(phar_archive_data *phar, char *filename, int filename_len,
if (is_phar) {
entry.tmp = estrndup(filename, filename_len);
} else {
- entry.tmp = expand_filepath(filename, NULL TSRMLS_CC);
+ entry.tmp = expand_filepath(filename, NULL);
if (!entry.tmp) {
entry.tmp = estrndup(filename, filename_len);
}
@@ -209,7 +209,7 @@ int phar_mount_entry(phar_archive_data *phar, char *filename, int filename_len,
filename = entry.tmp;
/* only check openbasedir for files, not for phar streams */
- if (!is_phar && php_check_open_basedir(filename TSRMLS_CC)) {
+ if (!is_phar && php_check_open_basedir(filename)) {
efree(entry.tmp);
efree(entry.filename);
return FAILURE;
@@ -250,7 +250,7 @@ int phar_mount_entry(phar_archive_data *phar, char *filename, int filename_len,
}
/* }}} */
-char *phar_find_in_include_path(char *filename, int filename_len, phar_archive_data **pphar TSRMLS_DC) /* {{{ */
+char *phar_find_in_include_path(char *filename, int filename_len, phar_archive_data **pphar) /* {{{ */
{
char *path, *fname, *arch, *entry, *ret, *test;
int arch_len, entry_len, fname_len, ret_len;
@@ -262,11 +262,11 @@ char *phar_find_in_include_path(char *filename, int filename_len, phar_archive_d
pphar = &phar;
}
- if (!zend_is_executing(TSRMLS_C) || !PHAR_G(cwd)) {
- return phar_save_resolve_path(filename, filename_len TSRMLS_CC);
+ if (!zend_is_executing() || !PHAR_G(cwd)) {
+ return phar_save_resolve_path(filename, filename_len);
}
- fname = (char*)zend_get_executed_filename(TSRMLS_C);
+ fname = (char*)zend_get_executed_filename();
fname_len = strlen(fname);
if (PHAR_G(last_phar) && !memcmp(fname, "phar://", 7) && fname_len - 7 >= PHAR_G(last_phar_name_len) && !memcmp(fname + 7, PHAR_G(last_phar_name), PHAR_G(last_phar_name_len))) {
@@ -276,8 +276,8 @@ char *phar_find_in_include_path(char *filename, int filename_len, phar_archive_d
goto splitted;
}
- if (fname_len < 7 || memcmp(fname, "phar://", 7) || SUCCESS != phar_split_fname(fname, strlen(fname), &arch, &arch_len, &entry, &entry_len, 1, 0 TSRMLS_CC)) {
- return phar_save_resolve_path(filename, filename_len TSRMLS_CC);
+ if (fname_len < 7 || memcmp(fname, "phar://", 7) || SUCCESS != phar_split_fname(fname, strlen(fname), &arch, &arch_len, &entry, &entry_len, 1, 0)) {
+ return phar_save_resolve_path(filename, filename_len);
}
efree(entry);
@@ -285,9 +285,9 @@ char *phar_find_in_include_path(char *filename, int filename_len, phar_archive_d
if (*filename == '.') {
int try_len;
- if (FAILURE == phar_get_archive(&phar, arch, arch_len, NULL, 0, NULL TSRMLS_CC)) {
+ if (FAILURE == phar_get_archive(&phar, arch, arch_len, NULL, 0, NULL)) {
efree(arch);
- return phar_save_resolve_path(filename, filename_len TSRMLS_CC);
+ return phar_save_resolve_path(filename, filename_len);
}
splitted:
if (pphar) {
@@ -295,7 +295,7 @@ splitted:
}
try_len = filename_len;
- test = phar_fix_filepath(estrndup(filename, filename_len), &try_len, 1 TSRMLS_CC);
+ test = phar_fix_filepath(estrndup(filename, filename_len), &try_len, 1);
if (*test == '/') {
if (zend_hash_str_exists(&(phar->manifest), test + 1, try_len - 1)) {
@@ -317,14 +317,14 @@ splitted:
spprintf(&path, MAXPATHLEN, "phar://%s/%s%c%s", arch, PHAR_G(cwd), DEFAULT_DIR_SEPARATOR, PG(include_path));
efree(arch);
- ret = php_resolve_path(filename, filename_len, path TSRMLS_CC);
+ ret = php_resolve_path(filename, filename_len, path);
efree(path);
if (ret && strlen(ret) > 8 && !strncmp(ret, "phar://", 7)) {
ret_len = strlen(ret);
/* found phar:// */
- if (SUCCESS != phar_split_fname(ret, ret_len, &arch, &arch_len, &entry, &entry_len, 1, 0 TSRMLS_CC)) {
+ if (SUCCESS != phar_split_fname(ret, ret_len, &arch, &arch_len, &entry, &entry_len, 1, 0)) {
return ret;
}
@@ -350,7 +350,7 @@ splitted:
* appended, truncated, or read. For read, if the entry is marked unmodified, it is
* assumed that the file pointer, if present, is opened for reading
*/
-int phar_get_entry_data(phar_entry_data **ret, char *fname, int fname_len, char *path, int path_len, const char *mode, char allow_dir, char **error, int security TSRMLS_DC) /* {{{ */
+int phar_get_entry_data(phar_entry_data **ret, char *fname, int fname_len, char *path, int path_len, const char *mode, char allow_dir, char **error, int security) /* {{{ */
{
phar_archive_data *phar;
phar_entry_info *entry;
@@ -369,7 +369,7 @@ int phar_get_entry_data(phar_entry_data **ret, char *fname, int fname_len, char
*error = NULL;
}
- if (FAILURE == phar_get_archive(&phar, fname, fname_len, NULL, 0, error TSRMLS_CC)) {
+ if (FAILURE == phar_get_archive(&phar, fname, fname_len, NULL, 0, error)) {
return FAILURE;
}
@@ -388,14 +388,14 @@ int phar_get_entry_data(phar_entry_data **ret, char *fname, int fname_len, char
}
really_get_entry:
if (allow_dir) {
- if ((entry = phar_get_entry_info_dir(phar, path, path_len, allow_dir, for_create && !PHAR_G(readonly) && !phar->is_data ? NULL : error, security TSRMLS_CC)) == NULL) {
+ if ((entry = phar_get_entry_info_dir(phar, path, path_len, allow_dir, for_create && !PHAR_G(readonly) && !phar->is_data ? NULL : error, security)) == NULL) {
if (for_create && (!PHAR_G(readonly) || phar->is_data)) {
return SUCCESS;
}
return FAILURE;
}
} else {
- if ((entry = phar_get_entry_info(phar, path, path_len, for_create && !PHAR_G(readonly) && !phar->is_data ? NULL : error, security TSRMLS_CC)) == NULL) {
+ if ((entry = phar_get_entry_info(phar, path, path_len, for_create && !PHAR_G(readonly) && !phar->is_data ? NULL : error, security)) == NULL) {
if (for_create && (!PHAR_G(readonly) || phar->is_data)) {
return SUCCESS;
}
@@ -404,7 +404,7 @@ really_get_entry:
}
if (for_write && phar->is_persistent) {
- if (FAILURE == phar_copy_on_write(&phar TSRMLS_CC)) {
+ if (FAILURE == phar_copy_on_write(&phar)) {
if (error) {
spprintf(error, 4096, "phar error: file \"%s\" in phar \"%s\" cannot be opened for writing, could not make cached phar writeable", path, fname);
}
@@ -455,11 +455,11 @@ really_get_entry:
if (entry->fp_type == PHAR_MOD) {
if (for_trunc) {
- if (FAILURE == phar_create_writeable_entry(phar, entry, error TSRMLS_CC)) {
+ if (FAILURE == phar_create_writeable_entry(phar, entry, error)) {
return FAILURE;
}
} else if (for_append) {
- phar_seek_efp(entry, 0, SEEK_END, 0, 0 TSRMLS_CC);
+ phar_seek_efp(entry, 0, SEEK_END, 0, 0);
}
} else {
if (for_write) {
@@ -470,16 +470,16 @@ really_get_entry:
}
if (for_trunc) {
- if (FAILURE == phar_create_writeable_entry(phar, entry, error TSRMLS_CC)) {
+ if (FAILURE == phar_create_writeable_entry(phar, entry, error)) {
return FAILURE;
}
} else {
- if (FAILURE == phar_separate_entry_fp(entry, error TSRMLS_CC)) {
+ if (FAILURE == phar_separate_entry_fp(entry, error)) {
return FAILURE;
}
}
} else {
- if (FAILURE == phar_open_entry_fp(entry, error, 1 TSRMLS_CC)) {
+ if (FAILURE == phar_open_entry_fp(entry, error, 1)) {
return FAILURE;
}
}
@@ -492,11 +492,11 @@ really_get_entry:
(*ret)->internal_file = entry;
(*ret)->is_zip = entry->is_zip;
(*ret)->is_tar = entry->is_tar;
- (*ret)->fp = phar_get_efp(entry, 1 TSRMLS_CC);
+ (*ret)->fp = phar_get_efp(entry, 1);
if (entry->link) {
- (*ret)->zero = phar_get_fp_offset(phar_get_link_source(entry TSRMLS_CC) TSRMLS_CC);
+ (*ret)->zero = phar_get_fp_offset(phar_get_link_source(entry));
} else {
- (*ret)->zero = phar_get_fp_offset(entry TSRMLS_CC);
+ (*ret)->zero = phar_get_fp_offset(entry);
}
if (!phar->is_persistent) {
@@ -511,7 +511,7 @@ really_get_entry:
/**
* Create a new dummy file slot within a writeable phar for a newly created file
*/
-phar_entry_data *phar_get_or_create_entry_data(char *fname, int fname_len, char *path, int path_len, const char *mode, char allow_dir, char **error, int security TSRMLS_DC) /* {{{ */
+phar_entry_data *phar_get_or_create_entry_data(char *fname, int fname_len, char *path, int path_len, const char *mode, char allow_dir, char **error, int security) /* {{{ */
{
phar_archive_data *phar;
phar_entry_info *entry, etemp;
@@ -525,11 +525,11 @@ phar_entry_data *phar_get_or_create_entry_data(char *fname, int fname_len, char
is_dir = (path_len && path[path_len - 1] == '/') ? 1 : 0;
- if (FAILURE == phar_get_archive(&phar, fname, fname_len, NULL, 0, error TSRMLS_CC)) {
+ if (FAILURE == phar_get_archive(&phar, fname, fname_len, NULL, 0, error)) {
return NULL;
}
- if (FAILURE == phar_get_entry_data(&ret, fname, fname_len, path, path_len, mode, allow_dir, error, security TSRMLS_CC)) {
+ if (FAILURE == phar_get_entry_data(&ret, fname, fname_len, path, path_len, mode, allow_dir, error, security)) {
return NULL;
} else if (ret) {
return ret;
@@ -542,7 +542,7 @@ phar_entry_data *phar_get_or_create_entry_data(char *fname, int fname_len, char
return NULL;
}
- if (phar->is_persistent && FAILURE == phar_copy_on_write(&phar TSRMLS_CC)) {
+ if (phar->is_persistent && FAILURE == phar_copy_on_write(&phar)) {
if (error) {
spprintf(error, 4096, "phar error: file \"%s\" in phar \"%s\" cannot be created, could not make cached phar writeable", path, fname);
}
@@ -579,7 +579,7 @@ phar_entry_data *phar_get_or_create_entry_data(char *fname, int fname_len, char
path_len--;
}
- phar_add_virtual_dirs(phar, path, path_len TSRMLS_CC);
+ phar_add_virtual_dirs(phar, path, path_len);
etemp.is_modified = 1;
etemp.timestamp = time(0);
etemp.is_crc_checked = 1;
@@ -623,19 +623,19 @@ phar_entry_data *phar_get_or_create_entry_data(char *fname, int fname_len, char
/* }}} */
/* initialize a phar_archive_data's read-only fp for existing phar data */
-int phar_open_archive_fp(phar_archive_data *phar TSRMLS_DC) /* {{{ */
+int phar_open_archive_fp(phar_archive_data *phar) /* {{{ */
{
- if (phar_get_pharfp(phar TSRMLS_CC)) {
+ if (phar_get_pharfp(phar)) {
return SUCCESS;
}
- if (php_check_open_basedir(phar->fname TSRMLS_CC)) {
+ if (php_check_open_basedir(phar->fname)) {
return FAILURE;
}
- phar_set_pharfp(phar, php_stream_open_wrapper(phar->fname, "rb", IGNORE_URL|STREAM_MUST_SEEK|0, NULL) TSRMLS_CC);
+ phar_set_pharfp(phar, php_stream_open_wrapper(phar->fname, "rb", IGNORE_URL|STREAM_MUST_SEEK|0, NULL));
- if (!phar_get_pharfp(phar TSRMLS_CC)) {
+ if (!phar_get_pharfp(phar)) {
return FAILURE;
}
@@ -644,11 +644,11 @@ int phar_open_archive_fp(phar_archive_data *phar TSRMLS_DC) /* {{{ */
/* }}} */
/* copy file data from an existing to a new phar_entry_info that is not in the manifest */
-int phar_copy_entry_fp(phar_entry_info *source, phar_entry_info *dest, char **error TSRMLS_DC) /* {{{ */
+int phar_copy_entry_fp(phar_entry_info *source, phar_entry_info *dest, char **error) /* {{{ */
{
phar_entry_info *link;
- if (FAILURE == phar_open_entry_fp(source, error, 1 TSRMLS_CC)) {
+ if (FAILURE == phar_open_entry_fp(source, error, 1)) {
return FAILURE;
}
@@ -666,14 +666,14 @@ int phar_copy_entry_fp(phar_entry_info *source, phar_entry_info *dest, char **er
spprintf(error, 0, "phar error: unable to create temporary file");
return EOF;
}
- phar_seek_efp(source, 0, SEEK_SET, 0, 1 TSRMLS_CC);
- link = phar_get_link_source(source TSRMLS_CC);
+ phar_seek_efp(source, 0, SEEK_SET, 0, 1);
+ link = phar_get_link_source(source);
if (!link) {
link = source;
}
- if (SUCCESS != php_stream_copy_to_stream_ex(phar_get_efp(link, 0 TSRMLS_CC), dest->fp, link->uncompressed_filesize, NULL)) {
+ if (SUCCESS != php_stream_copy_to_stream_ex(phar_get_efp(link, 0), dest->fp, link->uncompressed_filesize, NULL)) {
php_stream_close(dest->fp);
dest->fp_type = PHAR_FP;
if (error) {
@@ -688,7 +688,7 @@ int phar_copy_entry_fp(phar_entry_info *source, phar_entry_info *dest, char **er
/* open and decompress a compressed phar entry
*/
-int phar_open_entry_fp(phar_entry_info *entry, char **error, int follow_links TSRMLS_DC) /* {{{ */
+int phar_open_entry_fp(phar_entry_info *entry, char **error, int follow_links) /* {{{ */
{
php_stream_filter *filter;
phar_archive_data *phar = entry->phar;
@@ -698,9 +698,9 @@ int phar_open_entry_fp(phar_entry_info *entry, char **error, int follow_links TS
phar_entry_data dummy;
if (follow_links && entry->link) {
- phar_entry_info *link_entry = phar_get_link_source(entry TSRMLS_CC);
+ phar_entry_info *link_entry = phar_get_link_source(entry);
if (link_entry && link_entry != entry) {
- return phar_open_entry_fp(link_entry, error, 1 TSRMLS_CC);
+ return phar_open_entry_fp(link_entry, error, 1);
}
}
@@ -720,8 +720,8 @@ int phar_open_entry_fp(phar_entry_info *entry, char **error, int follow_links TS
return SUCCESS;
}
- if (!phar_get_pharfp(phar TSRMLS_CC)) {
- if (FAILURE == phar_open_archive_fp(phar TSRMLS_CC)) {
+ if (!phar_get_pharfp(phar)) {
+ if (FAILURE == phar_open_archive_fp(phar)) {
spprintf(error, 4096, "phar error: Cannot open phar archive \"%s\" for reading", phar->fname);
return FAILURE;
}
@@ -731,16 +731,16 @@ int phar_open_entry_fp(phar_entry_info *entry, char **error, int follow_links TS
dummy.internal_file = entry;
dummy.phar = phar;
dummy.zero = entry->offset;
- dummy.fp = phar_get_pharfp(phar TSRMLS_CC);
- if (FAILURE == phar_postprocess_file(&dummy, entry->crc32, error, 1 TSRMLS_CC)) {
+ dummy.fp = phar_get_pharfp(phar);
+ if (FAILURE == phar_postprocess_file(&dummy, entry->crc32, error, 1)) {
return FAILURE;
}
return SUCCESS;
}
- if (!phar_get_entrypufp(entry TSRMLS_CC)) {
- phar_set_entrypufp(entry, php_stream_fopen_tmpfile() TSRMLS_CC);
- if (!phar_get_entrypufp(entry TSRMLS_CC)) {
+ if (!phar_get_entrypufp(entry)) {
+ phar_set_entrypufp(entry, php_stream_fopen_tmpfile());
+ if (!phar_get_entrypufp(entry)) {
spprintf(error, 4096, "phar error: Cannot open temporary file for decompressing phar archive \"%s\" file \"%s\"", phar->fname, entry->filename);
return FAILURE;
}
@@ -749,15 +749,15 @@ int phar_open_entry_fp(phar_entry_info *entry, char **error, int follow_links TS
dummy.internal_file = entry;
dummy.phar = phar;
dummy.zero = entry->offset;
- dummy.fp = phar_get_pharfp(phar TSRMLS_CC);
- if (FAILURE == phar_postprocess_file(&dummy, entry->crc32, error, 1 TSRMLS_CC)) {
+ dummy.fp = phar_get_pharfp(phar);
+ if (FAILURE == phar_postprocess_file(&dummy, entry->crc32, error, 1)) {
return FAILURE;
}
- ufp = phar_get_entrypufp(entry TSRMLS_CC);
+ ufp = phar_get_entrypufp(entry);
if ((filtername = phar_decompress_filter(entry, 0)) != NULL) {
- filter = php_stream_filter_create(filtername, NULL, 0 TSRMLS_CC);
+ filter = php_stream_filter_create(filtername, NULL, 0);
} else {
filter = NULL;
}
@@ -772,19 +772,19 @@ int phar_open_entry_fp(phar_entry_info *entry, char **error, int follow_links TS
php_stream_seek(ufp, 0, SEEK_END);
loc = php_stream_tell(ufp);
php_stream_filter_append(&ufp->writefilters, filter);
- php_stream_seek(phar_get_entrypfp(entry TSRMLS_CC), phar_get_fp_offset(entry TSRMLS_CC), SEEK_SET);
+ php_stream_seek(phar_get_entrypfp(entry), phar_get_fp_offset(entry), SEEK_SET);
if (entry->uncompressed_filesize) {
- if (SUCCESS != php_stream_copy_to_stream_ex(phar_get_entrypfp(entry TSRMLS_CC), ufp, entry->compressed_filesize, NULL)) {
+ if (SUCCESS != php_stream_copy_to_stream_ex(phar_get_entrypfp(entry), ufp, entry->compressed_filesize, NULL)) {
spprintf(error, 4096, "phar error: internal corruption of phar \"%s\" (actual filesize mismatch on file \"%s\")", phar->fname, entry->filename);
- php_stream_filter_remove(filter, 1 TSRMLS_CC);
+ php_stream_filter_remove(filter, 1);
return FAILURE;
}
}
php_stream_filter_flush(filter, 1);
php_stream_flush(ufp);
- php_stream_filter_remove(filter, 1 TSRMLS_CC);
+ php_stream_filter_remove(filter, 1);
if (php_stream_tell(ufp) - loc != (zend_off_t) entry->uncompressed_filesize) {
spprintf(error, 4096, "phar error: internal corruption of phar \"%s\" (actual filesize mismatch on file \"%s\")", phar->fname, entry->filename);
@@ -794,17 +794,17 @@ int phar_open_entry_fp(phar_entry_info *entry, char **error, int follow_links TS
entry->old_flags = entry->flags;
/* this is now the new location of the file contents within this fp */
- phar_set_fp_type(entry, PHAR_UFP, loc TSRMLS_CC);
+ phar_set_fp_type(entry, PHAR_UFP, loc);
dummy.zero = entry->offset;
dummy.fp = ufp;
- if (FAILURE == phar_postprocess_file(&dummy, entry->crc32, error, 0 TSRMLS_CC)) {
+ if (FAILURE == phar_postprocess_file(&dummy, entry->crc32, error, 0)) {
return FAILURE;
}
return SUCCESS;
}
/* }}} */
-int phar_create_writeable_entry(phar_archive_data *phar, phar_entry_info *entry, char **error TSRMLS_DC) /* {{{ */
+int phar_create_writeable_entry(phar_archive_data *phar, phar_entry_info *entry, char **error) /* {{{ */
{
if (entry->fp_type == PHAR_MOD) {
/* already newly created, truncate */
@@ -857,12 +857,12 @@ int phar_create_writeable_entry(phar_archive_data *phar, phar_entry_info *entry,
}
/* }}} */
-int phar_separate_entry_fp(phar_entry_info *entry, char **error TSRMLS_DC) /* {{{ */
+int phar_separate_entry_fp(phar_entry_info *entry, char **error) /* {{{ */
{
php_stream *fp;
phar_entry_info *link;
- if (FAILURE == phar_open_entry_fp(entry, error, 1 TSRMLS_CC)) {
+ if (FAILURE == phar_open_entry_fp(entry, error, 1)) {
return FAILURE;
}
@@ -875,14 +875,14 @@ int phar_separate_entry_fp(phar_entry_info *entry, char **error TSRMLS_DC) /* {{
spprintf(error, 0, "phar error: unable to create temporary file");
return FAILURE;
}
- phar_seek_efp(entry, 0, SEEK_SET, 0, 1 TSRMLS_CC);
- link = phar_get_link_source(entry TSRMLS_CC);
+ phar_seek_efp(entry, 0, SEEK_SET, 0, 1);
+ link = phar_get_link_source(entry);
if (!link) {
link = entry;
}
- if (SUCCESS != php_stream_copy_to_stream_ex(phar_get_efp(link, 0 TSRMLS_CC), fp, link->uncompressed_filesize, NULL)) {
+ if (SUCCESS != php_stream_copy_to_stream_ex(phar_get_efp(link, 0), fp, link->uncompressed_filesize, NULL)) {
if (error) {
spprintf(error, 4096, "phar error: cannot separate entry file \"%s\" contents in phar archive \"%s\" for write access", entry->filename, entry->phar->fname);
}
@@ -906,16 +906,16 @@ int phar_separate_entry_fp(phar_entry_info *entry, char **error TSRMLS_DC) /* {{
/**
* helper function to open an internal file's fp just-in-time
*/
-phar_entry_info * phar_open_jit(phar_archive_data *phar, phar_entry_info *entry, char **error TSRMLS_DC) /* {{{ */
+phar_entry_info * phar_open_jit(phar_archive_data *phar, phar_entry_info *entry, char **error) /* {{{ */
{
if (error) {
*error = NULL;
}
/* seek to start of internal file and read it */
- if (FAILURE == phar_open_entry_fp(entry, error, 1 TSRMLS_CC)) {
+ if (FAILURE == phar_open_entry_fp(entry, error, 1)) {
return NULL;
}
- if (-1 == phar_seek_efp(entry, 0, SEEK_SET, 0, 1 TSRMLS_CC)) {
+ if (-1 == phar_seek_efp(entry, 0, SEEK_SET, 0, 1)) {
spprintf(error, 4096, "phar error: cannot seek to start of file \"%s\" in phar \"%s\"", entry->filename, phar->fname);
return NULL;
}
@@ -923,7 +923,7 @@ phar_entry_info * phar_open_jit(phar_archive_data *phar, phar_entry_info *entry,
}
/* }}} */
-PHP_PHAR_API int phar_resolve_alias(char *alias, int alias_len, char **filename, int *filename_len TSRMLS_DC) /* {{{ */ {
+PHP_PHAR_API int phar_resolve_alias(char *alias, int alias_len, char **filename, int *filename_len) /* {{{ */ {
phar_archive_data *fd_ptr;
if (PHAR_GLOBALS->phar_alias_map.arHash
&& NULL != (fd_ptr = zend_hash_str_find_ptr(&(PHAR_GLOBALS->phar_alias_map), alias, alias_len))) {
@@ -935,7 +935,7 @@ PHP_PHAR_API int phar_resolve_alias(char *alias, int alias_len, char **filename,
}
/* }}} */
-int phar_free_alias(phar_archive_data *phar, char *alias, int alias_len TSRMLS_DC) /* {{{ */
+int phar_free_alias(phar_archive_data *phar, char *alias, int alias_len) /* {{{ */
{
if (phar->refcount || phar->is_persistent) {
return FAILURE;
@@ -958,13 +958,13 @@ int phar_free_alias(phar_archive_data *phar, char *alias, int alias_len TSRMLS_D
* Looks up a phar archive in the filename map, connecting it to the alias
* (if any) or returns null
*/
-int phar_get_archive(phar_archive_data **archive, char *fname, int fname_len, char *alias, int alias_len, char **error TSRMLS_DC) /* {{{ */
+int phar_get_archive(phar_archive_data **archive, char *fname, int fname_len, char *alias, int alias_len, char **error) /* {{{ */
{
phar_archive_data *fd, *fd_ptr;
char *my_realpath, *save;
int save_len;
- phar_request_initialize(TSRMLS_C);
+ phar_request_initialize();
if (error) {
*error = NULL;
@@ -1009,7 +1009,7 @@ alias_success:
if (error) {
spprintf(error, 0, "alias \"%s\" is already used for archive \"%s\" cannot be overloaded with \"%s\"", alias, fd_ptr->fname, fname);
}
- if (SUCCESS == phar_free_alias(fd_ptr, alias, alias_len TSRMLS_CC)) {
+ if (SUCCESS == phar_free_alias(fd_ptr, alias, alias_len)) {
if (error) {
efree(*error);
*error = NULL;
@@ -1116,7 +1116,7 @@ alias_success:
}
/* not found, try converting \ to / */
- my_realpath = expand_filepath(fname, my_realpath TSRMLS_CC);
+ my_realpath = expand_filepath(fname, my_realpath);
if (my_realpath) {
fname_len = strlen(my_realpath);
@@ -1202,9 +1202,9 @@ char * phar_decompress_filter(phar_entry_info * entry, int return_unknown) /* {{
/**
* retrieve information on a file contained within a phar, or null if it ain't there
*/
-phar_entry_info *phar_get_entry_info(phar_archive_data *phar, char *path, int path_len, char **error, int security TSRMLS_DC) /* {{{ */
+phar_entry_info *phar_get_entry_info(phar_archive_data *phar, char *path, int path_len, char **error, int security) /* {{{ */
{
- return phar_get_entry_info_dir(phar, path, path_len, 0, error, security TSRMLS_CC);
+ return phar_get_entry_info_dir(phar, path, path_len, 0, error, security);
}
/* }}} */
/**
@@ -1212,7 +1212,7 @@ phar_entry_info *phar_get_entry_info(phar_archive_data *phar, char *path, int pa
* allow_dir is 0 for none, 1 for both empty directories in the phar and temp directories, and 2 for only
* valid pre-existing empty directory entries
*/
-phar_entry_info *phar_get_entry_info_dir(phar_archive_data *phar, char *path, int path_len, char dir, char **error, int security TSRMLS_DC) /* {{{ */
+phar_entry_info *phar_get_entry_info_dir(phar_archive_data *phar, char *path, int path_len, char dir, char **error, int security) /* {{{ */
{
const char *pcr_error;
phar_entry_info *entry;
@@ -1344,7 +1344,7 @@ phar_entry_info *phar_get_entry_info_dir(phar_archive_data *phar, char *path, in
}
/* mount the file just in time */
- if (SUCCESS != phar_mount_entry(phar, test, test_len, path, path_len TSRMLS_CC)) {
+ if (SUCCESS != phar_mount_entry(phar, test, test_len, path, path_len)) {
efree(test);
if (error) {
spprintf(error, 4096, "phar error: path \"%s\" exists as file \"%s\" and could not be mounted", path, test);
@@ -1371,7 +1371,7 @@ phar_entry_info *phar_get_entry_info_dir(phar_archive_data *phar, char *path, in
static const char hexChars[] = "0123456789ABCDEF";
-static int phar_hex_str(const char *digest, size_t digest_len, char **signature TSRMLS_DC) /* {{{ */
+static int phar_hex_str(const char *digest, size_t digest_len, char **signature) /* {{{ */
{
int pos = -1;
size_t len = 0;
@@ -1388,7 +1388,7 @@ static int phar_hex_str(const char *digest, size_t digest_len, char **signature
/* }}} */
#ifndef PHAR_HAVE_OPENSSL
-static int phar_call_openssl_signverify(int is_sign, php_stream *fp, zend_off_t end, char *key, int key_len, char **signature, int *signature_len TSRMLS_DC) /* {{{ */
+static int phar_call_openssl_signverify(int is_sign, php_stream *fp, zend_off_t end, char *key, int key_len, char **signature, int *signature_len) /* {{{ */
{
zend_fcall_info fci;
zend_fcall_info_cache fcc;
@@ -1414,7 +1414,7 @@ static int phar_call_openssl_signverify(int is_sign, php_stream *fp, zend_off_t
return FAILURE;
}
- if (FAILURE == zend_fcall_info_init(&openssl, 0, &fci, &fcc, NULL, NULL TSRMLS_CC)) {
+ if (FAILURE == zend_fcall_info_init(&openssl, 0, &fci, &fcc, NULL, NULL)) {
zval_dtor(&zp[0]);
zval_dtor(&zp[1]);
zval_dtor(&zp[2]);
@@ -1434,7 +1434,7 @@ static int phar_call_openssl_signverify(int is_sign, php_stream *fp, zend_off_t
fci.retval = &retval;
- if (FAILURE == zend_call_function(&fci, &fcc TSRMLS_CC)) {
+ if (FAILURE == zend_call_function(&fci, &fcc)) {
zval_dtor(&zp[0]);
zval_dtor(&zp[1]);
zval_dtor(&zp[2]);
@@ -1476,7 +1476,7 @@ static int phar_call_openssl_signverify(int is_sign, php_stream *fp, zend_off_t
/* }}} */
#endif /* #ifndef PHAR_HAVE_OPENSSL */
-int phar_verify_signature(php_stream *fp, size_t end_of_phar, php_uint32 sig_type, char *sig, int sig_len, char *fname, char **signature, int *signature_len, char **error TSRMLS_DC) /* {{{ */
+int phar_verify_signature(php_stream *fp, size_t end_of_phar, php_uint32 sig_type, char *sig, int sig_len, char *fname, char **signature, int *signature_len, char **error) /* {{{ */
{
int read_size, len;
zend_off_t read_len;
@@ -1524,7 +1524,7 @@ int phar_verify_signature(php_stream *fp, size_t end_of_phar, php_uint32 sig_typ
#ifndef PHAR_HAVE_OPENSSL
tempsig = sig_len;
- if (FAILURE == phar_call_openssl_signverify(0, fp, end_of_phar, pubkey ? pubkey->val : NULL, pubkey ? pubkey->len : 0, &sig, &tempsig TSRMLS_CC)) {
+ if (FAILURE == phar_call_openssl_signverify(0, fp, end_of_phar, pubkey ? pubkey->val : NULL, pubkey ? pubkey->len : 0, &sig, &tempsig)) {
if (pubkey) {
zend_string_release(pubkey);
}
@@ -1597,7 +1597,7 @@ int phar_verify_signature(php_stream *fp, size_t end_of_phar, php_uint32 sig_typ
EVP_MD_CTX_cleanup(&md_ctx);
#endif
- *signature_len = phar_hex_str((const char*)sig, sig_len, signature TSRMLS_CC);
+ *signature_len = phar_hex_str((const char*)sig, sig_len, signature);
}
break;
#ifdef PHAR_HASH_OK
@@ -1631,7 +1631,7 @@ int phar_verify_signature(php_stream *fp, size_t end_of_phar, php_uint32 sig_typ
return FAILURE;
}
- *signature_len = phar_hex_str((const char*)digest, sizeof(digest), signature TSRMLS_CC);
+ *signature_len = phar_hex_str((const char*)digest, sizeof(digest), signature);
break;
}
case PHAR_SIG_SHA256: {
@@ -1664,7 +1664,7 @@ int phar_verify_signature(php_stream *fp, size_t end_of_phar, php_uint32 sig_typ
return FAILURE;
}
- *signature_len = phar_hex_str((const char*)digest, sizeof(digest), signature TSRMLS_CC);
+ *signature_len = phar_hex_str((const char*)digest, sizeof(digest), signature);
break;
}
#else
@@ -1705,7 +1705,7 @@ int phar_verify_signature(php_stream *fp, size_t end_of_phar, php_uint32 sig_typ
return FAILURE;
}
- *signature_len = phar_hex_str((const char*)digest, sizeof(digest), signature TSRMLS_CC);
+ *signature_len = phar_hex_str((const char*)digest, sizeof(digest), signature);
break;
}
case PHAR_SIG_MD5: {
@@ -1738,7 +1738,7 @@ int phar_verify_signature(php_stream *fp, size_t end_of_phar, php_uint32 sig_typ
return FAILURE;
}
- *signature_len = phar_hex_str((const char*)digest, sizeof(digest), signature TSRMLS_CC);
+ *signature_len = phar_hex_str((const char*)digest, sizeof(digest), signature);
break;
}
default:
@@ -1751,7 +1751,7 @@ int phar_verify_signature(php_stream *fp, size_t end_of_phar, php_uint32 sig_typ
}
/* }}} */
-int phar_create_signature(phar_archive_data *phar, php_stream *fp, char **signature, int *signature_length, char **error TSRMLS_DC) /* {{{ */
+int phar_create_signature(phar_archive_data *phar, php_stream *fp, char **signature, int *signature_length, char **error) /* {{{ */
{
unsigned char buf[1024];
int sig_len;
@@ -1869,7 +1869,7 @@ int phar_create_signature(phar_archive_data *phar, php_stream *fp, char **signat
siglen = 0;
php_stream_seek(fp, 0, SEEK_END);
- if (FAILURE == phar_call_openssl_signverify(1, fp, php_stream_tell(fp), PHAR_G(openssl_privatekey), PHAR_G(openssl_privatekey_len), (char **)&sigbuf, &siglen TSRMLS_CC)) {
+ if (FAILURE == phar_call_openssl_signverify(1, fp, php_stream_tell(fp), PHAR_G(openssl_privatekey), PHAR_G(openssl_privatekey_len), (char **)&sigbuf, &siglen)) {
if (error) {
spprintf(error, 0, "unable to write phar \"%s\" with requested openssl signature", phar->fname);
}
@@ -1914,12 +1914,12 @@ int phar_create_signature(phar_archive_data *phar, php_stream *fp, char **signat
}
}
- phar->sig_len = phar_hex_str((const char *)*signature, *signature_length, &phar->signature TSRMLS_CC);
+ phar->sig_len = phar_hex_str((const char *)*signature, *signature_length, &phar->signature);
return SUCCESS;
}
/* }}} */
-void phar_add_virtual_dirs(phar_archive_data *phar, char *filename, int filename_len TSRMLS_DC) /* {{{ */
+void phar_add_virtual_dirs(phar_archive_data *phar, char *filename, int filename_len) /* {{{ */
{
const char *s;
@@ -1932,7 +1932,7 @@ void phar_add_virtual_dirs(phar_archive_data *phar, char *filename, int filename
}
/* }}} */
-static int phar_update_cached_entry(zval *data, void *argument TSRMLS_DC) /* {{{ */
+static int phar_update_cached_entry(zval *data, void *argument) /* {{{ */
{
phar_entry_info *entry = (phar_entry_info *)Z_PTR_P(data);
@@ -1954,7 +1954,7 @@ static int phar_update_cached_entry(zval *data, void *argument TSRMLS_DC) /* {{{
if (entry->metadata_len) {
char *buf = estrndup((char *) Z_PTR(entry->metadata), entry->metadata_len);
/* assume success, we would have failed before */
- phar_parse_metadata((char **) &buf, &entry->metadata, entry->metadata_len TSRMLS_CC);
+ phar_parse_metadata((char **) &buf, &entry->metadata, entry->metadata_len);
efree(buf);
} else {
zval_copy_ctor(&entry->metadata);
@@ -1973,7 +1973,7 @@ static void phar_manifest_copy_ctor(zval *zv) /* {{{ */
}
/* }}} */
-static void phar_copy_cached_phar(phar_archive_data **pphar TSRMLS_DC) /* {{{ */
+static void phar_copy_cached_phar(phar_archive_data **pphar) /* {{{ */
{
phar_archive_data *phar;
HashTable newmanifest;
@@ -1999,7 +1999,7 @@ static void phar_copy_cached_phar(phar_archive_data **pphar TSRMLS_DC) /* {{{ */
/* assume success, we would have failed before */
if (phar->metadata_len) {
char *buf = estrndup((char *) Z_PTR(phar->metadata), phar->metadata_len);
- phar_parse_metadata(&buf, &phar->metadata, phar->metadata_len TSRMLS_CC);
+ phar_parse_metadata(&buf, &phar->metadata, phar->metadata_len);
efree(buf);
} else {
zval_copy_ctor(&phar->metadata);
@@ -2009,7 +2009,7 @@ static void phar_copy_cached_phar(phar_archive_data **pphar TSRMLS_DC) /* {{{ */
zend_hash_init(&newmanifest, sizeof(phar_entry_info),
zend_get_hash_value, destroy_phar_manifest_entry, 0);
zend_hash_copy(&newmanifest, &(*pphar)->manifest, phar_manifest_copy_ctor);
- zend_hash_apply_with_argument(&newmanifest, phar_update_cached_entry, (void *)phar TSRMLS_CC);
+ zend_hash_apply_with_argument(&newmanifest, phar_update_cached_entry, (void *)phar);
phar->manifest = newmanifest;
zend_hash_init(&phar->mounted_dirs, sizeof(char *),
zend_get_hash_value, NULL, 0);
@@ -2027,7 +2027,7 @@ static void phar_copy_cached_phar(phar_archive_data **pphar TSRMLS_DC) /* {{{ */
}
/* }}} */
-int phar_copy_on_write(phar_archive_data **pphar TSRMLS_DC) /* {{{ */
+int phar_copy_on_write(phar_archive_data **pphar) /* {{{ */
{
zval zv, *pzv;
phar_archive_data *newpphar;
@@ -2037,7 +2037,7 @@ int phar_copy_on_write(phar_archive_data **pphar TSRMLS_DC) /* {{{ */
return FAILURE;
}
- phar_copy_cached_phar((phar_archive_data **)&Z_PTR_P(pzv) TSRMLS_CC);
+ phar_copy_cached_phar((phar_archive_data **)&Z_PTR_P(pzv));
newpphar = Z_PTR_P(pzv);
/* invalidate phar cache */
PHAR_G(last_phar) = NULL;
diff --git a/ext/phar/zip.c b/ext/phar/zip.c
index 4fe0bf05c8..d5316452ab 100644
--- a/ext/phar/zip.c
+++ b/ext/phar/zip.c
@@ -39,7 +39,7 @@ static inline void phar_write_16(char buffer[2], php_uint32 value)
# define PHAR_SET_32(var, value) phar_write_32(var, (php_uint32) (value));
# define PHAR_SET_16(var, value) phar_write_16(var, (php_uint16) (value));
-static int phar_zip_process_extra(php_stream *fp, phar_entry_info *entry, php_uint16 len TSRMLS_DC) /* {{{ */
+static int phar_zip_process_extra(php_stream *fp, phar_entry_info *entry, php_uint16 len) /* {{{ */
{
union {
phar_zip_extra_field_header header;
@@ -163,7 +163,7 @@ static void phar_zip_u2d_time(time_t time, char *dtime, char *ddate) /* {{{ */
* This is used by phar_open_from_fp to process a zip-based phar, but can be called
* directly.
*/
-int phar_parse_zipfile(php_stream *fp, char *fname, int fname_len, char *alias, int alias_len, phar_archive_data** pphar, char **error TSRMLS_DC) /* {{{ */
+int phar_parse_zipfile(php_stream *fp, char *fname, int fname_len, char *alias, int alias_len, phar_archive_data** pphar, char **error) /* {{{ */
{
phar_zip_dir_end locator;
char buf[sizeof(locator) + 65536];
@@ -237,7 +237,7 @@ int phar_parse_zipfile(php_stream *fp, char *fname, int fname_len, char *alias,
mydata->metadata_len = PHAR_GET_16(locator.comment_len);
- if (phar_parse_metadata(&metadata, &mydata->metadata, PHAR_GET_16(locator.comment_len) TSRMLS_CC) == FAILURE) {
+ if (phar_parse_metadata(&metadata, &mydata->metadata, PHAR_GET_16(locator.comment_len)) == FAILURE) {
mydata->metadata_len = 0;
/* if not valid serialized data, it is a regular string */
@@ -422,7 +422,7 @@ foundit:
PHAR_ZIP_FAIL("signature cannot be read");
}
mydata->sig_flags = PHAR_GET_32(sig);
- if (FAILURE == phar_verify_signature(sigfile, php_stream_tell(sigfile), mydata->sig_flags, sig + 8, entry.uncompressed_filesize - 8, fname, &mydata->signature, &mydata->sig_len, error TSRMLS_CC)) {
+ if (FAILURE == phar_verify_signature(sigfile, php_stream_tell(sigfile), mydata->sig_flags, sig + 8, entry.uncompressed_filesize - 8, fname, &mydata->signature, &mydata->sig_len, error)) {
efree(sig);
if (error) {
char *save;
@@ -445,11 +445,11 @@ foundit:
continue;
}
- phar_add_virtual_dirs(mydata, entry.filename, entry.filename_len TSRMLS_CC);
+ phar_add_virtual_dirs(mydata, entry.filename, entry.filename_len);
if (PHAR_GET_16(zipentry.extra_len)) {
zend_off_t loc = php_stream_tell(fp);
- if (FAILURE == phar_zip_process_extra(fp, &entry, PHAR_GET_16(zipentry.extra_len) TSRMLS_CC)) {
+ if (FAILURE == phar_zip_process_extra(fp, &entry, PHAR_GET_16(zipentry.extra_len))) {
pefree(entry.filename, entry.is_persistent);
PHAR_ZIP_FAIL("Unable to process extra field header for file in central directory");
}
@@ -525,7 +525,7 @@ foundit:
p = buf;
entry.metadata_len = PHAR_GET_16(zipentry.comment_len);
- if (phar_parse_metadata(&p, &(entry.metadata), PHAR_GET_16(zipentry.comment_len) TSRMLS_CC) == FAILURE) {
+ if (phar_parse_metadata(&p, &(entry.metadata), PHAR_GET_16(zipentry.comment_len)) == FAILURE) {
entry.metadata_len = 0;
/* if not valid serialized data, it is a regular string */
@@ -570,7 +570,7 @@ foundit:
mydata->alias_len = entry.uncompressed_filesize;
if (entry.flags & PHAR_ENT_COMPRESSED_GZ) {
- filter = php_stream_filter_create("zlib.inflate", NULL, php_stream_is_persistent(fp) TSRMLS_CC);
+ filter = php_stream_filter_create("zlib.inflate", NULL, php_stream_is_persistent(fp));
if (!filter) {
pefree(entry.filename, entry.is_persistent);
@@ -599,10 +599,10 @@ foundit:
}
php_stream_filter_flush(filter, 1);
- php_stream_filter_remove(filter, 1 TSRMLS_CC);
+ php_stream_filter_remove(filter, 1);
} else if (entry.flags & PHAR_ENT_COMPRESSED_BZ2) {
- filter = php_stream_filter_create("bzip2.decompress", NULL, php_stream_is_persistent(fp) TSRMLS_CC);
+ filter = php_stream_filter_create("bzip2.decompress", NULL, php_stream_is_persistent(fp));
if (!filter) {
pefree(entry.filename, entry.is_persistent);
@@ -631,7 +631,7 @@ foundit:
}
php_stream_filter_flush(filter, 1);
- php_stream_filter_remove(filter, 1 TSRMLS_CC);
+ php_stream_filter_remove(filter, 1);
} else {
// TODO: refactor to avoid reallocation ???
//??? entry.uncompressed_filesize = php_stream_copy_to_mem(fp, &actual_alias, entry.uncompressed_filesize, 0)
@@ -657,7 +657,7 @@ foundit:
php_stream_seek(fp, saveloc, SEEK_SET);
}
- phar_set_inode(&entry TSRMLS_CC);
+ phar_set_inode(&entry);
zend_hash_str_add_mem(&mydata->manifest, entry.filename, entry.filename_len, (void *)&entry, sizeof(phar_entry_info));
}
@@ -686,7 +686,7 @@ foundit:
mydata->is_temporary_alias = 0;
if (NULL != (fd_ptr = zend_hash_str_find_ptr(&(PHAR_GLOBALS->phar_alias_map), actual_alias, mydata->alias_len))) {
- if (SUCCESS != phar_free_alias(fd_ptr, actual_alias, mydata->alias_len TSRMLS_CC)) {
+ if (SUCCESS != phar_free_alias(fd_ptr, actual_alias, mydata->alias_len)) {
if (error) {
spprintf(error, 4096, "phar error: Unable to add zip-based phar \"%s\" with implicit alias, alias is already in use", fname);
}
@@ -708,7 +708,7 @@ foundit:
if (alias_len) {
if (NULL != (fd_ptr = zend_hash_str_find_ptr(&(PHAR_GLOBALS->phar_alias_map), alias, alias_len))) {
- if (SUCCESS != phar_free_alias(fd_ptr, alias, alias_len TSRMLS_CC)) {
+ if (SUCCESS != phar_free_alias(fd_ptr, alias, alias_len)) {
if (error) {
spprintf(error, 4096, "phar error: Unable to add zip-based phar \"%s\" with explicit alias, alias is already in use", fname);
}
@@ -739,10 +739,10 @@ foundit:
/**
* Create or open a zip-based phar for writing
*/
-int phar_open_or_create_zip(char *fname, int fname_len, char *alias, int alias_len, int is_data, int options, phar_archive_data** pphar, char **error TSRMLS_DC) /* {{{ */
+int phar_open_or_create_zip(char *fname, int fname_len, char *alias, int alias_len, int is_data, int options, phar_archive_data** pphar, char **error) /* {{{ */
{
phar_archive_data *phar;
- int ret = phar_create_or_parse_filename(fname, fname_len, alias, alias_len, is_data, options, &phar, error TSRMLS_CC);
+ int ret = phar_create_or_parse_filename(fname, fname_len, alias, alias_len, is_data, options, &phar, error);
if (FAILURE == ret) {
return FAILURE;
@@ -783,7 +783,7 @@ struct _phar_zip_pass {
char **error;
};
/* perform final modification of zip contents for each file in the manifest before saving */
-static int phar_zip_changed_apply_int(phar_entry_info *entry, void *arg TSRMLS_DC) /* {{{ */
+static int phar_zip_changed_apply_int(phar_entry_info *entry, void *arg) /* {{{ */
{
phar_zip_file_header local;
phar_zip_unix3 perms;
@@ -807,7 +807,7 @@ static int phar_zip_changed_apply_int(phar_entry_info *entry, void *arg TSRMLS_D
}
}
- phar_add_virtual_dirs(entry->phar, entry->filename, entry->filename_len TSRMLS_CC);
+ phar_add_virtual_dirs(entry->phar, entry->filename, entry->filename_len);
memset(&local, 0, sizeof(local));
memset(&central, 0, sizeof(central));
memset(&perms, 0, sizeof(perms));
@@ -860,7 +860,7 @@ static int phar_zip_changed_apply_int(phar_entry_info *entry, void *arg TSRMLS_D
goto continue_dir;
}
- if (FAILURE == phar_open_entry_fp(entry, p->error, 0 TSRMLS_CC)) {
+ if (FAILURE == phar_open_entry_fp(entry, p->error, 0)) {
spprintf(p->error, 0, "unable to open file contents of file \"%s\" in zip-based phar \"%s\"", entry->filename, entry->phar->fname);
return ZEND_HASH_APPLY_STOP;
}
@@ -871,12 +871,12 @@ static int phar_zip_changed_apply_int(phar_entry_info *entry, void *arg TSRMLS_D
goto is_compressed;
}
- if (-1 == phar_seek_efp(entry, 0, SEEK_SET, 0, 0 TSRMLS_CC)) {
+ if (-1 == phar_seek_efp(entry, 0, SEEK_SET, 0, 0)) {
spprintf(p->error, 0, "unable to seek to start of file \"%s\" to zip-based phar \"%s\"", entry->filename, entry->phar->fname);
return ZEND_HASH_APPLY_STOP;
}
- efp = phar_get_efp(entry, 0 TSRMLS_CC);
+ efp = phar_get_efp(entry, 0);
newcrc32 = ~0;
for (loc = 0;loc < entry->uncompressed_filesize; ++loc) {
@@ -895,7 +895,7 @@ static int phar_zip_changed_apply_int(phar_entry_info *entry, void *arg TSRMLS_D
goto not_compressed;
}
- filter = php_stream_filter_create(phar_compress_filter(entry, 0), NULL, 0 TSRMLS_CC);
+ filter = php_stream_filter_create(phar_compress_filter(entry, 0), NULL, 0);
if (!filter) {
if (entry->flags & PHAR_ENT_COMPRESSED_GZ) {
@@ -918,7 +918,7 @@ static int phar_zip_changed_apply_int(phar_entry_info *entry, void *arg TSRMLS_D
php_stream_flush(efp);
- if (-1 == phar_seek_efp(entry, 0, SEEK_SET, 0, 0 TSRMLS_CC)) {
+ if (-1 == phar_seek_efp(entry, 0, SEEK_SET, 0, 0)) {
spprintf(p->error, 0, "unable to seek to start of file \"%s\" to zip-based phar \"%s\"", entry->filename, entry->phar->fname);
return ZEND_HASH_APPLY_STOP;
}
@@ -932,7 +932,7 @@ static int phar_zip_changed_apply_int(phar_entry_info *entry, void *arg TSRMLS_D
php_stream_filter_flush(filter, 1);
php_stream_flush(entry->cfp);
- php_stream_filter_remove(filter, 1 TSRMLS_CC);
+ php_stream_filter_remove(filter, 1);
php_stream_seek(entry->cfp, 0, SEEK_END);
entry->compressed_filesize = (php_uint32) php_stream_tell(entry->cfp);
PHAR_SET_32(central.compsize, entry->compressed_filesize);
@@ -967,7 +967,7 @@ continue_dir:
}
entry->metadata_str.s = NULL;
PHP_VAR_SERIALIZE_INIT(metadata_hash);
- php_var_serialize(&entry->metadata_str, &entry->metadata, &metadata_hash TSRMLS_CC);
+ php_var_serialize(&entry->metadata_str, &entry->metadata, &metadata_hash);
PHP_VAR_SERIALIZE_DESTROY(metadata_hash);
PHAR_SET_16(central.comment_len, entry->metadata_str.s->len);
}
@@ -1037,13 +1037,13 @@ continue_dir:
php_stream_close(entry->cfp);
entry->cfp = NULL;
} else {
- if (FAILURE == phar_open_entry_fp(entry, p->error, 0 TSRMLS_CC)) {
+ if (FAILURE == phar_open_entry_fp(entry, p->error, 0)) {
return ZEND_HASH_APPLY_STOP;
}
- phar_seek_efp(entry, 0, SEEK_SET, 0, 0 TSRMLS_CC);
+ phar_seek_efp(entry, 0, SEEK_SET, 0, 0);
- if (SUCCESS != php_stream_copy_to_stream_ex(phar_get_efp(entry, 0 TSRMLS_CC), p->filefp, entry->uncompressed_filesize, NULL)) {
+ if (SUCCESS != php_stream_copy_to_stream_ex(phar_get_efp(entry, 0), p->filefp, entry->uncompressed_filesize, NULL)) {
spprintf(p->error, 0, "unable to write contents of file \"%s\" in zip-based phar \"%s\"", entry->filename, entry->phar->fname);
return ZEND_HASH_APPLY_STOP;
}
@@ -1093,14 +1093,14 @@ continue_dir:
}
/* }}} */
-static int phar_zip_changed_apply(zval *zv, void *arg TSRMLS_DC) /* {{{ */
+static int phar_zip_changed_apply(zval *zv, void *arg) /* {{{ */
{
- return phar_zip_changed_apply_int(Z_PTR_P(zv), arg TSRMLS_CC);
+ return phar_zip_changed_apply_int(Z_PTR_P(zv), arg);
}
/* }}} */
static int phar_zip_applysignature(phar_archive_data *phar, struct _phar_zip_pass *pass,
- smart_str *metadata TSRMLS_DC) /* {{{ */
+ smart_str *metadata) /* {{{ */
{
/* add signature for executable tars or tars explicitly set with setSignatureAlgorithm */
if (!phar->is_data || phar->sig_flags) {
@@ -1126,7 +1126,7 @@ static int phar_zip_applysignature(phar_archive_data *phar, struct _phar_zip_pas
php_stream_write(newfile, metadata->s->val, metadata->s->len);
}
- if (FAILURE == phar_create_signature(phar, newfile, &signature, &signature_length, pass->error TSRMLS_CC)) {
+ if (FAILURE == phar_create_signature(phar, newfile, &signature, &signature_length, pass->error)) {
if (pass->error) {
char *save = *(pass->error);
spprintf(pass->error, 0, "phar error: unable to write signature to zip-based phar: %s", save);
@@ -1164,7 +1164,7 @@ static int phar_zip_applysignature(phar_archive_data *phar, struct _phar_zip_pas
entry.uncompressed_filesize = entry.compressed_filesize = signature_length + 8;
entry.phar = phar;
/* throw out return value and write the signature */
- phar_zip_changed_apply_int(&entry, (void *)pass TSRMLS_CC);
+ phar_zip_changed_apply_int(&entry, (void *)pass);
php_stream_close(newfile);
if (pass->error && *(pass->error)) {
@@ -1177,7 +1177,7 @@ static int phar_zip_applysignature(phar_archive_data *phar, struct _phar_zip_pas
}
/* }}} */
-int phar_zip_flush(phar_archive_data *phar, char *user_stub, zend_long len, int defaultstub, char **error TSRMLS_DC) /* {{{ */
+int phar_zip_flush(phar_archive_data *phar, char *user_stub, zend_long len, int defaultstub, char **error) /* {{{ */
{
char *pos;
smart_str main_metadata_str = {0};
@@ -1243,7 +1243,7 @@ int phar_zip_flush(phar_archive_data *phar, char *user_stub, zend_long len, int
/* register alias */
if (phar->alias_len) {
- if (FAILURE == phar_get_archive(&phar, phar->fname, phar->fname_len, phar->alias, phar->alias_len, error TSRMLS_CC)) {
+ if (FAILURE == phar_get_archive(&phar, phar->fname, phar->fname_len, phar->alias, phar->alias_len, error)) {
return EOF;
}
}
@@ -1431,12 +1431,12 @@ fperror:
PHAR_SET_16(eocd.counthere, zend_hash_num_elements(&phar->manifest));
PHAR_SET_16(eocd.count, zend_hash_num_elements(&phar->manifest));
}
- zend_hash_apply_with_argument(&phar->manifest, phar_zip_changed_apply, (void *) &pass TSRMLS_CC);
+ zend_hash_apply_with_argument(&phar->manifest, phar_zip_changed_apply, (void *) &pass);
if (Z_TYPE(phar->metadata) != IS_UNDEF) {
/* set phar metadata */
PHP_VAR_SERIALIZE_INIT(metadata_hash);
- php_var_serialize(&main_metadata_str, &phar->metadata, &metadata_hash TSRMLS_CC);
+ php_var_serialize(&main_metadata_str, &phar->metadata, &metadata_hash);
PHP_VAR_SERIALIZE_DESTROY(metadata_hash);
}
if (temperr) {
@@ -1457,7 +1457,7 @@ nocentralerror:
return EOF;
}
- if (FAILURE == phar_zip_applysignature(phar, &pass, &main_metadata_str TSRMLS_CC)) {
+ if (FAILURE == phar_zip_applysignature(phar, &pass, &main_metadata_str)) {
goto temperror;
}