summaryrefslogtreecommitdiff
path: root/ext/phar/phar.c
diff options
context:
space:
mode:
Diffstat (limited to 'ext/phar/phar.c')
-rw-r--r--ext/phar/phar.c287
1 files changed, 142 insertions, 145 deletions
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);