Lines Matching refs:phar

29 ZEND_DECLARE_MODULE_GLOBALS(phar)
40 phar_archive_data *phar = *(phar_archive_data **)pDest; in phar_set_writeable_bit() local
42 if (!phar->is_data) { in phar_set_writeable_bit()
43 phar->is_writeable = !keep; in phar_set_writeable_bit()
107 phar_archive_data *phar; in phar_split_cache_list() local
141 if (SUCCESS == phar_open_from_filename(key, end - key, NULL, 0, 0, &phar, NULL TSRMLS_CC)) { in phar_split_cache_list()
143 phar->phar_pos = i++; in phar_split_cache_list()
144 php_stream_close(phar->fp); in phar_split_cache_list()
145 phar->fp = NULL; in phar_split_cache_list()
164 if (SUCCESS == phar_open_from_filename(key, strlen(key), NULL, 0, 0, &phar, NULL TSRMLS_CC)) { in phar_split_cache_list()
209 void phar_destroy_phar_data(phar_archive_data *phar TSRMLS_DC) /* {{{ */ in PHP_INI_END()
211 if (phar->alias && phar->alias != phar->fname) { in PHP_INI_END()
212 pefree(phar->alias, phar->is_persistent); in PHP_INI_END()
213 phar->alias = NULL; in PHP_INI_END()
216 if (phar->fname) { in PHP_INI_END()
217 pefree(phar->fname, phar->is_persistent); in PHP_INI_END()
218 phar->fname = NULL; in PHP_INI_END()
221 if (phar->signature) { in PHP_INI_END()
222 pefree(phar->signature, phar->is_persistent); in PHP_INI_END()
223 phar->signature = NULL; in PHP_INI_END()
226 if (phar->manifest.arBuckets) { in PHP_INI_END()
227 zend_hash_destroy(&phar->manifest); in PHP_INI_END()
228 phar->manifest.arBuckets = NULL; in PHP_INI_END()
231 if (phar->mounted_dirs.arBuckets) { in PHP_INI_END()
232 zend_hash_destroy(&phar->mounted_dirs); in PHP_INI_END()
233 phar->mounted_dirs.arBuckets = NULL; in PHP_INI_END()
236 if (phar->virtual_dirs.arBuckets) { in PHP_INI_END()
237 zend_hash_destroy(&phar->virtual_dirs); in PHP_INI_END()
238 phar->virtual_dirs.arBuckets = NULL; in PHP_INI_END()
241 if (phar->metadata) { in PHP_INI_END()
242 if (phar->is_persistent) { in PHP_INI_END()
243 if (phar->metadata_len) { in PHP_INI_END()
245 free(phar->metadata); in PHP_INI_END()
247 zval_internal_ptr_dtor(&phar->metadata); in PHP_INI_END()
250 zval_ptr_dtor(&phar->metadata); in PHP_INI_END()
252 phar->metadata_len = 0; in PHP_INI_END()
253 phar->metadata = 0; in PHP_INI_END()
256 if (phar->fp) { in PHP_INI_END()
257 php_stream_close(phar->fp); in PHP_INI_END()
258 phar->fp = 0; in PHP_INI_END()
261 if (phar->ufp) { in PHP_INI_END()
262 php_stream_close(phar->ufp); in PHP_INI_END()
263 phar->ufp = 0; in PHP_INI_END()
266 pefree(phar, phar->is_persistent); in PHP_INI_END()
273 int phar_archive_delref(phar_archive_data *phar TSRMLS_DC) /* {{{ */ in phar_archive_delref()
275 if (phar->is_persistent) { in phar_archive_delref()
279 if (--phar->refcount < 0) { in phar_archive_delref()
281 || zend_hash_del(&(PHAR_GLOBALS->phar_fname_map), phar->fname, phar->fname_len) != SUCCESS) { in phar_archive_delref()
282 phar_destroy_phar_data(phar TSRMLS_CC); in phar_archive_delref()
285 } else if (!phar->refcount) { in phar_archive_delref()
290 if (phar->fp && !(phar->flags & PHAR_FILE_COMPRESSION_MASK)) { in phar_archive_delref()
295 php_stream_close(phar->fp); in phar_archive_delref()
296 phar->fp = NULL; in phar_archive_delref()
299 if (!zend_hash_num_elements(&phar->manifest)) { in phar_archive_delref()
302 if (zend_hash_del(&(PHAR_GLOBALS->phar_fname_map), phar->fname, phar->fname_len) != SUCCESS) { in phar_archive_delref()
303 phar_destroy_phar_data(phar TSRMLS_CC); in phar_archive_delref()
440 …if (idata->fp && idata->fp != idata->phar->fp && idata->fp != idata->phar->ufp && idata->fp != ida… in phar_entry_delref()
450 phar_archive_delref(idata->phar TSRMLS_CC); in phar_entry_delref()
461 phar_archive_data *phar; in phar_entry_remove() local
463 phar = idata->phar; in phar_entry_remove()
466 …if (idata->fp && idata->fp != idata->phar->fp && idata->fp != idata->phar->ufp && idata->fp != ida… in phar_entry_remove()
469 …zend_hash_del(&idata->phar->manifest, idata->internal_file->filename, idata->internal_file->filena… in phar_entry_remove()
470 idata->phar->refcount--; in phar_entry_remove()
477 if (!phar->donotflush) { in phar_entry_remove()
478 phar_flush(phar, 0, 0, 0, error TSRMLS_CC); in phar_entry_remove()
533 phar_archive_data *phar; local
545 if (SUCCESS == phar_get_archive(&phar, unixfname, fname_len, alias, alias_len, error TSRMLS_CC)
546 && ((alias && fname_len == phar->fname_len
547 && !strncmp(unixfname, phar->fname, fname_len)) || !alias)
552 if (SUCCESS == phar_get_archive(&phar, fname, fname_len, alias, alias_len, error TSRMLS_CC)
553 && ((alias && fname_len == phar->fname_len
554 && !strncmp(fname, phar->fname, fname_len)) || !alias)
566 if (!phar->halt_offset && !phar->is_brandnew && (phar->is_tar || phar->is_zip)) {
567 …if (PHAR_G(readonly) && FAILURE == zend_hash_find(&(phar->manifest), ".phar/stub.php", sizeof(".ph…
577 *pphar = phar;
589 if (phar && error && !(options & REPORT_ERRORS)) {
1059 entry.phar = mydata;
2424 if (SUCCESS != phar_open_archive_fp(idata->phar TSRMLS_CC)) {
2425 … phar archive \"%s\" to verify local file header for file \"%s\"", idata->phar->fname, entry->file…
2432 …ased phar \"%s\" (cannot read local file header for file \"%s\")", idata->phar->fname, entry->file…
2445 … phar \"%s\" (cannot read local data descriptor for file \"%s\")", idata->phar->fname, entry->file…
2457 …" (local header of file \"%s\" does not match central directory)", idata->phar->fname, entry->file…
2486 …ternal corruption of phar \"%s\" (crc32 mismatch on file \"%s\")", idata->phar->fname, entry->file…
2570 int phar_flush(phar_archive_data *phar, char *user_stub, long len, int convert, char **error TSRMLS… argument
2589 if (phar->is_persistent) {
2591 spprintf(error, 0, "internal error: attempt to flush cached zip-based phar \"%s\"", phar->fname);
2600 if (!zend_hash_num_elements(&phar->manifest) && !user_stub) {
2604 zend_hash_clean(&phar->virtual_dirs);
2606 if (phar->is_zip) {
2607 return phar_zip_flush(phar, user_stub, len, convert, error TSRMLS_CC);
2610 if (phar->is_tar) {
2611 return phar_tar_flush(phar, user_stub, len, convert, error TSRMLS_CC);
2618 if (phar->fp && !phar->is_brandnew) {
2619 oldfile = phar->fp;
2623 oldfile = php_stream_open_wrapper(phar->fname, "rb", 0, NULL);
2646 spprintf(error, 0, "unable to access resource to copy stub to new phar \"%s\"", phar->fname);
2663 spprintf(error, 0, "unable to read resource to copy stub to new phar \"%s\"", phar->fname);
2679 spprintf(error, 0, "illegal stub for phar \"%s\"", phar->fname);
2696 spprintf(error, 0, "unable to create stub from string in new phar \"%s\"", phar->fname);
2703 phar->halt_offset = len + 5;
2710 if (!user_stub && phar->halt_offset && oldfile && !phar->is_brandnew) {
2711 phar_stream_copy_to_stream(oldfile, newfile, phar->halt_offset, &written);
2715 newstub = phar_create_default_stub(NULL, NULL, &(phar->halt_offset), NULL TSRMLS_CC);
2716 written = php_stream_write(newfile, newstub, phar->halt_offset);
2718 if (phar->halt_offset != written) {
2725 spprintf(error, 0, "unable to create stub in new phar \"%s\"", phar->fname);
2727 spprintf(error, 0, "unable to copy stub of old phar to new phar \"%s\"", phar->fname);
2745 zend_hash_apply(&phar->manifest, phar_flush_clean_deleted_apply TSRMLS_CC);
2749 if (phar->metadata) {
2751 php_var_serialize(&main_metadata_str, &phar->metadata, &metadata_hash TSRMLS_CC);
2758 for (zend_hash_internal_pointer_reset(&phar->manifest);
2759 zend_hash_has_more_elements(&phar->manifest) == SUCCESS;
2760 zend_hash_move_forward(&phar->manifest)) {
2761 if (zend_hash_get_current_data(&phar->manifest, (void **)&entry) == FAILURE) {
2787 phar_add_virtual_dirs(phar, entry->filename, entry->filename_len TSRMLS_CC);
2823 newentry = phar_open_jit(phar, entry, error TSRMLS_CC);
2839 …ble to seek to start of file \"%s\" while creating new phar \"%s\"", entry->filename, phar->fname);
2863 …(error, 0, "unable to gzip compress file \"%s\" to new phar \"%s\"", entry->filename, phar->fname);
2867 …error, 0, "unable to bzip2 compress file \"%s\" to new phar \"%s\"", entry->filename, phar->fname);
2894 …ble to seek to start of file \"%s\" while creating new phar \"%s\"", entry->filename, phar->fname);
2905 …ressed file contents of file \"%s\" while creating new phar \"%s\"", entry->filename, phar->fname);
2932 restore_alias_len = phar->alias_len;
2933 if (phar->is_temporary_alias) {
2934 phar->alias_len = 0;
2937 manifest_len = offset + phar->alias_len + sizeof(manifest) + main_metadata_str.len;
2948 phar_set_32(manifest+14, phar->alias_len);
2952 || (size_t)phar->alias_len != php_stream_write(newfile, phar->alias, phar->alias_len)) {
2959 phar->alias_len = restore_alias_len;
2962 spprintf(error, 0, "unable to write manifest header of new phar \"%s\"", phar->fname);
2968 phar->alias_len = restore_alias_len;
2980 phar->alias_len = restore_alias_len;
2983 spprintf(error, 0, "unable to write manifest meta-data of new phar \"%s\"", phar->fname);
2994 for (zend_hash_internal_pointer_reset(&phar->manifest);
2995 zend_hash_has_more_elements(&phar->manifest) == SUCCESS;
2996 zend_hash_move_forward(&phar->manifest)) {
2998 if (zend_hash_get_current_data(&phar->manifest, (void **)&entry) == FAILURE) {
3023 … write filename of directory \"%s\" to manifest of new phar \"%s\"", entry->filename, phar->fname);
3025 …le to write filename of file \"%s\" to manifest of new phar \"%s\"", entry->filename, phar->fname);
3057 …e temporary manifest of file \"%s\" to manifest of new phar \"%s\"", entry->filename, phar->fname);
3066 for (zend_hash_internal_pointer_reset(&phar->manifest);
3067 zend_hash_has_more_elements(&phar->manifest) == SUCCESS;
3068 zend_hash_move_forward(&phar->manifest)) {
3070 if (zend_hash_get_current_data(&phar->manifest, (void **)&entry) == FAILURE) {
3089 …ble to seek to start of file \"%s\" while creating new phar \"%s\"", entry->filename, phar->fname);
3101 …ble to seek to start of file \"%s\" while creating new phar \"%s\"", entry->filename, phar->fname);
3117 …or, 0, "unable to write contents of file \"%s\" to new phar \"%s\"", entry->filename, phar->fname);
3132 if (entry->fp_refcount == 0 && entry->fp != phar->fp && entry->fp != phar->ufp) {
3149 if (phar->signature) {
3150 efree(phar->signature);
3151 phar->signature = NULL;
3154 switch(phar->sig_flags) {
3163 …ontents of file \"%s\" to new phar \"%s\" with requested hash type", entry->filename, phar->fname);
3171 if (FAILURE == phar_create_signature(phar, newfile, &digest, &digest_len, error TSRMLS_CC)) {
3189 if (phar->sig_flags == PHAR_SIG_OPENSSL) {
3196 phar_set_32(sig_buf, phar->sig_flags);
3204 if (phar->fp && free_fp) {
3205 php_stream_close(phar->fp);
3208 if (phar->ufp) {
3210 php_stream_close(phar->ufp);
3212 phar->ufp = NULL;
3219 phar->internal_file_start = halt_offset + manifest_len + 4;
3220 phar->halt_offset = halt_offset;
3221 phar->is_brandnew = 0;
3225 if (phar->donotflush) {
3227 phar->fp = newfile;
3229phar->fp = php_stream_open_wrapper(phar->fname, "w+b", IGNORE_URL|STREAM_MUST_SEEK|REPORT_ERRORS, …
3230 if (!phar->fp) {
3231 phar->fp = newfile;
3233 spprintf(error, 4096, "unable to open new phar \"%s\" for writing", phar->fname);
3238 if (phar->flags & PHAR_FILE_COMPRESSED_GZ) {
3244 …filter = php_stream_filter_create("zlib.deflate", &filterparams, php_stream_is_persistent(phar->fp…
3249 …contents of phar \"%s\" using zlib, PHP versions older than 5.2.6 have a buggy zlib", phar->fname);
3254 php_stream_filter_append(&phar->fp->writefilters, filter);
3255 phar_stream_copy_to_stream(newfile, phar->fp, PHP_STREAM_COPY_ALL, NULL);
3258 php_stream_close(phar->fp);
3260 phar->fp = newfile;
3261 } else if (phar->flags & PHAR_FILE_COMPRESSED_BZ2) {
3262 …filter = php_stream_filter_create("bzip2.compress", NULL, php_stream_is_persistent(phar->fp) TSRML…
3263 php_stream_filter_append(&phar->fp->writefilters, filter);
3264 phar_stream_copy_to_stream(newfile, phar->fp, PHP_STREAM_COPY_ALL, NULL);
3267 php_stream_close(phar->fp);
3269 phar->fp = newfile;
3271 phar_stream_copy_to_stream(newfile, phar->fp, PHP_STREAM_COPY_ALL, NULL);
3277 if (-1 == php_stream_seek(phar->fp, phar->halt_offset, SEEK_SET)) {
3279 spprintf(error, 0, "unable to seek to __HALT_COMPILER(); in new phar \"%s\"", phar->fname);
3289 ZEND_GET_MODULE(phar)
3338 phar_archive_data *phar; local
3344 …ilename(file_handle->filename, strlen(file_handle->filename), NULL, 0, 0, &phar, NULL TSRMLS_CC)) {
3345 if (phar->is_zip || phar->is_tar) {
3362 } else if (phar->flags & PHAR_FILE_COMPRESSION_MASK) {
3367 file_handle->handle.stream.handle = phar;
3372 phar->is_persistent ?
3373 php_stream_rewind(PHAR_GLOBALS->cached_fp[phar->phar_pos].fp) :
3374 php_stream_rewind(phar->fp);
3379 file_handle->handle.stream.handle = phar;
3384 phar->is_persistent ?
3385 php_stream_rewind(PHAR_GLOBALS->cached_fp[phar->phar_pos].fp) :
3386 php_stream_rewind(phar->fp);
3469 PHP_GINIT_FUNCTION(phar) /* {{{ */ argument
3529 PHP_GSHUTDOWN_FUNCTION(phar) /* {{{ */ argument
3535 PHP_MINIT_FUNCTION(phar) /* {{{ */ argument
3559 PHP_MSHUTDOWN_FUNCTION(phar) /* {{{ */ argument
3619 PHP_RSHUTDOWN_FUNCTION(phar) /* {{{ */ argument
3666 PHP_MINFO_FUNCTION(phar) /* {{{ */ argument
3734 PHP_MINIT(phar),
3735 PHP_MSHUTDOWN(phar),
3737 PHP_RSHUTDOWN(phar),
3738 PHP_MINFO(phar),
3740 PHP_MODULE_GLOBALS(phar), /* globals descriptor */
3741 PHP_GINIT(phar), /* globals ctor */
3742 PHP_GSHUTDOWN(phar), /* globals dtor */