@@ -1704,6 +1704,7 @@ static int phar_open_from_fp(php_stream* fp, char *fname, size_t fname_len, char
17041704				php_stream_filter_append (& temp -> writefilters , filter );
17051705
17061706				if  (SUCCESS  !=  php_stream_copy_to_stream_ex (fp , temp , PHP_STREAM_COPY_ALL , NULL )) {
1707+ 					php_stream_filter_remove (filter , 1 );
17071708					if  (err ) {
17081709						php_stream_close (temp );
17091710						MAPPHAR_ALLOC_FAIL ("unable to decompress gzipped phar archive \"%s\", ext/zlib is buggy in PHP versions older than 5.2.6" )
@@ -1750,6 +1751,7 @@ static int phar_open_from_fp(php_stream* fp, char *fname, size_t fname_len, char
17501751				php_stream_filter_append (& temp -> writefilters , filter );
17511752
17521753				if  (SUCCESS  !=  php_stream_copy_to_stream_ex (fp , temp , PHP_STREAM_COPY_ALL , NULL )) {
1754+ 					php_stream_filter_remove (filter , 1 );
17531755					php_stream_close (temp );
17541756					MAPPHAR_ALLOC_FAIL ("unable to decompress bzipped phar archive \"%s\" to temporary file" )
17551757				}
@@ -2833,6 +2835,7 @@ int phar_flush(phar_archive_data *phar, char *user_stub, zend_long len, int conv
28332835		}
28342836		entry -> cfp  =  shared_cfp ;
28352837		if  (!entry -> cfp ) {
2838+ 			php_stream_filter_free (filter );
28362839			if  (error ) {
28372840				spprintf (error , 0 , "unable to create temporary file" );
28382841			}
@@ -2847,6 +2850,7 @@ int phar_flush(phar_archive_data *phar, char *user_stub, zend_long len, int conv
28472850		entry -> header_offset  =  php_stream_tell (entry -> cfp );
28482851		php_stream_flush (file );
28492852		if  (-1  ==  phar_seek_efp (entry , 0 , SEEK_SET , 0 , 0 )) {
2853+ 			php_stream_filter_free (filter );
28502854			if  (closeoldfile ) {
28512855				php_stream_close (oldfile );
28522856			}
@@ -2858,6 +2862,7 @@ int phar_flush(phar_archive_data *phar, char *user_stub, zend_long len, int conv
28582862		}
28592863		php_stream_filter_append ((& entry -> cfp -> writefilters ), filter );
28602864		if  (SUCCESS  !=  php_stream_copy_to_stream_ex (file , entry -> cfp , entry -> uncompressed_filesize , NULL )) {
2865+ 			php_stream_filter_remove (filter , 1 );
28612866			if  (closeoldfile ) {
28622867				php_stream_close (oldfile );
28632868			}
0 commit comments