@@ -1706,6 +1706,7 @@ static zend_result phar_open_from_fp(php_stream* fp, char *fname, size_t fname_l
17061706 php_stream_filter_append (& temp -> writefilters , filter );
17071707
17081708 if (SUCCESS != php_stream_copy_to_stream_ex (fp , temp , PHP_STREAM_COPY_ALL , NULL )) {
1709+ php_stream_filter_remove (filter , 1 );
17091710 if (err ) {
17101711 php_stream_close (temp );
17111712 MAPPHAR_ALLOC_FAIL ("unable to decompress gzipped phar archive \"%s\", ext/zlib is buggy in PHP versions older than 5.2.6" )
@@ -1752,6 +1753,7 @@ static zend_result phar_open_from_fp(php_stream* fp, char *fname, size_t fname_l
17521753 php_stream_filter_append (& temp -> writefilters , filter );
17531754
17541755 if (SUCCESS != php_stream_copy_to_stream_ex (fp , temp , PHP_STREAM_COPY_ALL , NULL )) {
1756+ php_stream_filter_remove (filter , 1 );
17551757 php_stream_close (temp );
17561758 MAPPHAR_ALLOC_FAIL ("unable to decompress bzipped phar archive \"%s\" to temporary file" )
17571759 }
@@ -2796,6 +2798,7 @@ void phar_flush_ex(phar_archive_data *phar, zend_string *user_stub, bool is_defa
27962798 }
27972799 entry -> cfp = shared_cfp ;
27982800 if (!entry -> cfp ) {
2801+ php_stream_filter_free (filter );
27992802 if (error ) {
28002803 spprintf (error , 0 , "unable to create temporary file" );
28012804 }
@@ -2810,6 +2813,7 @@ void phar_flush_ex(phar_archive_data *phar, zend_string *user_stub, bool is_defa
28102813 entry -> header_offset = php_stream_tell (entry -> cfp );
28112814 php_stream_flush (file );
28122815 if (-1 == phar_seek_efp (entry , 0 , SEEK_SET , 0 , 0 )) {
2816+ php_stream_filter_free (filter );
28132817 if (must_close_old_file ) {
28142818 php_stream_close (oldfile );
28152819 }
@@ -2821,6 +2825,7 @@ void phar_flush_ex(phar_archive_data *phar, zend_string *user_stub, bool is_defa
28212825 }
28222826 php_stream_filter_append ((& entry -> cfp -> writefilters ), filter );
28232827 if (SUCCESS != php_stream_copy_to_stream_ex (file , entry -> cfp , entry -> uncompressed_filesize , NULL )) {
2828+ php_stream_filter_remove (filter , 1 );
28242829 if (must_close_old_file ) {
28252830 php_stream_close (oldfile );
28262831 }
0 commit comments