summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorMichael Wallner <mike@php.net>2012-01-16 17:51:35 +0000
committerMichael Wallner <mike@php.net>2012-01-16 17:51:35 +0000
commitf32760bd40aa368beeccd8ce53b425b2ebae159c (patch)
tree41579c7b36976f63facb9d0c7743480e356686c8 /tests
parent36df53421ecf6a74bfea19ab13e8935f8dd4476a (diff)
downloadphp-git-f32760bd40aa368beeccd8ce53b425b2ebae159c.tar.gz
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
Diffstat (limited to 'tests')
-rw-r--r--tests/output/bug60768.phpt25
1 files changed, 25 insertions, 0 deletions
diff --git a/tests/output/bug60768.phpt b/tests/output/bug60768.phpt
new file mode 100644
index 0000000000..2527e8e84a
--- /dev/null
+++ b/tests/output/bug60768.phpt
@@ -0,0 +1,25 @@
+--TEST--
+Bug #60768 Output buffer not discarded
+--FILE--
+<?php
+
+global $storage;
+
+ob_start(function($buffer) use (&$storage) { $storage .= $buffer; }, 20);
+
+echo str_repeat("0", 20); // fill in the buffer
+
+for($i = 0; $i < 10; $i++) {
+ echo str_pad($i, 9, ' ', STR_PAD_LEFT) . "\n"; // full buffer dumped every time
+}
+
+ob_end_flush();
+
+printf("Output size: %d, expected %d\n", strlen($storage), 20 + 10 * 10);
+
+?>
+DONE
+--EXPECT--
+Output size: 120, expected 120
+DONE
+