if (oldfile && !entry->is_modified) {
continue;
}
- if (!phar_get_efp(entry)) {
+ if (!phar_get_efp(entry TSRMLS_CC)) {
/* re-open internal file pointer just-in-time */
newentry = phar_open_jit(phar, entry, oldfile, error, 0 TSRMLS_CC);
if (!newentry) {
}
entry = newentry;
}
- file = phar_get_efp(entry);
+ file = phar_get_efp(entry TSRMLS_CC);
if (-1 == phar_seek_efp(entry, 0, SEEK_SET, 0 TSRMLS_CC)) {
if (closeoldfile) {
php_stream_close(oldfile);
file = entry->cfp;
php_stream_rewind(file);
} else {
- file = phar_get_efp(entry);
+ file = phar_get_efp(entry TSRMLS_CC);
if (-1 == phar_seek_efp(entry, 0, SEEK_SET, 0 TSRMLS_CC)) {
if (closeoldfile) {
php_stream_close(oldfile);
int phar_parse_metadata(char **buffer, zval **metadata, int is_zip TSRMLS_DC);
void destroy_phar_manifest_entry(void *pDest);
int phar_seek_efp(phar_entry_info *entry, off_t offset, int whence, off_t position TSRMLS_DC);
-php_stream *phar_get_efp(phar_entry_info *entry);
+php_stream *phar_get_efp(phar_entry_info *entry 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 TSRMLS_DC);
int phar_create_writeable_entry(phar_archive_data *phar, phar_entry_info *entry, char **error TSRMLS_DC);
}
/* prepare to output */
- if (!phar_get_efp(phar->internal_file)) {
+ if (!phar_get_efp(phar->internal_file TSRMLS_CC)) {
char *error;
if (!phar_open_jit(phar->phar, phar->internal_file, phar->phar->fp, &error, 0 TSRMLS_CC)) {
if (error) {
}
return -1;
}
- phar->fp = phar_get_efp(phar->internal_file);
+ phar->fp = phar_get_efp(phar->internal_file TSRMLS_CC);
phar->zero = phar->internal_file->offset;
}
phar_seek_efp(phar->internal_file, 0, SEEK_SET, 0 TSRMLS_CC);
/* copy old contents in entirety */
phar_seek_efp(entry, 0, SEEK_SET, 0 TSRMLS_CC);
offset = php_stream_tell(fp);
- if (entry->uncompressed_filesize != php_stream_copy_to_stream(phar_get_efp(entry), fp, entry->uncompressed_filesize)) {
+ if (entry->uncompressed_filesize != php_stream_copy_to_stream(phar_get_efp(entry TSRMLS_CC), fp, entry->uncompressed_filesize)) {
zend_throw_exception_ex(spl_ce_UnexpectedValueException, 0 TSRMLS_CC,
"Cannot convert phar archive \"%s\", unable to copy entry \"%s\" contents", entry->phar->fname, entry->filename);
return FAILURE;
}
return ZEND_HASH_APPLY_STOP;
}
- if (entry->uncompressed_filesize != php_stream_copy_to_stream(phar_get_efp(entry), fp->new, entry->uncompressed_filesize)) {
+ if (entry->uncompressed_filesize != php_stream_copy_to_stream(phar_get_efp(entry TSRMLS_CC), fp->new, entry->uncompressed_filesize)) {
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);
}
#include "phar_internal.h"
/* retrieve a phar_entry_info's current file pointer for reading contents */
-php_stream *phar_get_efp(phar_entry_info *entry)
+php_stream *phar_get_efp(phar_entry_info *entry TSRMLS_DC)
{
- TSRMLS_FETCH();
-
if (entry->fp_type == PHAR_FP) {
if (!entry->phar->fp) {
/* re-open just in time for cases where our refcount reached 0 on the phar archive */
int phar_seek_efp(phar_entry_info *entry, off_t offset, int whence, off_t position TSRMLS_DC)
{
- php_stream *fp = phar_get_efp(entry);
+ php_stream *fp = phar_get_efp(entry TSRMLS_CC);
off_t temp;
if (entry->is_dir) {
(*ret)->internal_file = entry;
(*ret)->is_zip = entry->is_zip;
(*ret)->is_tar = entry->is_tar;
- (*ret)->fp = phar_get_efp(entry);
+ (*ret)->fp = phar_get_efp(entry TSRMLS_CC);
(*ret)->zero = entry->offset;
entry->fp_refcount++;
entry->phar->refcount++;
dest->fp = php_stream_fopen_tmpfile();
phar_seek_efp(source, 0, SEEK_SET, 0 TSRMLS_CC);
- if (source->uncompressed_filesize != php_stream_copy_to_stream(phar_get_efp(source), dest->fp, source->uncompressed_filesize)) {
+ if (source->uncompressed_filesize != php_stream_copy_to_stream(phar_get_efp(source TSRMLS_CC), dest->fp, source->uncompressed_filesize)) {
php_stream_close(dest->fp);
dest->fp_type = PHAR_FP;
if (error) {
fp = php_stream_fopen_tmpfile();
phar_seek_efp(entry, 0, SEEK_SET, 0 TSRMLS_CC);
- if (entry->uncompressed_filesize != php_stream_copy_to_stream(phar_get_efp(entry), fp, entry->uncompressed_filesize)) {
+ if (entry->uncompressed_filesize != php_stream_copy_to_stream(phar_get_efp(entry TSRMLS_CC), fp, entry->uncompressed_filesize)) {
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);
}
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);
+ efp = phar_get_efp(entry TSRMLS_CC);
newcrc32 = ~0;
for (loc = 0;loc < entry->uncompressed_filesize; loc++) {
return ZEND_HASH_APPLY_STOP;
}
phar_seek_efp(entry, 0, SEEK_SET, 0 TSRMLS_CC);
- if (entry->uncompressed_filesize != php_stream_copy_to_stream(phar_get_efp(entry), p->filefp, entry->uncompressed_filesize)) {
+ if (entry->uncompressed_filesize != php_stream_copy_to_stream(phar_get_efp(entry TSRMLS_CC), p->filefp, entry->uncompressed_filesize)) {
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;
}