Commit:    0ad53bfd7da12a92a46c08e3fff579a15026b88b
Author:    Michael Wallner <m...@php.net>         Tue, 15 May 2012 09:33:07 
+0200
Parents:   d9788dd73f93bc492d8fd6e93051e2a5bc8bec9f
Branches:  PHP-5.4 master

Link:       
http://git.php.net/?p=php-src.git;a=commitdiff;h=0ad53bfd7da12a92a46c08e3fff579a15026b88b

Log:
fix bug #60761 zlib.output_compression fails on refresh

Bugs:
https://bugs.php.net/60761

Changed paths:
  M  ext/zlib/zlib.c
  M  main/output.c
  M  main/php_output.h


Diff:
diff --git a/ext/zlib/zlib.c b/ext/zlib/zlib.c
index f157821..c6e2e0c 100644
--- a/ext/zlib/zlib.c
+++ b/ext/zlib/zlib.c
@@ -284,7 +284,8 @@ static void php_zlib_output_compression_start(TSRMLS_D)
                        ZLIBG(output_compression) = 
PHP_OUTPUT_HANDLER_DEFAULT_SIZE;
                        /* break omitted intentionally */
                default:
-                       if (    (h = 
php_zlib_output_handler_init(ZEND_STRL(PHP_ZLIB_OUTPUT_HANDLER_NAME), 
ZLIBG(output_compression), PHP_OUTPUT_HANDLER_STDFLAGS TSRMLS_CC)) &&
+                       if (    php_zlib_output_encoding(TSRMLS_C) &&
+                                       (h = 
php_zlib_output_handler_init(ZEND_STRL(PHP_ZLIB_OUTPUT_HANDLER_NAME), 
ZLIBG(output_compression), PHP_OUTPUT_HANDLER_STDFLAGS TSRMLS_CC)) &&
                                        (SUCCESS == php_output_handler_start(h 
TSRMLS_CC))) {
                                if (ZLIBG(output_handler) && 
*ZLIBG(output_handler)) {
                                        MAKE_STD_ZVAL(zoh);
@@ -966,7 +967,6 @@ static PHP_RINIT_FUNCTION(zlib)
 
 static PHP_RSHUTDOWN_FUNCTION(zlib)
 {
-       ZLIBG(output_compression) = 0;
        php_zlib_cleanup_ob_gzhandler_mess(TSRMLS_C);
 
     return SUCCESS;
diff --git a/main/output.c b/main/output.c
index 138339e..d4eaa67 100644
--- a/main/output.c
+++ b/main/output.c
@@ -1025,6 +1025,7 @@ static inline php_output_handler_status_t 
php_output_handler_op(php_output_handl
                case PHP_OUTPUT_HANDLER_SUCCESS:
                        /* no more buffered data */
                        handler->buffer.used = 0;
+                       handler->flags |= PHP_OUTPUT_HANDLER_PROCESSED;
                        break;
        }
 
diff --git a/main/php_output.h b/main/php_output.h
index e4ab0f9..d050a14 100644
--- a/main/php_output.h
+++ b/main/php_output.h
@@ -45,6 +45,7 @@
 /* handler status flags */
 #define PHP_OUTPUT_HANDLER_STARTED             0x1000
 #define PHP_OUTPUT_HANDLER_DISABLED            0x2000
+#define PHP_OUTPUT_HANDLER_PROCESSED   0x4000
 
 /* handler op return values */
 typedef enum _php_output_handler_status_t {
@@ -82,7 +83,7 @@ typedef enum _php_output_handler_hook_t {
 } php_output_handler_hook_t;
 
 #define PHP_OUTPUT_HANDLER_INITBUF_SIZE(s) \
-( (s) ? \
+( ((s) > 1) ? \
        (s) + PHP_OUTPUT_HANDLER_ALIGNTO_SIZE - ((s) % 
(PHP_OUTPUT_HANDLER_ALIGNTO_SIZE)) : \
        PHP_OUTPUT_HANDLER_DEFAULT_SIZE \
 )


--
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to