The new output buffering mechanism has a compatibility function for people / extensions that use the "old way". There is a compatibility function php_output_handler_compat_func(). It is not quite as compatible as it should be, and any code that depends on it will break. Using the "old way" if the output handler function set the return buffer pointer to NULL, it was a signal to the output code to pass through the buffer contents unmodified. The compatibility function wasn't doing that. The patch below fixes that. Sorry if this message doesn't follow normal procedures, I have very limited time and wanted to make sure I reported this before 5.4 ships. Hopefully the powers that be will considering including it.

Thanks in advance.
Index: main/output.c
===================================================================
--- main/output.c       (revision 323171)
+++ main/output.c       (working copy)
@@ -1261,10 +1261,16 @@
 
        if (func) {
                uint safe_out_len;
+               char *safe_output_buffer = NULL;
 
-               func(output_context->in.data, output_context->in.used, 
&output_context->out.data, &safe_out_len, output_context->op TSRMLS_CC);
-               output_context->out.used = safe_out_len;
-               output_context->out.free = 1;
+               func(output_context->in.data, output_context->in.used, 
&safe_output_buffer, &safe_out_len, output_context->op TSRMLS_CC);
+               if (NULL == safe_output_buffer) {
+                       php_output_context_pass(output_context);
+               } else {
+                       output_context->out.data = safe_output_buffer;
+                       output_context->out.used = safe_out_len;
+                       output_context->out.free = 1;
+               }
                return SUCCESS;
        }
        return FAILURE;

-- 
PHP Internals - PHP Runtime Development Mailing List
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to