Patch zlib-filter-flush-fix.patch for Streams related Bug #48725
Patch version 2012-11-02 17:15 UTC
Return to Bug #48725 |
Download this patch
Patch Revisions:
Developer: nastasi@alternativeoutput.it
Index: php5-5.3.3/ext/zlib/zlib_filter.c
===================================================================
--- php5-5.3.3.orig/ext/zlib/zlib_filter.c 2012-11-02 17:21:07.000000000 +0100
+++ php5-5.3.3/ext/zlib/zlib_filter.c 2012-11-02 17:22:35.000000000 +0100
@@ -186,6 +186,7 @@
php_stream_bucket *bucket;
size_t consumed = 0, original_out, original_in;
int status;
+ zend_bool to_be_flushed = 1;
php_stream_filter_status_t exit_status = PSFS_FEED_ME;
z_stream *streamp;
@@ -213,6 +214,7 @@
data->strm.avail_in = desired;
status = deflate(&(data->strm), flags & PSFS_FLAG_FLUSH_CLOSE ? Z_FULL_FLUSH : (flags & PSFS_FLAG_FLUSH_INC ? Z_SYNC_FLUSH : Z_NO_FLUSH));
+ to_be_flushed = 0;
if (status != Z_OK) {
/* Something bad happened */
php_stream_bucket_delref(bucket TSRMLS_CC);
@@ -238,11 +240,11 @@
php_stream_bucket_delref(bucket TSRMLS_CC);
}
- if (flags & PSFS_FLAG_FLUSH_CLOSE) {
+ if (flags & PSFS_FLAG_FLUSH_CLOSE || (flags & PSFS_FLAG_FLUSH_INC && to_be_flushed)) {
/* Spit it out! */
status = Z_OK;
while (status == Z_OK) {
- status = deflate(&(data->strm), Z_FINISH);
+ status = deflate(&(data->strm), (flags & PSFS_FLAG_FLUSH_CLOSE ? Z_FINISH : Z_SYNC_FLUSH));
if (data->strm.avail_out < data->outbuf_len) {
size_t bucketlen = data->outbuf_len - data->strm.avail_out;
|