Lines Matching refs:entry
41 static char *phar_get_link_location(phar_entry_info *entry) /* {{{ */ in phar_get_link_location() argument
44 if (!entry->link) { in phar_get_link_location()
47 if (entry->link[0] == '/') { in phar_get_link_location()
48 return estrdup(entry->link + 1); in phar_get_link_location()
50 p = strrchr(entry->filename, '/'); in phar_get_link_location()
53 spprintf(&ret, 0, "%s/%s", entry->filename, entry->link); in phar_get_link_location()
56 return entry->link; in phar_get_link_location()
60 phar_entry_info *phar_get_link_source(phar_entry_info *entry) /* {{{ */ in phar_get_link_source() argument
65 if (!entry->link) { in phar_get_link_source()
66 return entry; in phar_get_link_source()
69 link = phar_get_link_location(entry); in phar_get_link_source()
70 …if (NULL != (link_entry = zend_hash_str_find_ptr(&(entry->phar->manifest), entry->link, strlen(ent… in phar_get_link_source()
71 NULL != (link_entry = zend_hash_str_find_ptr(&(entry->phar->manifest), link, strlen(link)))) { in phar_get_link_source()
72 if (link != entry->link) { in phar_get_link_source()
77 if (link != entry->link) { in phar_get_link_source()
86 php_stream *phar_get_efp(phar_entry_info *entry, int follow_links) /* {{{ */ in phar_get_efp() argument
88 if (follow_links && entry->link) { in phar_get_efp()
89 phar_entry_info *link_entry = phar_get_link_source(entry); in phar_get_efp()
91 if (link_entry && link_entry != entry) { in phar_get_efp()
96 if (phar_get_fp_type(entry) == PHAR_FP) { in phar_get_efp()
97 if (!phar_get_entrypfp(entry)) { in phar_get_efp()
99 phar_open_archive_fp(entry->phar); in phar_get_efp()
101 return phar_get_entrypfp(entry); in phar_get_efp()
102 } else if (phar_get_fp_type(entry) == PHAR_UFP) { in phar_get_efp()
103 return phar_get_entrypufp(entry); in phar_get_efp()
104 } else if (entry->fp_type == PHAR_MOD) { in phar_get_efp()
105 return entry->fp; in phar_get_efp()
108 if (!entry->fp) { in phar_get_efp()
109 entry->fp = php_stream_open_wrapper(entry->tmp, "rb", STREAM_MUST_SEEK|0, NULL); in phar_get_efp()
111 return entry->fp; in phar_get_efp()
116 int phar_seek_efp(phar_entry_info *entry, zend_off_t offset, int whence, zend_off_t position, int f… in phar_seek_efp() argument
118 php_stream *fp = phar_get_efp(entry, follow_links); in phar_seek_efp()
127 t = phar_get_link_source(entry); in phar_seek_efp()
129 entry = t; in phar_seek_efp()
133 if (entry->is_dir) { in phar_seek_efp()
137 eoffset = phar_get_fp_offset(entry); in phar_seek_efp()
141 temp = eoffset + entry->uncompressed_filesize + offset; in phar_seek_efp()
153 if (temp > eoffset + (zend_off_t) entry->uncompressed_filesize) { in phar_seek_efp()
168 phar_entry_info entry = {0}; in phar_mount_entry() local
184 entry.phar = phar; in phar_mount_entry()
185 entry.filename = estrndup(path, path_len); in phar_mount_entry()
187 phar_unixify_path_separators(entry.filename, path_len); in phar_mount_entry()
189 entry.filename_len = path_len; in phar_mount_entry()
191 entry.tmp = estrndup(filename, filename_len); in phar_mount_entry()
193 entry.tmp = expand_filepath(filename, NULL); in phar_mount_entry()
194 if (!entry.tmp) { in phar_mount_entry()
195 entry.tmp = estrndup(filename, filename_len); in phar_mount_entry()
198 filename = entry.tmp; in phar_mount_entry()
202 efree(entry.tmp); in phar_mount_entry()
203 efree(entry.filename); in phar_mount_entry()
207 entry.is_mounted = 1; in phar_mount_entry()
208 entry.is_crc_checked = 1; in phar_mount_entry()
209 entry.fp_type = PHAR_TMP; in phar_mount_entry()
212 efree(entry.tmp); in phar_mount_entry()
213 efree(entry.filename); in phar_mount_entry()
218 entry.is_dir = 1; in phar_mount_entry()
219 …if (NULL == zend_hash_str_add_ptr(&phar->mounted_dirs, entry.filename, path_len, entry.filename)) { in phar_mount_entry()
221 efree(entry.tmp); in phar_mount_entry()
222 efree(entry.filename); in phar_mount_entry()
226 entry.is_dir = 0; in phar_mount_entry()
227 entry.uncompressed_filesize = entry.compressed_filesize = ssb.sb.st_size; in phar_mount_entry()
230 entry.flags = ssb.sb.st_mode; in phar_mount_entry()
232 …if (NULL != zend_hash_str_add_mem(&phar->manifest, entry.filename, path_len, (void*)&entry, sizeof… in phar_mount_entry()
236 efree(entry.tmp); in phar_mount_entry()
237 efree(entry.filename); in phar_mount_entry()
245 char *path, *fname, *arch, *entry, *test; in phar_find_in_include_path() local
269 …) || SUCCESS != phar_split_fname(fname, strlen(fname), &arch, &arch_len, &entry, &entry_len, 1, 0)… in phar_find_in_include_path()
273 efree(entry); in phar_find_in_include_path()
315 …if (SUCCESS != phar_split_fname(ZSTR_VAL(ret), ZSTR_LEN(ret), &arch, &arch_len, &entry, &entry_len… in phar_find_in_include_path()
326 efree(entry); in phar_find_in_include_path()
344 phar_entry_info *entry; in phar_get_entry_data() local
379 …if ((entry = phar_get_entry_info_dir(phar, path, path_len, allow_dir, for_create && !PHAR_G(readon… in phar_get_entry_data()
386 …if ((entry = phar_get_entry_info(phar, path, path_len, for_create && !PHAR_G(readonly) && !phar->i… in phar_get_entry_data()
405 if (entry->is_modified && !for_write) { in phar_get_entry_data()
412 if (entry->fp_refcount && for_write) { in phar_get_entry_data()
419 if (entry->is_deleted) { in phar_get_entry_data()
423 entry->is_deleted = 0; in phar_get_entry_data()
426 if (entry->is_dir) { in phar_get_entry_data()
432 (*ret)->internal_file = entry; in phar_get_entry_data()
433 (*ret)->is_zip = entry->is_zip; in phar_get_entry_data()
434 (*ret)->is_tar = entry->is_tar; in phar_get_entry_data()
437 ++(entry->phar->refcount); in phar_get_entry_data()
438 ++(entry->fp_refcount); in phar_get_entry_data()
444 if (entry->fp_type == PHAR_MOD) { in phar_get_entry_data()
446 if (FAILURE == phar_create_writeable_entry(phar, entry, error)) { in phar_get_entry_data()
450 phar_seek_efp(entry, 0, SEEK_END, 0, 0); in phar_get_entry_data()
454 if (entry->link) { in phar_get_entry_data()
455 efree(entry->link); in phar_get_entry_data()
456 entry->link = NULL; in phar_get_entry_data()
457 entry->tar_type = (entry->is_tar ? TAR_FILE : '\0'); in phar_get_entry_data()
461 if (FAILURE == phar_create_writeable_entry(phar, entry, error)) { in phar_get_entry_data()
465 if (FAILURE == phar_separate_entry_fp(entry, error)) { in phar_get_entry_data()
470 if (FAILURE == phar_open_entry_fp(entry, error, 1)) { in phar_get_entry_data()
480 (*ret)->internal_file = entry; in phar_get_entry_data()
481 (*ret)->is_zip = entry->is_zip; in phar_get_entry_data()
482 (*ret)->is_tar = entry->is_tar; in phar_get_entry_data()
483 (*ret)->fp = phar_get_efp(entry, 1); in phar_get_entry_data()
484 if (entry->link) { in phar_get_entry_data()
485 phar_entry_info *link = phar_get_link_source(entry); in phar_get_entry_data()
492 (*ret)->zero = phar_get_fp_offset(entry); in phar_get_entry_data()
496 ++(entry->fp_refcount); in phar_get_entry_data()
497 ++(entry->phar->refcount); in phar_get_entry_data()
510 phar_entry_info *entry, etemp; in phar_get_or_create_entry_data() local
588 …if (NULL == (entry = zend_hash_str_add_mem(&phar->manifest, etemp.filename, path_len, (void*)&etem… in phar_get_or_create_entry_data()
598 if (!entry) { in phar_get_or_create_entry_data()
607 ret->fp = entry->fp; in phar_get_or_create_entry_data()
610 ret->is_zip = entry->is_zip; in phar_get_or_create_entry_data()
611 ret->is_tar = entry->is_tar; in phar_get_or_create_entry_data()
612 ret->internal_file = entry; in phar_get_or_create_entry_data()
684 int phar_open_entry_fp(phar_entry_info *entry, char **error, int follow_links) /* {{{ */ in phar_open_entry_fp() argument
687 phar_archive_data *phar = entry->phar; in phar_open_entry_fp()
693 if (follow_links && entry->link) { in phar_open_entry_fp()
694 phar_entry_info *link_entry = phar_get_link_source(entry); in phar_open_entry_fp()
695 if (link_entry && link_entry != entry) { in phar_open_entry_fp()
700 if (entry->is_modified) { in phar_open_entry_fp()
704 if (entry->fp_type == PHAR_TMP) { in phar_open_entry_fp()
705 if (!entry->fp) { in phar_open_entry_fp()
706 entry->fp = php_stream_open_wrapper(entry->tmp, "rb", STREAM_MUST_SEEK|0, NULL); in phar_open_entry_fp()
711 if (entry->fp_type != PHAR_FP) { in phar_open_entry_fp()
723 …if ((entry->old_flags && !(entry->old_flags & PHAR_ENT_COMPRESSION_MASK)) || !(entry->flags & PHAR… in phar_open_entry_fp()
724 dummy.internal_file = entry; in phar_open_entry_fp()
726 dummy.zero = entry->offset; in phar_open_entry_fp()
728 if (FAILURE == phar_postprocess_file(&dummy, entry->crc32, error, 1)) { in phar_open_entry_fp()
734 if (!phar_get_entrypufp(entry)) { in phar_open_entry_fp()
735 phar_set_entrypufp(entry, php_stream_fopen_tmpfile()); in phar_open_entry_fp()
736 if (!phar_get_entrypufp(entry)) { in phar_open_entry_fp()
737 …n temporary file for decompressing phar archive \"%s\" file \"%s\"", phar->fname, entry->filename); in phar_open_entry_fp()
742 dummy.internal_file = entry; in phar_open_entry_fp()
744 dummy.zero = entry->offset; in phar_open_entry_fp()
746 if (FAILURE == phar_postprocess_file(&dummy, entry->crc32, error, 1)) { in phar_open_entry_fp()
750 ufp = phar_get_entrypufp(entry); in phar_open_entry_fp()
752 if ((filtername = phar_decompress_filter(entry, 0)) != NULL) { in phar_open_entry_fp()
759 …while decompressing file \"%s\")", phar->fname, phar_decompress_filter(entry, 1), entry->filename); in phar_open_entry_fp()
768 php_stream_seek(phar_get_entrypfp(entry), phar_get_fp_offset(entry), SEEK_SET); in phar_open_entry_fp()
770 if (entry->uncompressed_filesize) { in phar_open_entry_fp()
771 …if (SUCCESS != php_stream_copy_to_stream_ex(phar_get_entrypfp(entry), ufp, entry->compressed_files… in phar_open_entry_fp()
772 …orruption of phar \"%s\" (actual filesize mismatch on file \"%s\")", phar->fname, entry->filename); in phar_open_entry_fp()
782 if (php_stream_tell(ufp) - loc != (zend_off_t) entry->uncompressed_filesize) { in phar_open_entry_fp()
783 …orruption of phar \"%s\" (actual filesize mismatch on file \"%s\")", phar->fname, entry->filename); in phar_open_entry_fp()
787 entry->old_flags = entry->flags; in phar_open_entry_fp()
790 phar_set_fp_type(entry, PHAR_UFP, loc); in phar_open_entry_fp()
791 dummy.zero = entry->offset; in phar_open_entry_fp()
793 if (FAILURE == phar_postprocess_file(&dummy, entry->crc32, error, 0)) { in phar_open_entry_fp()
800 int phar_create_writeable_entry(phar_archive_data *phar, phar_entry_info *entry, char **error) /* {… in phar_create_writeable_entry() argument
802 if (entry->fp_type == PHAR_MOD) { in phar_create_writeable_entry()
804 php_stream_truncate_set_size(entry->fp, 0); in phar_create_writeable_entry()
806 entry->old_flags = entry->flags; in phar_create_writeable_entry()
807 entry->is_modified = 1; in phar_create_writeable_entry()
810 entry->uncompressed_filesize = 0; in phar_create_writeable_entry()
811 entry->compressed_filesize = 0; in phar_create_writeable_entry()
812 entry->crc32 = 0; in phar_create_writeable_entry()
813 entry->flags = PHAR_ENT_PERM_DEF_FILE; in phar_create_writeable_entry()
814 entry->fp_type = PHAR_MOD; in phar_create_writeable_entry()
815 entry->offset = 0; in phar_create_writeable_entry()
824 if (entry->link) { in phar_create_writeable_entry()
825 efree(entry->link); in phar_create_writeable_entry()
826 entry->link = NULL; in phar_create_writeable_entry()
827 entry->tar_type = (entry->is_tar ? TAR_FILE : '\0'); in phar_create_writeable_entry()
830 entry->fp = php_stream_fopen_tmpfile(); in phar_create_writeable_entry()
832 if (!entry->fp) { in phar_create_writeable_entry()
839 entry->old_flags = entry->flags; in phar_create_writeable_entry()
840 entry->is_modified = 1; in phar_create_writeable_entry()
843 entry->uncompressed_filesize = 0; in phar_create_writeable_entry()
844 entry->compressed_filesize = 0; in phar_create_writeable_entry()
845 entry->crc32 = 0; in phar_create_writeable_entry()
846 entry->flags = PHAR_ENT_PERM_DEF_FILE; in phar_create_writeable_entry()
847 entry->fp_type = PHAR_MOD; in phar_create_writeable_entry()
848 entry->offset = 0; in phar_create_writeable_entry()
853 int phar_separate_entry_fp(phar_entry_info *entry, char **error) /* {{{ */ in phar_separate_entry_fp() argument
858 if (FAILURE == phar_open_entry_fp(entry, error, 1)) { in phar_separate_entry_fp()
862 if (entry->fp_type == PHAR_MOD) { in phar_separate_entry_fp()
871 phar_seek_efp(entry, 0, SEEK_SET, 0, 1); in phar_separate_entry_fp()
872 link = phar_get_link_source(entry); in phar_separate_entry_fp()
875 link = entry; in phar_separate_entry_fp()
880 …y file \"%s\" contents in phar archive \"%s\" for write access", entry->filename, entry->phar->fna… in phar_separate_entry_fp()
885 if (entry->link) { in phar_separate_entry_fp()
886 efree(entry->link); in phar_separate_entry_fp()
887 entry->link = NULL; in phar_separate_entry_fp()
888 entry->tar_type = (entry->is_tar ? TAR_FILE : '\0'); in phar_separate_entry_fp()
891 entry->offset = 0; in phar_separate_entry_fp()
892 entry->fp = fp; in phar_separate_entry_fp()
893 entry->fp_type = PHAR_MOD; in phar_separate_entry_fp()
894 entry->is_modified = 1; in phar_separate_entry_fp()
902 phar_entry_info * phar_open_jit(phar_archive_data *phar, phar_entry_info *entry, char **error) /* {… in phar_open_jit() argument
908 if (FAILURE == phar_open_entry_fp(entry, error, 1)) { in phar_open_jit()
911 if (-1 == phar_seek_efp(entry, 0, SEEK_SET, 0, 1)) { in phar_open_jit()
912 …spprintf(error, 4096, "phar error: cannot seek to start of file \"%s\" in phar \"%s\"", entry->fil… in phar_open_jit()
915 return entry; in phar_open_jit()
1158 char * phar_compress_filter(phar_entry_info * entry, int return_unknown) /* {{{ */ in phar_compress_filter() argument
1160 switch (entry->flags & PHAR_ENT_COMPRESSION_MASK) { in phar_compress_filter()
1174 char * phar_decompress_filter(phar_entry_info * entry, int return_unknown) /* {{{ */ in phar_decompress_filter() argument
1178 if (entry->is_modified) { in phar_decompress_filter()
1179 flags = entry->old_flags; in phar_decompress_filter()
1181 flags = entry->flags; in phar_decompress_filter()
1211 phar_entry_info *entry; in phar_get_entry_info_dir() local
1256 if (NULL != (entry = zend_hash_str_find_ptr(&phar->manifest, path, path_len))) { in phar_get_entry_info_dir()
1257 if (entry->is_deleted) { in phar_get_entry_info_dir()
1261 if (entry->is_dir && !dir) { in phar_get_entry_info_dir()
1267 if (!entry->is_dir && dir == 2) { in phar_get_entry_info_dir()
1274 return entry; in phar_get_entry_info_dir()
1280 entry = (phar_entry_info *) ecalloc(1, sizeof(phar_entry_info)); in phar_get_entry_info_dir()
1282 entry->is_temp_dir = entry->is_dir = 1; in phar_get_entry_info_dir()
1283 entry->filename = (char *) estrndup(path, path_len + 1); in phar_get_entry_info_dir()
1284 entry->filename_len = path_len; in phar_get_entry_info_dir()
1285 entry->phar = phar; in phar_get_entry_info_dir()
1286 return entry; in phar_get_entry_info_dir()
1301 if (NULL == (entry = zend_hash_find_ptr(&phar->manifest, str_key))) { in phar_get_entry_info_dir()
1308 if (!entry->tmp || !entry->is_mounted) { in phar_get_entry_info_dir()
1315 test_len = spprintf(&test, MAXPATHLEN, "%s%s", entry->tmp, path + ZSTR_LEN(str_key)); in phar_get_entry_info_dir()
1350 if (NULL == (entry = zend_hash_str_find_ptr(&phar->manifest, path, path_len))) { in phar_get_entry_info_dir()
1356 return entry; in phar_get_entry_info_dir()
2011 phar_entry_info *entry = (phar_entry_info *)Z_PTR_P(data); in phar_update_cached_entry() local
2013 entry->phar = (phar_archive_data *)argument; in phar_update_cached_entry()
2015 if (entry->link) { in phar_update_cached_entry()
2016 entry->link = estrdup(entry->link); in phar_update_cached_entry()
2019 if (entry->tmp) { in phar_update_cached_entry()
2020 entry->tmp = estrdup(entry->tmp); in phar_update_cached_entry()
2023 entry->filename = estrndup(entry->filename, entry->filename_len); in phar_update_cached_entry()
2024 entry->is_persistent = 0; in phar_update_cached_entry()
2027 phar_metadata_tracker_clone(&entry->metadata_tracker); in phar_update_cached_entry()