It would be great to have a NEWS entry and a testcase and a bug number.

Chris

On 02/14/2012 11:31 AM, Michael Wallner wrote:
mike                                     Tue, 14 Feb 2012 19:31:54 +0000

Revision: http://svn.php.net/viewvc?view=revision&revision=323219

Log:
fix compat function not passing along input buffer with 
php_output_context_pass() if the output_handler_func does not set out_str

Changed paths:
     U   php/php-src/branches/PHP_5_4/main/output.c
     U   php/php-src/trunk/main/output.c

Modified: php/php-src/branches/PHP_5_4/main/output.c
===================================================================
--- php/php-src/branches/PHP_5_4/main/output.c  2012-02-14 18:35:06 UTC (rev 
323218)
+++ php/php-src/branches/PHP_5_4/main/output.c  2012-02-14 19:31:54 UTC (rev 
323219)
@@ -1260,11 +1260,19 @@
        PHP_OUTPUT_TSRMLS(output_context);

        if (func) {
-               uint safe_out_len;
+               char *out_str = NULL;
+               uint out_len = 0;

-               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,&out_str,&out_len, output_context->op TSRMLS_CC);
+
+               if (out_str) {
+                       output_context->out.data = out_str;
+                       output_context->out.used = out_len;
+                       output_context->out.free = 1;
+               } else {
+                       php_output_context_pass(output_context);
+               }
+
                return SUCCESS;
        }
        return FAILURE;

Modified: php/php-src/trunk/main/output.c
===================================================================
--- php/php-src/trunk/main/output.c     2012-02-14 18:35:06 UTC (rev 323218)
+++ php/php-src/trunk/main/output.c     2012-02-14 19:31:54 UTC (rev 323219)
@@ -1260,11 +1260,19 @@
        PHP_OUTPUT_TSRMLS(output_context);

        if (func) {
-               uint safe_out_len;
+               char *out_str = NULL;
+               uint out_len = 0;

-               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,&out_str,&out_len, output_context->op TSRMLS_CC);
+
+               if (out_str) {
+                       output_context->out.data = out_str;
+                       output_context->out.used = out_len;
+                       output_context->out.free = 1;
+               } else {
+                       php_output_context_pass(output_context);
+               }
+
                return SUCCESS;
        }
        return FAILURE;





--
Email: christopher.jo...@oracle.com
Tel:  +1 650 506 8630
Blog:  http://blogs.oracle.com/opal/

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

Reply via email to