return 1;
}
/* }}} */
+
+/*
+ * Local variables:
+ * tab-width: 4
+ * c-basic-offset: 4
+ * End:
+ * vim600: noet sw=4 ts=4 fdm=marker
+ * vim<600: noet sw=4 ts=4
+ */
HashTable cached_phars;
HashTable cached_alias;
-static void phar_split_cache_list(TSRMLS_D)
+static void phar_split_cache_list(TSRMLS_D) /* {{{ */
{
char *tmp;
char *key, *lasts, *end;
return phar_create_or_parse_filename(fname, fname_len, alias, alias_len, is_data, options, pphar, error TSRMLS_CC);
}
+/* }}} */
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) /* {{{ */
{
}
/* }}}*/
-static inline char *phar_strnstr(const char *buf, int buf_len, const char *search, int search_len)
+static inline char *phar_strnstr(const char *buf, int buf_len, const char *search, int search_len) /* {{{ */
{
const char *c;
int so_far = 0;
}
} while (1);
}
+/* }}} */
/**
* Scan an open fp for the required __HALT_COMPILER(); ?> token and verify
* 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 TSRMLS_DC) /* {{{ */
{
php_stream_statbuf ssb;
char *realpath, old, *a = (char *)(ext + ext_len);
return FAILURE;
}
}
+/* }}} */
/* 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 TSRMLS_DC) /* {{{ */
{
char test[51];
const char *pos;
}
return FAILURE;
}
+/* }}} */
/*
* if executable is 1, only returns SUCCESS if the extension is one of the tar/zip .phar extensions
}
/* }}} */
-static int php_check_dots(const char *element, int n)
+static int php_check_dots(const char *element, int n) /* {{{ */
{
for(n--; n >= 0; --n) {
if (element[n] != '.') {
}
return 0;
}
+/* }}} */
#define IS_DIRECTORY_UP(element, len) \
(len >= 2 && !php_check_dots(element, len))
#ifdef COMPILE_DL_PHAR
/* stupid-ass non-extern declaration in tsrm_strtok.h breaks dumbass MS compiler */
-static inline int in_character_class(char ch, const char *delim)
+static inline int in_character_class(char ch, const char *delim) /* {{{ */
{
while (*delim) {
if (*delim == ch) {
}
return 0;
}
+/* }}} */
-char *tsrm_strtok_r(char *s, const char *delim, char **last)
+char *tsrm_strtok_r(char *s, const char *delim, char **last) /* {{{ */
{
char *token;
}
return token;
}
+/* }}} */
#endif
/**
#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 TSRMLS_DC) /* {{{ */
{
char *stub = NULL;
int index_len, web_len;
phar_get_stub(index_php, web_index, len, &stub, index_len+1, web_len+1 TSRMLS_CC);
return stub;
}
+/* }}} */
#ifndef PHAR_HAVE_OPENSSL
-static int phar_call_openssl_signverify(int is_sign, php_stream *fp, 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, off_t end, char *key, int key_len, char **signature, int *signature_len TSRMLS_DC) /* {{{ */
{
zend_fcall_info fci;
zend_fcall_info_cache fcc;
return FAILURE;
}
}
+/* }}} */
#endif /* #ifndef PHAR_HAVE_OPENSSL */
/**
#endif /* HAVE_SPL */
}
/* }}} */
+/* }}} */
/* {{{ proto array Phar::getSupportedSignatures()
* Return array of supported signature types
php_stream_close(pass.fp);
}
}
+/* }}} */
/* {{{ proto array Phar::buildFromIterator(Iterator iter[, string base_directory])
* Construct a phar archive from an iterator. The iterator must return a series of strings
}
/* }}} */
-static zval *phar_rename_archive(phar_archive_data *phar, char *ext, zend_bool compress TSRMLS_DC)
+static zval *phar_rename_archive(phar_archive_data *phar, char *ext, zend_bool compress TSRMLS_DC) /* {{{ */
{
char *oldname = NULL, *oldpath = NULL;
char *basename = NULL, *basepath = NULL;
return ret;
}
+/* }}} */
static zval *phar_convert_to_other(phar_archive_data *source, int convert, char *ext, php_uint32 flags TSRMLS_DC) /* {{{ */
{
php_check_open_basedir(filename TSRMLS_CC)
#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 TSRMLS_DC) /* {{{ */
{
php_stream_statbuf ssb;
int len;
efree(fullpath);
return SUCCESS;
}
+/* }}} */
/* {{{ proto bool Phar::extractTo(string pathto[[, mixed files], bool overwrite])
* Extract one or more file from a phar archive, optionally overwriting existing files
return 1;
}
/* }}} */
+
+/*
+ * Local variables:
+ * tab-width: 4
+ * c-basic-offset: 4
+ * End:
+ * vim600: noet sw=4 ts=4 fdm=marker
+ * vim<600: noet sw=4 ts=4
+ */
}
/* }}} */
-int phar_is_tar(char *buf, char *fname)
+int phar_is_tar(char *buf, char *fname) /* {{{ */
{
tar_header *header = (tar_header *) buf;
php_uint32 checksum = phar_tar_number(header->checksum, sizeof(header->checksum));
}
return ret;
}
+/* }}} */
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) /* {{{ */
{
}
return FAILURE;
}
+/* }}} */
-int phar_tar_process_metadata(phar_entry_info *entry, php_stream *fp TSRMLS_DC)
+int phar_tar_process_metadata(phar_entry_info *entry, php_stream *fp TSRMLS_DC) /* {{{ */
{
char *metadata;
size_t save = php_stream_tell(fp), read;
php_stream_seek(fp, save, SEEK_SET);
return SUCCESS;
}
+/* }}} */
int phar_parse_tarfile(php_stream* fp, char *fname, int fname_len, char *alias, int alias_len, int options, phar_archive_data** pphar, php_uint32 compression, char **error TSRMLS_DC) /* {{{ */
{
char **error;
};
-int phar_tar_writeheaders(void *pDest, void *argument TSRMLS_DC)
+int phar_tar_writeheaders(void *pDest, void *argument TSRMLS_DC) /* {{{ */
{
tar_header header;
size_t pos;
entry->offset = entry->offset_abs = pos;
return ZEND_HASH_APPLY_KEEP;
}
+/* }}} */
-int phar_tar_setmetadata(zval *metadata, phar_entry_info *entry, char **error, php_stream *fp TSRMLS_DC)
+int phar_tar_setmetadata(zval *metadata, phar_entry_info *entry, char **error, php_stream *fp TSRMLS_DC) /* {{{ */
{
php_serialize_data_t metadata_hash;
}
return ZEND_HASH_APPLY_KEEP;
}
+/* }}} */
-int phar_tar_setupmetadata(void *pDest, void *argument TSRMLS_DC)
+int phar_tar_setupmetadata(void *pDest, void *argument TSRMLS_DC) /* {{{ */
{
int lookfor_len;
struct _phar_pass_tar_info *i = (struct _phar_pass_tar_info *)argument;
return phar_tar_setmetadata(entry->metadata, metadata, error, fp TSRMLS_CC);
}
+/* }}} */
int phar_tar_flush(phar_archive_data *phar, char *user_stub, long len, int defaultstub, char **error TSRMLS_DC) /* {{{ */
{
return EOF;
}
/* }}} */
+
+/*
+ * Local variables:
+ * tab-width: 4
+ * c-basic-offset: 4
+ * End:
+ * vim600: noet sw=4 ts=4 fdm=marker
+ * vim<600: noet sw=4 ts=4
+ */
#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 TSRMLS_DC) /* {{{ */
{
char *p, *ret = NULL;
if (!entry->link) {
}
return entry->link;
}
+/* }}} */
-phar_entry_info *phar_get_link_source(phar_entry_info *entry TSRMLS_DC)
+phar_entry_info *phar_get_link_source(phar_entry_info *entry TSRMLS_DC) /* {{{ */
{
phar_entry_info *link_entry;
char *link = phar_get_link_location(entry TSRMLS_CC);
return NULL;
}
}
+/* }}} */
/* 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 TSRMLS_DC) /* {{{ */
{
if (follow_links && entry->link) {
phar_entry_info *link_entry = phar_get_link_source(entry TSRMLS_CC);
return entry->fp;
}
}
+/* }}} */
-int phar_seek_efp(phar_entry_info *entry, off_t offset, int whence, off_t position, int follow_links TSRMLS_DC)
+int phar_seek_efp(phar_entry_info *entry, off_t offset, int whence, off_t position, int follow_links TSRMLS_DC) /* {{{ */
{
php_stream *fp = phar_get_efp(entry, follow_links TSRMLS_CC);
off_t temp, eoffset;
}
return php_stream_seek(fp, temp, SEEK_SET);
}
+/* }}} */
/* 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 TSRMLS_DC) /* {{{ */
{
phar_entry_info entry = {0};
php_stream_statbuf ssb;
efree(entry.filename);
return FAILURE;
}
+/* }}} */
char *phar_find_in_include_path(char *filename, int filename_len, phar_archive_data **pphar TSRMLS_DC) /* {{{ */
{
/* }}} */
/* 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 TSRMLS_DC) /* {{{ */
{
if (phar_get_pharfp(phar TSRMLS_CC)) {
return SUCCESS;
}
return SUCCESS;
}
+/* }}} */
/* 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 TSRMLS_DC) /* {{{ */
{
phar_entry_info *link;
}
return SUCCESS;
}
+/* }}} */
/* 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 TSRMLS_DC) /* {{{ */
{
php_stream_filter *filter;
phar_archive_data *phar = entry->phar;
return SUCCESS;
}
+/* }}} */
#if defined(PHP_VERSION_ID) && PHP_VERSION_ID < 50202
typedef struct {
}
/* }}} */
-int phar_separate_entry_fp(phar_entry_info *entry, char **error TSRMLS_DC)
+int phar_separate_entry_fp(phar_entry_info *entry, char **error TSRMLS_DC) /* {{{ */
{
php_stream *fp;
phar_entry_info *link;
entry->is_modified = 1;
return SUCCESS;
}
+/* }}} */
/**
* 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, php_stream *fp,
- char **error, int for_write TSRMLS_DC)
+phar_entry_info * phar_open_jit(phar_archive_data *phar, phar_entry_info *entry, php_stream *fp, char **error, int for_write TSRMLS_DC) /* {{{ */
{
if (error) {
*error = NULL;
}
return entry;
}
+/* }}} */
int phar_free_alias(phar_archive_data *phar, char *alias, int alias_len TSRMLS_DC) /* {{{ */
{
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 TSRMLS_DC) /* {{{ */
{
int pos = -1;
size_t len = 0;
(*signature)[++pos] = '\0';
return pos;
}
+/* }}} */
+
#ifndef PHAR_HAVE_OPENSSL
-static int phar_call_openssl_signverify(int is_sign, php_stream *fp, 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, off_t end, char *key, int key_len, char **signature, int *signature_len TSRMLS_DC) /* {{{ */
{
zend_fcall_info fci;
zend_fcall_info_cache fcc;
return FAILURE;
}
}
+/* }}} */
#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) /* {{{ */
}
}
}
+/* }}} */
static void phar_copy_cached_phar(phar_archive_data **pphar TSRMLS_DC) /* {{{ */
{
return SUCCESS;
}
/* }}} */
+
+/*
+ * Local variables:
+ * tab-width: 4
+ * c-basic-offset: 4
+ * End:
+ * vim600: noet sw=4 ts=4 fdm=marker
+ * vim<600: noet sw=4 ts=4
+ */
# define PHAR_SET_16(buffer) (buffer)
#endif
-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 TSRMLS_DC) /* {{{ */
{
union {
phar_zip_extra_field_header header;
} while (len);
return SUCCESS;
}
+/* }}} */
/*
extracted from libzip
OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN
IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
-static time_t phar_zip_d2u_time(int dtime, int ddate)
+static time_t phar_zip_d2u_time(int dtime, int ddate) /* {{{ */
{
struct tm *tm, tmbuf;
time_t now;
return mktime(tm);
}
+/* }}} */
-static void phar_zip_u2d_time(time_t time, php_uint16 *dtime, php_uint16 *ddate)
+static void phar_zip_u2d_time(time_t time, php_uint16 *dtime, php_uint16 *ddate) /* {{{ */
{
struct tm *tm, tmbuf;
*ddate = ((tm->tm_year+1900-1980)<<9) + ((tm->tm_mon+1)<<5) + tm->tm_mday;
*dtime = ((tm->tm_hour)<<11) + ((tm->tm_min)<<5) + ((tm->tm_sec)>>1);
}
+/* }}} */
/**
* Does not check for a previously opened phar in the cache.
return EOF;
}
/* }}} */
+
+/*
+ * Local variables:
+ * tab-width: 4
+ * c-basic-offset: 4
+ * End:
+ * vim600: noet sw=4 ts=4 fdm=marker
+ * vim<600: noet sw=4 ts=4
+ */