Fix bug #60768 Output buffer not discarded

in php_output_handler_op():
  * if appending to buffer succeeds, just return HANDLER_NO_DATA
    and do nothing else
  * if a zero sized string or true is returned from the handler
    function, reset the context as well as the handler's buffer
This commit is contained in:
Michael Wallner 2012-01-16 17:51:35 +00:00
parent 36df53421e
commit f32760bd40
2 changed files with 31 additions and 5 deletions

View file

@ -885,7 +885,8 @@ static inline php_output_handler_status_t php_output_handler_op(php_output_handl
/* storable? */
if (php_output_handler_append(handler, &context->in TSRMLS_CC) && !context->op) {
status = PHP_OUTPUT_HANDLER_NO_DATA;
context->op = original_op;
return PHP_OUTPUT_HANDLER_NO_DATA;
} else {
/* need to start? */
if (!(handler->flags & PHP_OUTPUT_HANDLER_STARTED)) {
@ -961,13 +962,13 @@ static inline php_output_handler_status_t php_output_handler_op(php_output_handl
handler->buffer.used = 0;
handler->buffer.size = 0;
break;
case PHP_OUTPUT_HANDLER_SUCCESS:
/* no more buffered data */
handler->buffer.used = 0;
break;
case PHP_OUTPUT_HANDLER_NO_DATA:
/* handler ate all */
php_output_context_reset(context);
/* no break */
case PHP_OUTPUT_HANDLER_SUCCESS:
/* no more buffered data */
handler->buffer.used = 0;
break;
}