mirror of
https://github.com/php/php-src.git
synced 2026-03-24 08:12:21 +01:00
Merge branch 'PHP-8.4' into PHP-8.5
* PHP-8.4: Revert "ext/phar: Voidify flush function as it always returns EOL" phar: Fix broken return value of fflush() for phar file entries
This commit is contained in:
1
NEWS
1
NEWS
@@ -21,6 +21,7 @@ PHP NEWS
|
||||
- Phar:
|
||||
. Fixed bug GH-20442 (Phar does not respect case-insensitiveness of
|
||||
__halt_compiler() when reading stub). (ndossche, TimWolla)
|
||||
. Fix broken return value of fflush() for phar file entries. (ndossche)
|
||||
|
||||
- PHPDBG:
|
||||
. Fixed ZPP type violation in phpdbg_get_executable() and phpdbg_end_oplog().
|
||||
|
||||
@@ -2504,8 +2504,8 @@ zend_string *phar_create_default_stub(const char *index_php, const char *web_ind
|
||||
}
|
||||
/* }}} */
|
||||
|
||||
void phar_flush(phar_archive_data *phar, char **error) {
|
||||
phar_flush_ex(phar, NULL, false, error);
|
||||
int phar_flush(phar_archive_data *phar, char **error) {
|
||||
return phar_flush_ex(phar, NULL, false, error);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -2513,7 +2513,7 @@ void phar_flush(phar_archive_data *phar, char **error) {
|
||||
*
|
||||
* if user_stub is NULL the default or existing stub should be used
|
||||
*/
|
||||
void phar_flush_ex(phar_archive_data *phar, zend_string *user_stub, bool is_default_stub, char **error) /* {{{ */
|
||||
int phar_flush_ex(phar_archive_data *phar, zend_string *user_stub, bool is_default_stub, char **error) /* {{{ */
|
||||
{
|
||||
static const char halt_stub[] = "__HALT_COMPILER();";
|
||||
|
||||
@@ -2541,7 +2541,7 @@ void phar_flush_ex(phar_archive_data *phar, zend_string *user_stub, bool is_defa
|
||||
if (error) {
|
||||
spprintf(error, 0, "internal error: attempt to flush cached zip-based phar \"%s\"", phar->fname);
|
||||
}
|
||||
return;
|
||||
return EOF;
|
||||
}
|
||||
|
||||
if (error) {
|
||||
@@ -2549,23 +2549,21 @@ void phar_flush_ex(phar_archive_data *phar, zend_string *user_stub, bool is_defa
|
||||
}
|
||||
|
||||
if (!zend_hash_num_elements(&phar->manifest) && !user_stub) {
|
||||
return;
|
||||
return EOF;
|
||||
}
|
||||
|
||||
zend_hash_clean(&phar->virtual_dirs);
|
||||
|
||||
if (phar->is_zip) {
|
||||
phar_zip_flush(phar, user_stub, is_default_stub, error);
|
||||
return;
|
||||
return phar_zip_flush(phar, user_stub, is_default_stub, error);
|
||||
}
|
||||
|
||||
if (phar->is_tar) {
|
||||
phar_tar_flush(phar, user_stub, is_default_stub, error);
|
||||
return;
|
||||
return phar_tar_flush(phar, user_stub, is_default_stub, error);
|
||||
}
|
||||
|
||||
if (PHAR_G(readonly)) {
|
||||
return;
|
||||
return EOF;
|
||||
}
|
||||
|
||||
if (phar->fp && !phar->is_brandnew) {
|
||||
@@ -2584,7 +2582,7 @@ void phar_flush_ex(phar_archive_data *phar, zend_string *user_stub, bool is_defa
|
||||
if (must_close_old_file) {
|
||||
php_stream_close(oldfile);
|
||||
}
|
||||
return;
|
||||
return EOF;
|
||||
}
|
||||
|
||||
if (user_stub) {
|
||||
@@ -2598,7 +2596,7 @@ void phar_flush_ex(phar_archive_data *phar, zend_string *user_stub, bool is_defa
|
||||
if (error) {
|
||||
spprintf(error, 0, "illegal stub for phar \"%s\" (__HALT_COMPILER(); is missing)", phar->fname);
|
||||
}
|
||||
return;
|
||||
return EOF;
|
||||
}
|
||||
|
||||
size_t len = pos - ZSTR_VAL(user_stub) + strlen(halt_stub);
|
||||
@@ -2616,7 +2614,7 @@ void phar_flush_ex(phar_archive_data *phar, zend_string *user_stub, bool is_defa
|
||||
if (error) {
|
||||
spprintf(error, 0, "unable to create stub from string in new phar \"%s\"", phar->fname);
|
||||
}
|
||||
return;
|
||||
return EOF;
|
||||
}
|
||||
phar->halt_offset = len + end_sequence_len;
|
||||
} else {
|
||||
@@ -2646,7 +2644,7 @@ void phar_flush_ex(phar_archive_data *phar, zend_string *user_stub, bool is_defa
|
||||
if (new_stub) {
|
||||
zend_string_free(new_stub);
|
||||
}
|
||||
return;
|
||||
return EOF;
|
||||
}
|
||||
if (new_stub) {
|
||||
zend_string_free(new_stub);
|
||||
@@ -2742,7 +2740,7 @@ void phar_flush_ex(phar_archive_data *phar, zend_string *user_stub, bool is_defa
|
||||
if (error) {
|
||||
spprintf(error, 0, "unable to seek to start of file \"%s\" while creating new phar \"%s\"", ZSTR_VAL(entry->filename), phar->fname);
|
||||
}
|
||||
return;
|
||||
return EOF;
|
||||
}
|
||||
newcrc32 = php_crc32_bulk_init();
|
||||
php_crc32_stream_bulk_update(&newcrc32, file, entry->uncompressed_filesize);
|
||||
@@ -2768,7 +2766,7 @@ void phar_flush_ex(phar_archive_data *phar, zend_string *user_stub, bool is_defa
|
||||
spprintf(error, 0, "unable to bzip2 compress file \"%s\" to new phar \"%s\"", ZSTR_VAL(entry->filename), phar->fname);
|
||||
}
|
||||
}
|
||||
return;
|
||||
return EOF;
|
||||
}
|
||||
|
||||
/* create new file that holds the compressed versions */
|
||||
@@ -3094,7 +3092,7 @@ void phar_flush_ex(phar_archive_data *phar, zend_string *user_stub, bool is_defa
|
||||
php_stream_close(oldfile);
|
||||
}
|
||||
php_stream_close(newfile);
|
||||
return;
|
||||
return EOF;
|
||||
}
|
||||
|
||||
php_stream_write(newfile, digest, digest_len);
|
||||
@@ -3146,7 +3144,7 @@ void phar_flush_ex(phar_archive_data *phar, zend_string *user_stub, bool is_defa
|
||||
if (error) {
|
||||
spprintf(error, 4096, "unable to open new phar \"%s\" for writing", phar->fname);
|
||||
}
|
||||
return;
|
||||
return EOF;
|
||||
}
|
||||
|
||||
if (phar->flags & PHAR_FILE_COMPRESSED_GZ) {
|
||||
@@ -3162,7 +3160,7 @@ void phar_flush_ex(phar_archive_data *phar, zend_string *user_stub, bool is_defa
|
||||
if (error) {
|
||||
spprintf(error, 4096, "unable to compress all contents of phar \"%s\" using zlib, PHP versions older than 5.2.6 have a buggy zlib", phar->fname);
|
||||
}
|
||||
return;
|
||||
return EOF;
|
||||
}
|
||||
|
||||
php_stream_filter_append(&phar->fp->writefilters, filter);
|
||||
@@ -3192,9 +3190,10 @@ void phar_flush_ex(phar_archive_data *phar, zend_string *user_stub, bool is_defa
|
||||
if (error) {
|
||||
spprintf(error, 0, "unable to seek to __HALT_COMPILER(); in new phar \"%s\"", phar->fname);
|
||||
}
|
||||
return EOF;
|
||||
}
|
||||
|
||||
return;
|
||||
return 0;
|
||||
|
||||
cleanup:
|
||||
if (shared_cfp != NULL) {
|
||||
@@ -3206,6 +3205,8 @@ cleanup:
|
||||
entry->header_offset = 0;
|
||||
}
|
||||
} ZEND_HASH_FOREACH_END();
|
||||
|
||||
return EOF;
|
||||
}
|
||||
/* }}} */
|
||||
|
||||
|
||||
@@ -446,12 +446,12 @@ zend_result phar_copy_on_write(phar_archive_data **pphar);
|
||||
bool phar_is_tar(char *buf, char *fname);
|
||||
zend_result phar_parse_tarfile(php_stream* fp, char *fname, size_t fname_len, char *alias, size_t alias_len, phar_archive_data** pphar, uint32_t compression, char **error);
|
||||
zend_result phar_open_or_create_tar(char *fname, size_t fname_len, char *alias, size_t alias_len, int is_data, uint32_t options, phar_archive_data** pphar, char **error);
|
||||
void phar_tar_flush(phar_archive_data *phar, zend_string *user_stub, bool is_default_stub, char **error);
|
||||
int phar_tar_flush(phar_archive_data *phar, zend_string *user_stub, bool is_default_stub, char **error);
|
||||
|
||||
/* zip functions in zip.c */
|
||||
int phar_parse_zipfile(php_stream *fp, char *fname, size_t fname_len, char *alias, size_t alias_len, phar_archive_data** pphar, char **error);
|
||||
int phar_open_or_create_zip(char *fname, size_t fname_len, char *alias, size_t alias_len, int is_data, uint32_t options, phar_archive_data** pphar, char **error);
|
||||
void phar_zip_flush(phar_archive_data *archive, zend_string *user_stub, bool is_default_stub, char **error);
|
||||
int phar_zip_flush(phar_archive_data *archive, zend_string *user_stub, bool is_default_stub, char **error);
|
||||
|
||||
#ifdef PHAR_MAIN
|
||||
extern const php_stream_wrapper php_stream_phar_wrapper;
|
||||
@@ -467,8 +467,8 @@ phar_entry_info *phar_get_entry_info(phar_archive_data *phar, char *path, size_t
|
||||
phar_entry_info *phar_get_entry_info_dir(phar_archive_data *phar, char *path, size_t path_len, char dir, char **error, int security);
|
||||
phar_entry_data *phar_get_or_create_entry_data(char *fname, size_t fname_len, char *path, size_t path_len, const char *mode, char allow_dir, char **error, int security);
|
||||
zend_result phar_get_entry_data(phar_entry_data **ret, char *fname, size_t fname_len, char *path, size_t path_len, const char *mode, char allow_dir, char **error, int security);
|
||||
void phar_flush_ex(phar_archive_data *archive, zend_string *user_stub, bool is_default_stub, char **error);
|
||||
void phar_flush(phar_archive_data *archive, char **error);
|
||||
int phar_flush_ex(phar_archive_data *archive, zend_string *user_stub, bool is_default_stub, char **error);
|
||||
int phar_flush(phar_archive_data *archive, char **error);
|
||||
zend_result phar_detect_phar_fname_ext(const char *filename, size_t filename_len, const char **ext_str, size_t *ext_len, int executable, int for_create, int is_complete);
|
||||
zend_result phar_split_fname(const char *filename, size_t filename_len, char **arch, size_t *arch_len, char **entry, size_t *entry_len, int executable, int for_create);
|
||||
|
||||
|
||||
@@ -467,16 +467,17 @@ static ssize_t phar_stream_write(php_stream *stream, const char *buf, size_t cou
|
||||
static int phar_stream_flush(php_stream *stream) /* {{{ */
|
||||
{
|
||||
char *error;
|
||||
int ret;
|
||||
phar_entry_data *data = (phar_entry_data *) stream->abstract;
|
||||
|
||||
if (data->internal_file->is_modified) {
|
||||
data->internal_file->timestamp = time(0);
|
||||
phar_flush(data->phar, &error);
|
||||
ret = phar_flush(data->phar, &error);
|
||||
if (error) {
|
||||
php_stream_wrapper_log_error(stream->wrapper, REPORT_ERRORS, "%s", error);
|
||||
efree(error);
|
||||
}
|
||||
return EOF;
|
||||
return ret;
|
||||
} else {
|
||||
return EOF;
|
||||
}
|
||||
|
||||
@@ -964,7 +964,7 @@ static int phar_tar_setupmetadata(zval *zv, void *argument) /* {{{ */
|
||||
}
|
||||
/* }}} */
|
||||
|
||||
void phar_tar_flush(phar_archive_data *phar, zend_string *user_stub, bool is_default_stub, char **error) /* {{{ */
|
||||
int phar_tar_flush(phar_archive_data *phar, zend_string *user_stub, bool is_default_stub, char **error) /* {{{ */
|
||||
{
|
||||
static const char newstub[] = "<?php // tar-based phar archive stub file\n__HALT_COMPILER();";
|
||||
static const char halt_stub[] = "__HALT_COMPILER();";
|
||||
@@ -991,7 +991,7 @@ void phar_tar_flush(phar_archive_data *phar, zend_string *user_stub, bool is_def
|
||||
if (error) {
|
||||
spprintf(error, 0, "internal error: attempt to flush cached tar-based phar \"%s\"", phar->fname);
|
||||
}
|
||||
return;
|
||||
return EOF;
|
||||
}
|
||||
|
||||
if (phar->is_data) {
|
||||
@@ -1003,14 +1003,14 @@ void phar_tar_flush(phar_archive_data *phar, zend_string *user_stub, bool is_def
|
||||
entry.fp = php_stream_fopen_tmpfile();
|
||||
if (entry.fp == NULL) {
|
||||
spprintf(error, 0, "phar error: unable to create temporary file");
|
||||
return;
|
||||
return -1;
|
||||
}
|
||||
if (phar->alias_len != php_stream_write(entry.fp, phar->alias, phar->alias_len)) {
|
||||
if (error) {
|
||||
spprintf(error, 0, "unable to set alias in tar-based phar \"%s\"", phar->fname);
|
||||
}
|
||||
php_stream_close(entry.fp);
|
||||
return;
|
||||
return EOF;
|
||||
}
|
||||
|
||||
entry.uncompressed_filesize = phar->alias_len;
|
||||
@@ -1031,7 +1031,7 @@ void phar_tar_flush(phar_archive_data *phar, zend_string *user_stub, bool is_def
|
||||
if (error) {
|
||||
spprintf(error, 0, "illegal stub for tar-based phar \"%s\"", phar->fname);
|
||||
}
|
||||
return;
|
||||
return EOF;
|
||||
}
|
||||
|
||||
size_t len = pos - ZSTR_VAL(user_stub) + strlen(halt_stub);
|
||||
@@ -1041,7 +1041,7 @@ void phar_tar_flush(phar_archive_data *phar, zend_string *user_stub, bool is_def
|
||||
entry.fp = php_stream_fopen_tmpfile();
|
||||
if (entry.fp == NULL) {
|
||||
spprintf(error, 0, "phar error: unable to create temporary file");
|
||||
return;
|
||||
return EOF;
|
||||
}
|
||||
entry.uncompressed_filesize = len + end_sequence_len;
|
||||
|
||||
@@ -1053,7 +1053,7 @@ void phar_tar_flush(phar_archive_data *phar, zend_string *user_stub, bool is_def
|
||||
spprintf(error, 0, "unable to create stub from string in new tar-based phar \"%s\"", phar->fname);
|
||||
}
|
||||
php_stream_close(entry.fp);
|
||||
return;
|
||||
return EOF;
|
||||
}
|
||||
|
||||
entry.filename = ZSTR_INIT_LITERAL(".phar/stub.php", false);
|
||||
@@ -1063,14 +1063,14 @@ void phar_tar_flush(phar_archive_data *phar, zend_string *user_stub, bool is_def
|
||||
entry.fp = php_stream_fopen_tmpfile();
|
||||
if (entry.fp == NULL) {
|
||||
spprintf(error, 0, "phar error: unable to create temporary file");
|
||||
return;
|
||||
return EOF;
|
||||
}
|
||||
if (sizeof(newstub)-1 != php_stream_write(entry.fp, newstub, sizeof(newstub)-1)) {
|
||||
php_stream_close(entry.fp);
|
||||
if (error) {
|
||||
spprintf(error, 0, "unable to %s stub in%star-based phar \"%s\", failed", user_stub ? "overwrite" : "create", user_stub ? " " : " new ", phar->fname);
|
||||
}
|
||||
return;
|
||||
return EOF;
|
||||
}
|
||||
|
||||
entry.uncompressed_filesize = entry.compressed_filesize = sizeof(newstub) - 1;
|
||||
@@ -1084,7 +1084,7 @@ void phar_tar_flush(phar_archive_data *phar, zend_string *user_stub, bool is_def
|
||||
if (error) {
|
||||
spprintf(error, 0, "unable to create stub in tar-based phar \"%s\"", phar->fname);
|
||||
}
|
||||
return;
|
||||
return EOF;
|
||||
}
|
||||
} else {
|
||||
php_stream_close(entry.fp);
|
||||
@@ -1112,7 +1112,7 @@ nostub:
|
||||
if (must_close_old_file) {
|
||||
php_stream_close(oldfile);
|
||||
}
|
||||
return;
|
||||
return EOF;
|
||||
}
|
||||
|
||||
pass.old = oldfile;
|
||||
@@ -1128,7 +1128,7 @@ nostub:
|
||||
if (must_close_old_file) {
|
||||
php_stream_close(oldfile);
|
||||
}
|
||||
return;
|
||||
return EOF;
|
||||
}
|
||||
} else {
|
||||
phar_entry_info newentry = {0};
|
||||
@@ -1144,7 +1144,7 @@ nostub:
|
||||
if (must_close_old_file) {
|
||||
php_stream_close(oldfile);
|
||||
}
|
||||
return;
|
||||
return EOF;
|
||||
}
|
||||
|
||||
if (ZEND_HASH_APPLY_KEEP != phar_tar_setmetadata(&phar->metadata_tracker, mentry, error)) {
|
||||
@@ -1152,7 +1152,7 @@ nostub:
|
||||
if (must_close_old_file) {
|
||||
php_stream_close(oldfile);
|
||||
}
|
||||
return;
|
||||
return EOF;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1166,7 +1166,7 @@ nostub:
|
||||
|
||||
/* on error in the hash iterator above, error is set */
|
||||
php_stream_close(newfile);
|
||||
return;
|
||||
return EOF;
|
||||
}
|
||||
|
||||
zend_hash_apply_with_argument(&phar->manifest, phar_tar_writeheaders, (void *) &pass);
|
||||
@@ -1178,7 +1178,7 @@ nostub:
|
||||
|
||||
/* on error in the hash iterator above, error is set */
|
||||
php_stream_close(newfile);
|
||||
return;
|
||||
return EOF;
|
||||
}
|
||||
|
||||
/* add signature for executable tars or tars explicitly set with setSignatureAlgorithm */
|
||||
@@ -1195,7 +1195,7 @@ nostub:
|
||||
}
|
||||
|
||||
php_stream_close(newfile);
|
||||
return;
|
||||
return EOF;
|
||||
}
|
||||
|
||||
entry.fp = php_stream_fopen_tmpfile();
|
||||
@@ -1207,7 +1207,7 @@ nostub:
|
||||
php_stream_close(oldfile);
|
||||
}
|
||||
php_stream_close(newfile);
|
||||
return;
|
||||
return EOF;
|
||||
}
|
||||
#ifdef WORDS_BIGENDIAN
|
||||
# define PHAR_SET_32(destination, source) do { \
|
||||
@@ -1233,7 +1233,7 @@ nostub:
|
||||
php_stream_close(oldfile);
|
||||
}
|
||||
php_stream_close(newfile);
|
||||
return;
|
||||
return EOF;
|
||||
}
|
||||
|
||||
ALLOCA_FLAG(use_heap);
|
||||
@@ -1250,7 +1250,7 @@ nostub:
|
||||
}
|
||||
/* error is set by writeheaders */
|
||||
php_stream_close(newfile);
|
||||
return;
|
||||
return EOF;
|
||||
}
|
||||
} /* signature */
|
||||
|
||||
@@ -1266,7 +1266,7 @@ nostub:
|
||||
/* on error in the hash iterator above, error is set */
|
||||
if (error && *error) {
|
||||
php_stream_close(newfile);
|
||||
return;
|
||||
return EOF;
|
||||
}
|
||||
|
||||
if (phar->fp && pass.free_fp) {
|
||||
@@ -1293,7 +1293,7 @@ nostub:
|
||||
if (error) {
|
||||
spprintf(error, 0, "unable to open new phar \"%s\" for writing", phar->fname);
|
||||
}
|
||||
return;
|
||||
return EOF;
|
||||
}
|
||||
|
||||
if (phar->flags & PHAR_FILE_COMPRESSED_GZ) {
|
||||
@@ -1317,7 +1317,7 @@ nostub:
|
||||
if (error) {
|
||||
spprintf(error, 4096, "unable to compress all contents of phar \"%s\" using zlib, PHP versions older than 5.2.6 have a buggy zlib", phar->fname);
|
||||
}
|
||||
return;
|
||||
return EOF;
|
||||
}
|
||||
|
||||
php_stream_filter_append(&phar->fp->writefilters, filter);
|
||||
@@ -1344,5 +1344,6 @@ nostub:
|
||||
php_stream_close(newfile);
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
/* }}} */
|
||||
|
||||
25
ext/phar/tests/fflush_phar_file_report_success.phpt
Normal file
25
ext/phar/tests/fflush_phar_file_report_success.phpt
Normal file
@@ -0,0 +1,25 @@
|
||||
--TEST--
|
||||
fflush() on phar file should report success
|
||||
--EXTENSIONS--
|
||||
phar
|
||||
--INI--
|
||||
phar.readonly=0
|
||||
--FILE--
|
||||
<?php
|
||||
|
||||
$phar = new Phar(__DIR__.'/fflush_phar_file_report_success.phar');
|
||||
$phar->addFromString('test', 'contents');
|
||||
unset($phar);
|
||||
|
||||
$f = fopen('phar://' . __DIR__.'/fflush_phar_file_report_success.phar/test', 'w');
|
||||
var_dump(fflush($f));
|
||||
var_dump(fclose($f));
|
||||
|
||||
?>
|
||||
--CLEAN--
|
||||
<?php
|
||||
@unlink(__DIR__.'/fflush_phar_file_report_success.phar');
|
||||
?>
|
||||
--EXPECT--
|
||||
bool(true)
|
||||
bool(true)
|
||||
@@ -1238,7 +1238,7 @@ static int phar_zip_applysignature(phar_archive_data *phar, struct _phar_zip_pas
|
||||
}
|
||||
/* }}} */
|
||||
|
||||
void phar_zip_flush(phar_archive_data *phar, zend_string *user_stub, bool is_default_stub, char **error) /* {{{ */
|
||||
int phar_zip_flush(phar_archive_data *phar, zend_string *user_stub, bool is_default_stub, char **error) /* {{{ */
|
||||
{
|
||||
static const char newstub[] = "<?php // zip-based phar archive stub file\n__HALT_COMPILER();";
|
||||
static const char halt_stub[] = "__HALT_COMPILER();";
|
||||
@@ -1263,7 +1263,7 @@ void phar_zip_flush(phar_archive_data *phar, zend_string *user_stub, bool is_def
|
||||
if (error) {
|
||||
spprintf(error, 0, "internal error: attempt to flush cached zip-based phar \"%s\"", phar->fname);
|
||||
}
|
||||
return;
|
||||
return EOF;
|
||||
}
|
||||
|
||||
if (phar->is_data) {
|
||||
@@ -1275,14 +1275,14 @@ void phar_zip_flush(phar_archive_data *phar, zend_string *user_stub, bool is_def
|
||||
entry.fp = php_stream_fopen_tmpfile();
|
||||
if (entry.fp == NULL) {
|
||||
spprintf(error, 0, "phar error: unable to create temporary file");
|
||||
return;
|
||||
return EOF;
|
||||
}
|
||||
if (phar->alias_len != php_stream_write(entry.fp, phar->alias, phar->alias_len)) {
|
||||
php_stream_close(entry.fp);
|
||||
if (error) {
|
||||
spprintf(error, 0, "unable to set alias in zip-based phar \"%s\"", phar->fname);
|
||||
}
|
||||
return;
|
||||
return EOF;
|
||||
}
|
||||
|
||||
entry.uncompressed_filesize = entry.compressed_filesize = phar->alias_len;
|
||||
@@ -1296,7 +1296,7 @@ void phar_zip_flush(phar_archive_data *phar, zend_string *user_stub, bool is_def
|
||||
/* register alias */
|
||||
if (phar->alias_len) {
|
||||
if (FAILURE == phar_get_archive(&phar, phar->fname, phar->fname_len, phar->alias, phar->alias_len, error)) {
|
||||
return;
|
||||
return EOF;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1308,7 +1308,7 @@ void phar_zip_flush(phar_archive_data *phar, zend_string *user_stub, bool is_def
|
||||
if (error) {
|
||||
spprintf(error, 0, "illegal stub for zip-based phar \"%s\"", phar->fname);
|
||||
}
|
||||
return;
|
||||
return EOF;
|
||||
}
|
||||
|
||||
size_t len = pos - ZSTR_VAL(user_stub) + strlen(halt_stub);
|
||||
@@ -1318,7 +1318,7 @@ void phar_zip_flush(phar_archive_data *phar, zend_string *user_stub, bool is_def
|
||||
entry.fp = php_stream_fopen_tmpfile();
|
||||
if (entry.fp == NULL) {
|
||||
spprintf(error, 0, "phar error: unable to create temporary file");
|
||||
return;
|
||||
return EOF;
|
||||
}
|
||||
entry.uncompressed_filesize = len + end_sequence_len;
|
||||
|
||||
@@ -1330,7 +1330,7 @@ void phar_zip_flush(phar_archive_data *phar, zend_string *user_stub, bool is_def
|
||||
spprintf(error, 0, "unable to create stub from string in new zip-based phar \"%s\"", phar->fname);
|
||||
}
|
||||
php_stream_close(entry.fp);
|
||||
return;
|
||||
return EOF;
|
||||
}
|
||||
|
||||
entry.filename = ZSTR_INIT_LITERAL(".phar/stub.php", false);
|
||||
@@ -1341,14 +1341,14 @@ void phar_zip_flush(phar_archive_data *phar, zend_string *user_stub, bool is_def
|
||||
entry.fp = php_stream_fopen_tmpfile();
|
||||
if (entry.fp == NULL) {
|
||||
spprintf(error, 0, "phar error: unable to create temporary file");
|
||||
return;
|
||||
return EOF;
|
||||
}
|
||||
if (sizeof(newstub)-1 != php_stream_write(entry.fp, newstub, sizeof(newstub)-1)) {
|
||||
php_stream_close(entry.fp);
|
||||
if (error) {
|
||||
spprintf(error, 0, "unable to %s stub in%szip-based phar \"%s\", failed", user_stub ? "overwrite" : "create", user_stub ? " " : " new ", phar->fname);
|
||||
}
|
||||
return;
|
||||
return EOF;
|
||||
}
|
||||
|
||||
entry.uncompressed_filesize = entry.compressed_filesize = sizeof(newstub) - 1;
|
||||
@@ -1362,7 +1362,7 @@ void phar_zip_flush(phar_archive_data *phar, zend_string *user_stub, bool is_def
|
||||
if (error) {
|
||||
spprintf(error, 0, "unable to create stub in zip-based phar \"%s\"", phar->fname);
|
||||
}
|
||||
return;
|
||||
return EOF;
|
||||
}
|
||||
} else {
|
||||
php_stream_close(entry.fp);
|
||||
@@ -1394,7 +1394,7 @@ fperror:
|
||||
if (error) {
|
||||
spprintf(error, 4096, "phar zip flush of \"%s\" failed: unable to open temporary file", phar->fname);
|
||||
}
|
||||
return;
|
||||
return EOF;
|
||||
}
|
||||
|
||||
pass.centralfp = php_stream_fopen_tmpfile();
|
||||
@@ -1434,7 +1434,7 @@ nocentralerror:
|
||||
if (must_close_old_file) {
|
||||
php_stream_close(oldfile);
|
||||
}
|
||||
return;
|
||||
return EOF;
|
||||
}
|
||||
|
||||
if (FAILURE == phar_zip_applysignature(phar, &pass)) {
|
||||
@@ -1515,7 +1515,7 @@ nocentralerror:
|
||||
if (error) {
|
||||
spprintf(error, 4096, "unable to open new phar \"%s\" for writing", phar->fname);
|
||||
}
|
||||
return;
|
||||
return EOF;
|
||||
}
|
||||
php_stream_rewind(pass.filefp);
|
||||
php_stream_copy_to_stream_ex(pass.filefp, phar->fp, PHP_STREAM_COPY_ALL, NULL);
|
||||
@@ -1526,5 +1526,6 @@ nocentralerror:
|
||||
if (must_close_old_file) {
|
||||
php_stream_close(oldfile);
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
/* }}} */
|
||||
|
||||
Reference in New Issue
Block a user