|
|
| version 1.1.1.2, 2012/05/29 12:34:41 | version 1.1.1.3, 2013/07/22 01:31:59 |
|---|---|
| Line 2 | Line 2 |
| +----------------------------------------------------------------------+ | +----------------------------------------------------------------------+ |
| | phar:// stream wrapper support | | | phar:// stream wrapper support | |
| +----------------------------------------------------------------------+ | +----------------------------------------------------------------------+ |
| | Copyright (c) 2005-2012 The PHP Group | | | Copyright (c) 2005-2013 The PHP Group | |
| +----------------------------------------------------------------------+ | +----------------------------------------------------------------------+ |
| | This source file is subject to version 3.01 of the PHP license, | | | This source file is subject to version 3.01 of the PHP license, | |
| | that is bundled with this package in the file LICENSE, and is | | | that is bundled with this package in the file LICENSE, and is | |
| Line 207 static php_stream * phar_wrapper_open_url(php_stream_w | Line 207 static php_stream * phar_wrapper_open_url(php_stream_w |
| fpf = php_stream_alloc(&phar_ops, idata, NULL, mode); | fpf = php_stream_alloc(&phar_ops, idata, NULL, mode); |
| php_url_free(resource); | php_url_free(resource); |
| efree(internal_file); | efree(internal_file); |
| #if PHP_MAJOR_VERSION >= 6 | |
| if (context && context->options && phar_find_key(HASH_OF(context->options), "phar", sizeof("phar"), (void**)&pzoption TSRMLS_CC)) { | |
| #else | |
| if (context && context->options && zend_hash_find(HASH_OF(context->options), "phar", sizeof("phar"), (void**)&pzoption) == SUCCESS) { | if (context && context->options && zend_hash_find(HASH_OF(context->options), "phar", sizeof("phar"), (void**)&pzoption) == SUCCESS) { |
| #endif | |
| pharcontext = HASH_OF(*pzoption); | pharcontext = HASH_OF(*pzoption); |
| if (idata->internal_file->uncompressed_filesize == 0 | if (idata->internal_file->uncompressed_filesize == 0 |
| && idata->internal_file->compressed_filesize == 0 | && idata->internal_file->compressed_filesize == 0 |
| #if PHP_MAJOR_VERSION >= 6 | |
| && phar_find_key(pharcontext, "compress", sizeof("compress"), (void**)&pzoption TSRMLS_CC) | |
| #else | |
| && zend_hash_find(pharcontext, "compress", sizeof("compress"), (void**)&pzoption) == SUCCESS | && zend_hash_find(pharcontext, "compress", sizeof("compress"), (void**)&pzoption) == SUCCESS |
| #endif | |
| && Z_TYPE_PP(pzoption) == IS_LONG | && Z_TYPE_PP(pzoption) == IS_LONG |
| && (Z_LVAL_PP(pzoption) & ~PHAR_ENT_COMPRESSION_MASK) == 0 | && (Z_LVAL_PP(pzoption) & ~PHAR_ENT_COMPRESSION_MASK) == 0 |
| ) { | ) { |
| idata->internal_file->flags &= ~PHAR_ENT_COMPRESSION_MASK; | idata->internal_file->flags &= ~PHAR_ENT_COMPRESSION_MASK; |
| idata->internal_file->flags |= Z_LVAL_PP(pzoption); | idata->internal_file->flags |= Z_LVAL_PP(pzoption); |
| } | } |
| #if PHP_MAJOR_VERSION >= 6 | |
| if (phar_find_key(pharcontext, "metadata", sizeof("metadata"), (void**)&pzoption TSRMLS_CC)) { | |
| #else | |
| if (zend_hash_find(pharcontext, "metadata", sizeof("metadata"), (void**)&pzoption) == SUCCESS) { | if (zend_hash_find(pharcontext, "metadata", sizeof("metadata"), (void**)&pzoption) == SUCCESS) { |
| #endif | |
| if (idata->internal_file->metadata) { | if (idata->internal_file->metadata) { |
| zval_ptr_dtor(&idata->internal_file->metadata); | zval_ptr_dtor(&idata->internal_file->metadata); |
| idata->internal_file->metadata = NULL; | idata->internal_file->metadata = NULL; |
| Line 469 static int phar_stream_flush(php_stream *stream TSRMLS | Line 458 static int phar_stream_flush(php_stream *stream TSRMLS |
| { | { |
| char *error; | char *error; |
| int ret; | int ret; |
| if (stream->mode[0] == 'w' || (stream->mode[0] == 'r' && stream->mode[1] == '+')) { | phar_entry_data *data = (phar_entry_data *) stream->abstract; |
| ret = phar_flush(((phar_entry_data *)stream->abstract)->phar, 0, 0, 0, &error TSRMLS_CC); | |
| if (data->internal_file->is_modified) { | |
| data->internal_file->timestamp = time(0); | |
| ret = phar_flush(data->phar, 0, 0, 0, &error TSRMLS_CC); | |
| if (error) { | if (error) { |
| php_stream_wrapper_log_error(stream->wrapper, REPORT_ERRORS TSRMLS_CC, "%s", error); | php_stream_wrapper_log_error(stream->wrapper, REPORT_ERRORS TSRMLS_CC, "%s", error); |
| efree(error); | efree(error); |