@@ -1706,6 +1706,7 @@ static zend_result phar_open_from_fp(php_stream* fp, char *fname, size_t fname_l
17061706php_stream_filter_append (& temp -> writefilters , filter );
17071707
17081708if (SUCCESS != php_stream_copy_to_stream_ex (fp , temp , PHP_STREAM_COPY_ALL , NULL )) {
1709+ php_stream_filter_remove (filter , 1 );
17091710if (err ) {
17101711php_stream_close (temp );
17111712MAPPHAR_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
17521753php_stream_filter_append (& temp -> writefilters , filter );
17531754
17541755if (SUCCESS != php_stream_copy_to_stream_ex (fp , temp , PHP_STREAM_COPY_ALL , NULL )) {
1756+ php_stream_filter_remove (filter , 1 );
17551757php_stream_close (temp );
17561758MAPPHAR_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}
27972799entry -> cfp = shared_cfp ;
27982800if (!entry -> cfp ) {
2801+ php_stream_filter_free (filter );
27992802if (error ) {
28002803spprintf (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
28102813entry -> header_offset = php_stream_tell (entry -> cfp );
28112814php_stream_flush (file );
28122815if (-1 == phar_seek_efp (entry , 0 , SEEK_SET , 0 , 0 )) {
2816+ php_stream_filter_free (filter );
28132817if (must_close_old_file ) {
28142818php_stream_close (oldfile );
28152819}
@@ -2821,6 +2825,7 @@ void phar_flush_ex(phar_archive_data *phar, zend_string *user_stub, bool is_defa
28212825}
28222826php_stream_filter_append ((& entry -> cfp -> writefilters ), filter );
28232827if (SUCCESS != php_stream_copy_to_stream_ex (file , entry -> cfp , entry -> uncompressed_filesize , NULL )) {
2828+ php_stream_filter_remove (filter , 1 );
28242829if (must_close_old_file ) {
28252830php_stream_close (oldfile );
28262831}
0 commit comments