From e34af34365c0f7763cba4b5faa37889cd98fb2c5 Mon Sep 17 00:00:00 2001 From: Greg Beaver Date: Sun, 7 Jan 2007 19:57:26 +0000 Subject: [PATCH] fix unlink --- ext/phar/phar.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/ext/phar/phar.c b/ext/phar/phar.c index b1505c6769..38ffa7ddb5 100644 --- a/ext/phar/phar.c +++ b/ext/phar/phar.c @@ -2248,10 +2248,14 @@ static int phar_unlink(php_stream_wrapper *wrapper, char *url, int options, php_ } idata->internal_file->flags |= PHAR_ENT_DELETED; efree(internal_file); - php_url_free(resource); idata->internal_file = 0; + efree(idata); /* we need to "flush" the stream to save the newly deleted file on disk */ + idata = (phar_entry_data *) emalloc(sizeof(phar_entry_data)); + idata->fp = 0; + idata->phar = phar_get_archive(resource->host, strlen(resource->host), 0, 0 TSRMLS_CC); do_phar_flush(idata TSRMLS_CC); + php_url_free(resource); efree(idata); return SUCCESS; } -- 2.50.1