summaryrefslogtreecommitdiff
path: root/tests/output
diff options
context:
space:
mode:
authorLorry Tar Creator <lorry-tar-importer@baserock.org>2013-03-14 05:42:27 +0000
committer <>2013-04-03 16:25:08 +0000
commitc4dd7a1a684490673e25aaf4fabec5df138854c4 (patch)
tree4d57c44caae4480efff02b90b9be86f44bf25409 /tests/output
downloadphp2-master.tar.gz
Imported from /home/lorry/working-area/delta_php2/php-5.4.13.tar.bz2.HEADphp-5.4.13master
Diffstat (limited to 'tests/output')
-rw-r--r--tests/output/bug46897.phpt27
-rw-r--r--tests/output/bug60282.phpt12
-rw-r--r--tests/output/bug60321.phpt9
-rw-r--r--tests/output/bug60322.phpt8
-rw-r--r--tests/output/bug60768.phpt25
-rw-r--r--tests/output/flush_basic_001.phpt26
-rw-r--r--tests/output/flush_error_001.phpt16
-rw-r--r--tests/output/ob_001.phpt8
-rw-r--r--tests/output/ob_002.phpt9
-rw-r--r--tests/output/ob_003.phpt13
-rw-r--r--tests/output/ob_004.phpt11
-rw-r--r--tests/output/ob_005.phpt14
-rw-r--r--tests/output/ob_006.phpt12
-rw-r--r--tests/output/ob_007.phpt11
-rw-r--r--tests/output/ob_008.phpt11
-rw-r--r--tests/output/ob_009.phpt12
-rw-r--r--tests/output/ob_010.phpt13
-rw-r--r--tests/output/ob_011.phpt13
-rw-r--r--tests/output/ob_012.phpt22
-rw-r--r--tests/output/ob_013.phpt105
-rw-r--r--tests/output/ob_014.phpt22
-rw-r--r--tests/output/ob_015.phpt22
-rw-r--r--tests/output/ob_017.phpt34
-rw-r--r--tests/output/ob_018.phpt17
-rw-r--r--tests/output/ob_020.phpt38
-rw-r--r--tests/output/ob_clean_basic_001.phpt36
-rw-r--r--tests/output/ob_clean_error_001.phpt27
-rw-r--r--tests/output/ob_end_clean_basic_001.phpt31
-rw-r--r--tests/output/ob_end_clean_error_001.phpt22
-rw-r--r--tests/output/ob_end_flush_basic_001.phpt41
-rw-r--r--tests/output/ob_end_flush_error_001.phpt27
-rw-r--r--tests/output/ob_flush_basic_001.phpt39
-rw-r--r--tests/output/ob_flush_error_001.phpt27
-rw-r--r--tests/output/ob_get_clean_basic_001.phpt18
-rw-r--r--tests/output/ob_get_clean_basic_002.phpt20
-rw-r--r--tests/output/ob_get_clean_error_001.phpt22
-rw-r--r--tests/output/ob_get_contents_basic_001.phpt73
-rw-r--r--tests/output/ob_get_contents_error_001.phpt32
-rw-r--r--tests/output/ob_get_length_basic_001.phpt37
-rw-r--r--tests/output/ob_get_length_error_001.phpt22
-rw-r--r--tests/output/ob_get_level_basic_001.phpt47
-rw-r--r--tests/output/ob_get_level_error_001.phpt27
-rw-r--r--tests/output/ob_get_status.phpt33
-rw-r--r--tests/output/ob_implicit_flush_basic_001.phpt24
-rw-r--r--tests/output/ob_implicit_flush_basic_002.phpt29
-rw-r--r--tests/output/ob_implicit_flush_error_001.phpt29
-rw-r--r--tests/output/ob_implicit_flush_variation_001.phpt192
-rw-r--r--tests/output/ob_start_basic_001.phpt14
-rw-r--r--tests/output/ob_start_basic_002.phpt55
-rw-r--r--tests/output/ob_start_basic_003.phpt18
-rw-r--r--tests/output/ob_start_basic_004.phpt132
-rw-r--r--tests/output/ob_start_basic_005.phpt33
-rw-r--r--tests/output/ob_start_basic_006.phpt135
-rw-r--r--tests/output/ob_start_basic_unerasable_001.phpt22
-rw-r--r--tests/output/ob_start_basic_unerasable_002.phpt33
-rw-r--r--tests/output/ob_start_basic_unerasable_003.phpt22
-rw-r--r--tests/output/ob_start_basic_unerasable_004.phpt22
-rw-r--r--tests/output/ob_start_basic_unerasable_005.phpt25
-rw-r--r--tests/output/ob_start_callbacks.phpt39
-rw-r--r--tests/output/ob_start_error_001.phpt53
-rw-r--r--tests/output/ob_start_error_002.phpt42
-rw-r--r--tests/output/ob_start_error_003.phpt22
-rw-r--r--tests/output/ob_start_error_004.phpt22
-rw-r--r--tests/output/ob_start_error_005.phpt23
64 files changed, 2077 insertions, 0 deletions
diff --git a/tests/output/bug46897.phpt b/tests/output/bug46897.phpt
new file mode 100644
index 0000000..8fe80bc
--- /dev/null
+++ b/tests/output/bug46897.phpt
@@ -0,0 +1,27 @@
+--TEST--
+Bug #46897: ob_flush() should fail to flush unerasable buffers
+--FILE--
+<?php
+function callback($string) {
+ static $callback_invocations;
+ $callback_invocations++;
+ return "[callback:$callback_invocations]$string\n";
+}
+
+ob_start('callback', 0, false);
+
+echo "Attempt to flush unerasable buffer - should fail...";
+var_dump(ob_flush());
+// Check content of buffer after flush - if flush failed it should still contain the string above.
+var_dump(ob_get_contents());
+echo 'Done';
+?>
+--EXPECTF--
+[callback:1]Attempt to flush unerasable buffer - should fail...
+Notice: ob_flush(): failed to flush buffer of callback (0) in %s on line %d
+bool(false)
+string(%d) "Attempt to flush unerasable buffer - should fail...
+Notice: ob_flush(): failed to flush buffer of callback (0) in %s on line %d
+bool(false)
+"
+Done
diff --git a/tests/output/bug60282.phpt b/tests/output/bug60282.phpt
new file mode 100644
index 0000000..08bcc0f
--- /dev/null
+++ b/tests/output/bug60282.phpt
@@ -0,0 +1,12 @@
+--TEST--
+Bug #60282 (Segfault when using ob_gzhandler() with open buffers)
+--SKIPIF--
+<?php if (!extension_loaded("zlib")) print "skip Zlib extension required"; ?>
+--FILE--
+<?php
+ob_start();
+ob_start();
+ob_start('ob_gzhandler');
+echo "done";
+--EXPECT--
+done
diff --git a/tests/output/bug60321.phpt b/tests/output/bug60321.phpt
new file mode 100644
index 0000000..9802a57
--- /dev/null
+++ b/tests/output/bug60321.phpt
@@ -0,0 +1,9 @@
+--TEST--
+Bug #60321 (ob_get_status(true) no longer returns an array when buffer is empty)
+--FILE--
+<?php
+$return = ob_get_status(true);
+var_dump($return);
+--EXPECT--
+array(0) {
+}
diff --git a/tests/output/bug60322.phpt b/tests/output/bug60322.phpt
new file mode 100644
index 0000000..c28ab4d
--- /dev/null
+++ b/tests/output/bug60322.phpt
@@ -0,0 +1,8 @@
+--TEST--
+Bug #60322 (ob_get_clean() now raises an E_NOTICE if no buffers exist)
+--FILE--
+<?php
+while(ob_get_clean()) ;
+var_dump(ob_get_clean());
+--EXPECT--
+bool(false)
diff --git a/tests/output/bug60768.phpt b/tests/output/bug60768.phpt
new file mode 100644
index 0000000..2527e8e
--- /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
+
diff --git a/tests/output/flush_basic_001.phpt b/tests/output/flush_basic_001.phpt
new file mode 100644
index 0000000..d9bb639
--- /dev/null
+++ b/tests/output/flush_basic_001.phpt
@@ -0,0 +1,26 @@
+--TEST--
+Test basic functionality of flush()
+--FILE--
+<?php
+/*
+ * proto void flush(void)
+ * Function is implemented in ext/standard/basic_functions.c.
+ */
+
+// Verify return type
+var_dump(flush());
+
+// Ensure user buffers are not flushed by flush()
+ob_start();
+echo "Inside a user buffer\n";
+flush();
+ob_end_clean();
+
+echo "Outside of any user buffers\n";
+var_dump(flush());
+
+?>
+--EXPECT--
+NULL
+Outside of any user buffers
+NULL \ No newline at end of file
diff --git a/tests/output/flush_error_001.phpt b/tests/output/flush_error_001.phpt
new file mode 100644
index 0000000..720c0d5
--- /dev/null
+++ b/tests/output/flush_error_001.phpt
@@ -0,0 +1,16 @@
+--TEST--
+Test wrong number of arguments for flush() (no impact)
+--FILE--
+<?php
+/*
+ * proto void flush(void)
+ * Function is implemented in ext/standard/basic_functions.c.
+ */
+
+$extra_arg = 1;
+echo "\nToo many arguments\n";
+var_dump(flush($extra_arg));
+?>
+--EXPECTF--
+Too many arguments
+NULL \ No newline at end of file
diff --git a/tests/output/ob_001.phpt b/tests/output/ob_001.phpt
new file mode 100644
index 0000000..ecacf02
--- /dev/null
+++ b/tests/output/ob_001.phpt
@@ -0,0 +1,8 @@
+--TEST--
+output buffering - nothing
+--FILE--
+<?php
+echo "foo\n";
+?>
+--EXPECT--
+foo
diff --git a/tests/output/ob_002.phpt b/tests/output/ob_002.phpt
new file mode 100644
index 0000000..94f515b
--- /dev/null
+++ b/tests/output/ob_002.phpt
@@ -0,0 +1,9 @@
+--TEST--
+output buffering - ob_start
+--FILE--
+<?php
+ob_start();
+echo "foo\n";
+?>
+--EXPECT--
+foo
diff --git a/tests/output/ob_003.phpt b/tests/output/ob_003.phpt
new file mode 100644
index 0000000..988d197
--- /dev/null
+++ b/tests/output/ob_003.phpt
@@ -0,0 +1,13 @@
+--TEST--
+output buffering - ob_flush
+--FILE--
+<?php
+ob_start();
+echo "foo\n";
+ob_flush();
+echo "bar\n";
+ob_flush();
+?>
+--EXPECT--
+foo
+bar
diff --git a/tests/output/ob_004.phpt b/tests/output/ob_004.phpt
new file mode 100644
index 0000000..a089a8c
--- /dev/null
+++ b/tests/output/ob_004.phpt
@@ -0,0 +1,11 @@
+--TEST--
+output buffering - ob_clean
+--FILE--
+<?php
+ob_start();
+echo "foo\n";
+ob_clean();
+echo "bar\n";
+?>
+--EXPECT--
+bar
diff --git a/tests/output/ob_005.phpt b/tests/output/ob_005.phpt
new file mode 100644
index 0000000..bbe807d
--- /dev/null
+++ b/tests/output/ob_005.phpt
@@ -0,0 +1,14 @@
+--TEST--
+output buffering - ob_end_clean
+--FILE--
+<?php
+ob_start();
+echo "foo\n";
+ob_start();
+echo "bar\n";
+ob_end_clean();
+echo "baz\n";
+?>
+--EXPECT--
+foo
+baz
diff --git a/tests/output/ob_006.phpt b/tests/output/ob_006.phpt
new file mode 100644
index 0000000..aec3cfc
--- /dev/null
+++ b/tests/output/ob_006.phpt
@@ -0,0 +1,12 @@
+--TEST--
+output buffering - ob_end_flush
+--FILE--
+<?php
+ob_start();
+echo "foo\n";
+ob_end_flush();
+var_dump(ob_get_level());
+?>
+--EXPECT--
+foo
+int(0)
diff --git a/tests/output/ob_007.phpt b/tests/output/ob_007.phpt
new file mode 100644
index 0000000..059925c
--- /dev/null
+++ b/tests/output/ob_007.phpt
@@ -0,0 +1,11 @@
+--TEST--
+output buffering - ob_get_clean
+--FILE--
+<?php
+ob_start();
+echo "foo\n";
+var_dump(ob_get_clean());
+?>
+--EXPECT--
+string(4) "foo
+"
diff --git a/tests/output/ob_008.phpt b/tests/output/ob_008.phpt
new file mode 100644
index 0000000..17a8081
--- /dev/null
+++ b/tests/output/ob_008.phpt
@@ -0,0 +1,11 @@
+--TEST--
+output buffering - ob_get_contents
+--FILE--
+<?php
+ob_start();
+echo "foo\n";
+echo ob_get_contents();
+?>
+--EXPECT--
+foo
+foo
diff --git a/tests/output/ob_009.phpt b/tests/output/ob_009.phpt
new file mode 100644
index 0000000..80edb46
--- /dev/null
+++ b/tests/output/ob_009.phpt
@@ -0,0 +1,12 @@
+--TEST--
+output buffering - ob_get_flush
+--FILE--
+<?php
+ob_start();
+echo "foo\n";
+var_dump(ob_get_flush());
+?>
+--EXPECT--
+foo
+string(4) "foo
+"
diff --git a/tests/output/ob_010.phpt b/tests/output/ob_010.phpt
new file mode 100644
index 0000000..24d650c
--- /dev/null
+++ b/tests/output/ob_010.phpt
@@ -0,0 +1,13 @@
+--TEST--
+output buffering - fatalism
+--FILE--
+<?php
+function obh($s)
+{
+ print_r($s, 1);
+}
+ob_start("obh");
+echo "foo\n";
+?>
+--EXPECTF--
+Fatal error: print_r(): Cannot use output buffering in output buffering display handlers in %sob_010.php on line %d
diff --git a/tests/output/ob_011.phpt b/tests/output/ob_011.phpt
new file mode 100644
index 0000000..35b0388
--- /dev/null
+++ b/tests/output/ob_011.phpt
@@ -0,0 +1,13 @@
+--TEST--
+output buffering - fatalism
+--FILE--
+<?php
+function obh($s)
+{
+ return ob_get_flush();
+}
+ob_start("obh");
+echo "foo\n";
+?>
+--EXPECTF--
+Fatal error: ob_get_flush(): Cannot use output buffering in output buffering display handlers in %sob_011.php on line %d
diff --git a/tests/output/ob_012.phpt b/tests/output/ob_012.phpt
new file mode 100644
index 0000000..9e6e885
--- /dev/null
+++ b/tests/output/ob_012.phpt
@@ -0,0 +1,22 @@
+--TEST--
+output buffering - multiple
+--FILE--
+<?php
+echo 0;
+ ob_start();
+ ob_start();
+ ob_start();
+ ob_start();
+ echo 1;
+ ob_end_flush();
+ echo 2;
+ $ob = ob_get_clean();
+ echo 3;
+ ob_flush();
+ ob_end_clean();
+ echo 4;
+ ob_end_flush();
+echo $ob;
+?>
+--EXPECT--
+03412
diff --git a/tests/output/ob_013.phpt b/tests/output/ob_013.phpt
new file mode 100644
index 0000000..ad2e36d
--- /dev/null
+++ b/tests/output/ob_013.phpt
@@ -0,0 +1,105 @@
+--TEST--
+output buffering - handlers/status
+--FILE--
+<?php
+function a($s){return $s;}
+function b($s){return $s;}
+function c($s){return $s;}
+function d($s){return $s;}
+
+ob_start();
+ob_start('a');
+ob_start('b');
+ob_start('c');
+ob_start('d');
+ob_start();
+
+echo "foo\n";
+
+ob_flush();
+ob_end_clean();
+ob_flush();
+
+print_r(ob_list_handlers());
+print_r(ob_get_status());
+print_r(ob_get_status(true));
+
+?>
+--EXPECTF--
+foo
+Array
+(
+ [0] => default output handler
+ [1] => a
+ [2] => b
+ [3] => c
+ [4] => d
+)
+Array
+(
+ [name] => d
+ [type] => 1
+ [flags] => 20593
+ [level] => 4
+ [chunk_size] => %d
+ [buffer_size] => 16384
+ [buffer_used] => 96
+)
+Array
+(
+ [0] => Array
+ (
+ [name] => default output handler
+ [type] => 0
+ [flags] => 112
+ [level] => 0
+ [chunk_size] => %d
+ [buffer_size] => 16384
+ [buffer_used] => 0
+ )
+
+ [1] => Array
+ (
+ [name] => a
+ [type] => 1
+ [flags] => 113
+ [level] => 1
+ [chunk_size] => %d
+ [buffer_size] => 16384
+ [buffer_used] => 0
+ )
+
+ [2] => Array
+ (
+ [name] => b
+ [type] => 1
+ [flags] => 113
+ [level] => 2
+ [chunk_size] => %d
+ [buffer_size] => 16384
+ [buffer_used] => 0
+ )
+
+ [3] => Array
+ (
+ [name] => c
+ [type] => 1
+ [flags] => 113
+ [level] => 3
+ [chunk_size] => %d
+ [buffer_size] => 16384
+ [buffer_used] => 4
+ )
+
+ [4] => Array
+ (
+ [name] => d
+ [type] => 1
+ [flags] => 20593
+ [level] => 4
+ [chunk_size] => %d
+ [buffer_size] => 16384
+ [buffer_used] => %d
+ )
+
+)
diff --git a/tests/output/ob_014.phpt b/tests/output/ob_014.phpt
new file mode 100644
index 0000000..0953427
--- /dev/null
+++ b/tests/output/ob_014.phpt
@@ -0,0 +1,22 @@
+--TEST--
+output buffering - failure
+--FILE--
+<?php
+ob_start("str_rot13");
+echo "foo\n";
+// str_rot13 expects 1 param and returns NULL when passed 2 params.
+// It is invoked with 2 params when used as an OB callback.
+// Therefore, there will be no data in the buffer. This is expected: see bug 46900.
+ob_end_flush();
+
+// Show the error.
+print_r(error_get_last());
+?>
+--EXPECTF--
+Array
+(
+ [type] => 2
+ [message] => str_rot13() expects exactly 1 parameter, 2 given
+ [file] => %s
+ [line] => 7
+)
diff --git a/tests/output/ob_015.phpt b/tests/output/ob_015.phpt
new file mode 100644
index 0000000..2acdb40
--- /dev/null
+++ b/tests/output/ob_015.phpt
@@ -0,0 +1,22 @@
+--TEST--
+output buffering - failure
+--FILE--
+<?php
+ob_start("str_rot13", 1);
+echo "foo\n";
+// str_rot13 expects 1 param and returns NULL when passed 2 params.
+// It is invoked with 2 params when used as an OB callback.
+// Therefore, there will be no data in the buffer. This is expected: see bug 46900.
+ob_end_flush();
+
+// Show the error.
+print_r(error_get_last());
+?>
+--EXPECTF--
+Array
+(
+ [type] => 2
+ [message] => str_rot13() expects exactly 1 parameter, 2 given
+ [file] => %s
+ [line] => 7
+)
diff --git a/tests/output/ob_017.phpt b/tests/output/ob_017.phpt
new file mode 100644
index 0000000..517fafe
--- /dev/null
+++ b/tests/output/ob_017.phpt
@@ -0,0 +1,34 @@
+--TEST--
+output buffering - stati
+--FILE--
+<?php
+$stati = array();
+function oh($str, $flags) {
+ global $stati;
+ $stati[] = "$flags: $str";
+ return $str;
+}
+ob_start("oh", 3);
+echo "yes";
+echo "!\n";
+ob_flush();
+echo "no";
+ob_clean();
+echo "yes!\n";
+echo "no";
+ob_end_clean();
+print_r($stati);
+?>
+--EXPECT--
+yes!
+yes!
+Array
+(
+ [0] => 1: yes
+ [1] => 4: !
+
+ [2] => 2: no
+ [3] => 0: yes!
+
+ [4] => 10: no
+)
diff --git a/tests/output/ob_018.phpt b/tests/output/ob_018.phpt
new file mode 100644
index 0000000..1ff7d5a
--- /dev/null
+++ b/tests/output/ob_018.phpt
@@ -0,0 +1,17 @@
+--TEST--
+output buffering - error message nirvana bug #37714
+--SKIPIF--
+<?php
+if (!extension_loaded("zlib")) die("skip need ext/zlib");
+?>
+--ENV--
+HTTP_ACCEPT_ENCODING=gzip,deflate
+--INI--
+display_errors=1
+zlib.output_compression=1
+--FILE--
+<?php
+ob_start('ob_gzhandler');
+?>
+--EXPECTF--
+‹%a
diff --git a/tests/output/ob_020.phpt b/tests/output/ob_020.phpt
new file mode 100644
index 0000000..05f66cc
--- /dev/null
+++ b/tests/output/ob_020.phpt
@@ -0,0 +1,38 @@
+--TEST--
+output buffering - ob_list_handlers
+--FILE--
+<?php
+print_r(ob_list_handlers());
+
+ob_start();
+print_r(ob_list_handlers());
+
+ob_start();
+print_r(ob_list_handlers());
+
+ob_end_flush();
+print_r(ob_list_handlers());
+
+ob_end_flush();
+print_r(ob_list_handlers());
+?>
+--EXPECT--
+Array
+(
+)
+Array
+(
+ [0] => default output handler
+)
+Array
+(
+ [0] => default output handler
+ [1] => default output handler
+)
+Array
+(
+ [0] => default output handler
+)
+Array
+(
+)
diff --git a/tests/output/ob_clean_basic_001.phpt b/tests/output/ob_clean_basic_001.phpt
new file mode 100644
index 0000000..afaa7e2
--- /dev/null
+++ b/tests/output/ob_clean_basic_001.phpt
@@ -0,0 +1,36 @@
+--TEST--
+Test ob_clean() function : basic functionality
+--FILE--
+<?php
+/* Prototype : proto bool ob_clean(void)
+ * Description: Clean (delete) the current output buffer
+ * Source code: main/output.c
+ * Alias to functions:
+ */
+
+echo "*** Testing ob_clean() : basic functionality ***\n";
+
+// Zero arguments
+echo "\n-- Testing ob_clean() function with Zero arguments --\n";
+var_dump( ob_clean() );
+
+ob_start();
+echo "You should never see this.";
+var_dump(ob_clean());
+
+echo "Ensure the buffer is still active after the clean.";
+$out = ob_get_clean();
+var_dump($out);
+
+echo "Done";
+?>
+--EXPECTF--
+*** Testing ob_clean() : basic functionality ***
+
+-- Testing ob_clean() function with Zero arguments --
+
+Notice: ob_clean(): failed to delete buffer. No buffer to delete in %s on line 12
+bool(false)
+string(61) "bool(true)
+Ensure the buffer is still active after the clean."
+Done
diff --git a/tests/output/ob_clean_error_001.phpt b/tests/output/ob_clean_error_001.phpt
new file mode 100644
index 0000000..ef1413a
--- /dev/null
+++ b/tests/output/ob_clean_error_001.phpt
@@ -0,0 +1,27 @@
+--TEST--
+Test ob_clean() function : error conditions
+--FILE--
+<?php
+/* Prototype : proto bool ob_clean(void)
+ * Description: Clean (delete) the current output buffer
+ * Source code: main/output.c
+ * Alias to functions:
+ */
+
+echo "*** Testing ob_clean() : error conditions ***\n";
+
+// One argument
+echo "\n-- Testing ob_clean() function with one argument --\n";
+$extra_arg = 10;;
+var_dump( ob_clean($extra_arg) );
+
+echo "Done";
+?>
+--EXPECTF--
+*** Testing ob_clean() : error conditions ***
+
+-- Testing ob_clean() function with one argument --
+
+Warning: ob_clean() expects exactly 0 parameters, 1 given in %s on line 13
+NULL
+Done \ No newline at end of file
diff --git a/tests/output/ob_end_clean_basic_001.phpt b/tests/output/ob_end_clean_basic_001.phpt
new file mode 100644
index 0000000..54e840b
--- /dev/null
+++ b/tests/output/ob_end_clean_basic_001.phpt
@@ -0,0 +1,31 @@
+--TEST--
+Test return type and value, as well as basic behaviour, for ob_end_clean()
+--FILE--
+<?php
+/*
+ * proto bool ob_end_clean(void)
+ * Function is implemented in main/output.c
+*/
+
+var_dump(ob_end_clean());
+
+ob_start();
+var_dump(ob_end_clean());
+
+ob_start();
+echo "Hello";
+var_dump(ob_end_clean());
+
+var_dump(ob_end_clean());
+
+?>
+--EXPECTF--
+
+Notice: ob_end_clean(): failed to delete buffer. No buffer to delete in %s on line 7
+bool(false)
+bool(true)
+bool(true)
+
+Notice: ob_end_clean(): failed to delete buffer. No buffer to delete in %s on line 16
+bool(false)
+
diff --git a/tests/output/ob_end_clean_error_001.phpt b/tests/output/ob_end_clean_error_001.phpt
new file mode 100644
index 0000000..0279db7
--- /dev/null
+++ b/tests/output/ob_end_clean_error_001.phpt
@@ -0,0 +1,22 @@
+--TEST--
+Test wrong number of arguments for ob_end_clean()
+--FILE--
+<?php
+/*
+ * proto bool ob_end_clean(void)
+ * Function is implemented in main/output.c
+*/
+
+$extra_arg = 1;
+
+echo "\nToo many arguments\n";
+var_dump(ob_end_clean($extra_arg));
+
+
+?>
+--EXPECTF--
+
+Too many arguments
+
+Warning: ob_end_clean() expects exactly 0 parameters, 1 given in %s on line 10
+NULL
diff --git a/tests/output/ob_end_flush_basic_001.phpt b/tests/output/ob_end_flush_basic_001.phpt
new file mode 100644
index 0000000..cba7802
--- /dev/null
+++ b/tests/output/ob_end_flush_basic_001.phpt
@@ -0,0 +1,41 @@
+--TEST--
+Test ob_end_flush() function : basic functionality
+--FILE--
+<?php
+/* Prototype : proto bool ob_end_flush(void)
+ * Description: Flush (send) the output buffer, and delete current output buffer
+ * Source code: main/output.c
+ * Alias to functions:
+ */
+
+echo "*** Testing ob_end_flush() : basic functionality ***\n";
+
+// Zero arguments
+echo "\n-- Testing ob_end_flush() function with Zero arguments --\n";
+var_dump(ob_end_flush());
+
+ob_start();
+var_dump(ob_end_flush());
+
+ob_start();
+echo "Hello\n";
+var_dump(ob_end_flush());
+
+var_dump(ob_end_flush());
+
+echo "Done";
+?>
+--EXPECTF--
+*** Testing ob_end_flush() : basic functionality ***
+
+-- Testing ob_end_flush() function with Zero arguments --
+
+Notice: ob_end_flush(): failed to delete and flush buffer. No buffer to delete or flush in %s on line 12
+bool(false)
+bool(true)
+Hello
+bool(true)
+
+Notice: ob_end_flush(): failed to delete and flush buffer. No buffer to delete or flush in %s on line 21
+bool(false)
+Done
diff --git a/tests/output/ob_end_flush_error_001.phpt b/tests/output/ob_end_flush_error_001.phpt
new file mode 100644
index 0000000..7675f00
--- /dev/null
+++ b/tests/output/ob_end_flush_error_001.phpt
@@ -0,0 +1,27 @@
+--TEST--
+Test ob_end_flush() function : error conditions
+--FILE--
+<?php
+/* Prototype : proto bool ob_end_flush(void)
+ * Description: Flush (send) the output buffer, and delete current output buffer
+ * Source code: main/output.c
+ * Alias to functions:
+ */
+
+echo "*** Testing ob_end_flush() : error conditions ***\n";
+
+// One argument
+echo "\n-- Testing ob_end_flush() function with one argument --\n";
+$extra_arg = 10;;
+var_dump( ob_end_flush($extra_arg) );
+
+echo "Done";
+?>
+--EXPECTF--
+*** Testing ob_end_flush() : error conditions ***
+
+-- Testing ob_end_flush() function with one argument --
+
+Warning: ob_end_flush() expects exactly 0 parameters, 1 given in %s on line 13
+NULL
+Done
diff --git a/tests/output/ob_flush_basic_001.phpt b/tests/output/ob_flush_basic_001.phpt
new file mode 100644
index 0000000..57de5e3
--- /dev/null
+++ b/tests/output/ob_flush_basic_001.phpt
@@ -0,0 +1,39 @@
+--TEST--
+Test ob_flush() function : basic functionality
+--FILE--
+<?php
+/* Prototype : proto bool ob_flush(void)
+ * Description: Flush (send) contents of the output buffer. The last buffer content is sent to next buffer
+ * Source code: main/output.c
+ * Alias to functions:
+ */
+
+echo "*** Testing ob_flush() : basic functionality ***\n";
+
+// Zero arguments
+echo "\n-- Testing ob_flush() function with Zero arguments --\n";
+var_dump(ob_flush());
+
+ob_start();
+echo "This should get flushed.\n";
+var_dump(ob_flush());
+
+echo "Ensure the buffer is still active after the flush.\n";
+$out = ob_flush();
+var_dump($out);
+
+echo "Done";
+
+?>
+--EXPECTF--
+*** Testing ob_flush() : basic functionality ***
+
+-- Testing ob_flush() function with Zero arguments --
+
+Notice: ob_flush(): failed to flush buffer. No buffer to flush in %s on line 12
+bool(false)
+This should get flushed.
+bool(true)
+Ensure the buffer is still active after the flush.
+bool(true)
+Done
diff --git a/tests/output/ob_flush_error_001.phpt b/tests/output/ob_flush_error_001.phpt
new file mode 100644
index 0000000..f985040
--- /dev/null
+++ b/tests/output/ob_flush_error_001.phpt
@@ -0,0 +1,27 @@
+--TEST--
+Test ob_flush() function : error conditions
+--FILE--
+<?php
+/* Prototype : proto bool ob_flush(void)
+ * Description: Flush (send) contents of the output buffer. The last buffer content is sent to next buffer
+ * Source code: main/output.c
+ * Alias to functions:
+ */
+
+echo "*** Testing ob_flush() : error conditions ***\n";
+
+// One argument
+echo "\n-- Testing ob_flush() function with one argument --\n";
+$extra_arg = 10;;
+var_dump( ob_flush($extra_arg) );
+
+echo "Done";
+?>
+--EXPECTF--
+*** Testing ob_flush() : error conditions ***
+
+-- Testing ob_flush() function with one argument --
+
+Warning: ob_flush() expects exactly 0 parameters, 1 given in %s on line 13
+NULL
+Done
diff --git a/tests/output/ob_get_clean_basic_001.phpt b/tests/output/ob_get_clean_basic_001.phpt
new file mode 100644
index 0000000..635b58a
--- /dev/null
+++ b/tests/output/ob_get_clean_basic_001.phpt
@@ -0,0 +1,18 @@
+--TEST--
+Test return type and value, as well as basic behaviour, of ob_get_clean()
+--FILE--
+<?php
+/*
+ * proto bool ob_get_clean(void)
+ * Function is implemented in main/output.c
+*/
+
+var_dump(ob_get_clean());
+
+ob_start();
+echo "Hello World";
+var_dump(ob_get_clean());
+?>
+--EXPECTF--
+bool(false)
+string(11) "Hello World"
diff --git a/tests/output/ob_get_clean_basic_002.phpt b/tests/output/ob_get_clean_basic_002.phpt
new file mode 100644
index 0000000..a599273
--- /dev/null
+++ b/tests/output/ob_get_clean_basic_002.phpt
@@ -0,0 +1,20 @@
+--TEST--
+Test basic behaviour of ob_get_clean()
+--FILE--
+<?php
+/*
+ * proto bool ob_get_clean(void)
+ * Function is implemented in main/output.c
+*/
+
+ob_start();
+
+echo "Hello World";
+
+$out = ob_get_clean();
+$out = strtolower($out);
+
+var_dump($out);
+?>
+--EXPECT--
+string(11) "hello world" \ No newline at end of file
diff --git a/tests/output/ob_get_clean_error_001.phpt b/tests/output/ob_get_clean_error_001.phpt
new file mode 100644
index 0000000..a77a69e
--- /dev/null
+++ b/tests/output/ob_get_clean_error_001.phpt
@@ -0,0 +1,22 @@
+--TEST--
+Test wrong number of arguments for ob_get_clean()
+--FILE--
+<?php
+/*
+ * proto bool ob_get_clean(void)
+ * Function is implemented in main/output.c
+*/
+
+$extra_arg = 1;
+
+echo "\nToo many arguments\n";
+var_dump(ob_get_clean($extra_arg));
+
+
+?>
+--EXPECTF--
+
+Too many arguments
+
+Warning: ob_get_clean() expects exactly 0 parameters, 1 given in %s on line 10
+NULL \ No newline at end of file
diff --git a/tests/output/ob_get_contents_basic_001.phpt b/tests/output/ob_get_contents_basic_001.phpt
new file mode 100644
index 0000000..a990245
--- /dev/null
+++ b/tests/output/ob_get_contents_basic_001.phpt
@@ -0,0 +1,73 @@
+--TEST--
+Test ob_get_contents() function : basic functionality
+--CREDITS--
+Iain Lewis <ilewis@php.net>
+--FILE--
+<?php
+/* Prototype : proto string ob_get_contents(void)
+ * Description: Return the contents of the output buffer
+ * Source code: main/output.c
+ * Alias to functions:
+ */
+
+
+echo "*** Testing ob_get_contents() : basic functionality ***\n";
+
+// Zero arguments
+echo "\n-- Testing ob_get_contents() function with Zero arguments --\n";
+/* Buffering not started yet, should return false */
+var_dump( ob_get_contents() );
+
+ob_start();
+echo "Hello World\n";
+$hello = ob_get_contents();
+var_dump($hello);
+ob_end_flush();
+
+
+echo "\ncheck that we dont have a reference\n";
+ob_start();
+echo "Hello World\n";
+$hello2 = ob_get_contents();
+$hello2 = "bob";
+var_dump(ob_get_contents());
+ob_end_flush();
+
+echo "\ncheck that contents disappear after a flush\n";
+ob_start();
+echo "Hello World\n";
+ob_flush();
+var_dump(ob_get_contents());
+ob_end_flush();
+
+echo "\ncheck that no contents found after an end\n";
+ob_start();
+echo "Hello World\n";
+ob_end_flush();
+var_dump(ob_get_contents());
+
+
+echo "Done\n";
+?>
+--EXPECTF--
+*** Testing ob_get_contents() : basic functionality ***
+
+-- Testing ob_get_contents() function with Zero arguments --
+bool(false)
+Hello World
+string(12) "Hello World
+"
+
+check that we dont have a reference
+Hello World
+string(12) "Hello World
+"
+
+check that contents disappear after a flush
+Hello World
+string(0) ""
+
+check that no contents found after an end
+Hello World
+bool(false)
+Done \ No newline at end of file
diff --git a/tests/output/ob_get_contents_error_001.phpt b/tests/output/ob_get_contents_error_001.phpt
new file mode 100644
index 0000000..94e3f31
--- /dev/null
+++ b/tests/output/ob_get_contents_error_001.phpt
@@ -0,0 +1,32 @@
+--TEST--
+Test ob_get_contents() function : error cases
+--CREDITS--
+Iain Lewis <ilewis@php.net>
+--FILE--
+<?php
+/* Prototype : proto string ob_get_contents(void)
+ * Description: Return the contents of the output buffer
+ * Source code: main/output.c
+ * Alias to functions:
+ */
+
+
+echo "*** Testing ob_get_contents() : error cases ***\n";
+
+var_dump(ob_get_contents("bob"));
+
+ob_start();
+
+var_dump(ob_get_contents("bob2",345));
+
+echo "Done\n";
+?>
+--EXPECTF--
+*** Testing ob_get_contents() : error cases ***
+
+Warning: ob_get_contents() expects exactly 0 parameters, 1 given in %s on line 11
+NULL
+
+Warning: ob_get_contents() expects exactly 0 parameters, 2 given in %s on line 15
+NULL
+Done
diff --git a/tests/output/ob_get_length_basic_001.phpt b/tests/output/ob_get_length_basic_001.phpt
new file mode 100644
index 0000000..98469c2
--- /dev/null
+++ b/tests/output/ob_get_length_basic_001.phpt
@@ -0,0 +1,37 @@
+--TEST--
+Test return type and value, as well as basic behaviour, of ob_get_length()
+--FILE--
+<?php
+/*
+ * proto int ob_get_length(void)
+ * Function is implemented in main/output.c
+*/
+
+echo "No output buffers\n";
+var_dump(ob_get_length());
+
+ob_start();
+var_dump(ob_get_length());
+echo "hello\n";
+var_dump(ob_get_length());
+ob_flush();
+$value = ob_get_length();
+echo "hello\n";
+ob_clean();
+var_dump(ob_get_length());
+var_dump($value);
+ob_end_flush();
+
+echo "No output buffers\n";
+var_dump(ob_get_length());
+?>
+--EXPECTF--
+No output buffers
+bool(false)
+int(0)
+hello
+int(13)
+int(0)
+int(0)
+No output buffers
+bool(false) \ No newline at end of file
diff --git a/tests/output/ob_get_length_error_001.phpt b/tests/output/ob_get_length_error_001.phpt
new file mode 100644
index 0000000..8218b50
--- /dev/null
+++ b/tests/output/ob_get_length_error_001.phpt
@@ -0,0 +1,22 @@
+--TEST--
+Test wrong number of arguments for ob_get_length()
+--FILE--
+<?php
+/*
+ * proto int ob_get_length(void)
+ * Function is implemented in main/output.c
+*/
+
+$extra_arg = 1;
+
+echo "\nToo many arguments\n";
+var_dump(ob_get_length($extra_arg));
+
+
+?>
+--EXPECTF--
+
+Too many arguments
+
+Warning: ob_get_length() expects exactly 0 parameters, 1 given in %s on line 10
+NULL \ No newline at end of file
diff --git a/tests/output/ob_get_level_basic_001.phpt b/tests/output/ob_get_level_basic_001.phpt
new file mode 100644
index 0000000..65f3291
--- /dev/null
+++ b/tests/output/ob_get_level_basic_001.phpt
@@ -0,0 +1,47 @@
+--TEST--
+Test ob_get_level() function : basic functionality
+--FILE--
+<?php
+/* Prototype : proto int ob_get_level(void)
+ * Description: Return the nesting level of the output buffer
+ * Source code: main/output.c
+ * Alias to functions:
+ */
+
+echo "*** Testing ob_get_level() : basic functionality ***\n";
+
+// Zero arguments
+echo "\n-- Testing ob_get_level() function with Zero arguments --\n";
+var_dump(ob_get_level());
+
+ob_start();
+var_dump(ob_get_level());
+
+ob_start();
+var_dump(ob_get_level());
+
+ob_end_flush();
+var_dump(ob_get_level());
+
+ob_end_flush();
+var_dump(ob_get_level());
+
+ob_end_flush();
+var_dump(ob_get_level());
+
+
+echo "Done";
+?>
+--EXPECTF--
+*** Testing ob_get_level() : basic functionality ***
+
+-- Testing ob_get_level() function with Zero arguments --
+int(0)
+int(1)
+int(2)
+int(1)
+int(0)
+
+Notice: ob_end_flush(): failed to delete and flush buffer. No buffer to delete or flush in %s on line 26
+int(0)
+Done
diff --git a/tests/output/ob_get_level_error_001.phpt b/tests/output/ob_get_level_error_001.phpt
new file mode 100644
index 0000000..326dd24
--- /dev/null
+++ b/tests/output/ob_get_level_error_001.phpt
@@ -0,0 +1,27 @@
+--TEST--
+Test ob_get_level() function : error conditions
+--FILE--
+<?php
+/* Prototype : proto int ob_get_level(void)
+ * Description: Return the nesting level of the output buffer
+ * Source code: main/output.c
+ * Alias to functions:
+ */
+
+echo "*** Testing ob_get_level() : error conditions ***\n";
+
+// One argument
+echo "\n-- Testing ob_get_level() function with one argument --\n";
+$extra_arg = 10;;
+var_dump( ob_get_level($extra_arg) );
+
+echo "Done";
+?>
+--EXPECTF--
+*** Testing ob_get_level() : error conditions ***
+
+-- Testing ob_get_level() function with one argument --
+
+Warning: ob_get_level() expects exactly 0 parameters, 1 given in %s on line 13
+NULL
+Done \ No newline at end of file
diff --git a/tests/output/ob_get_status.phpt b/tests/output/ob_get_status.phpt
new file mode 100644
index 0000000..9580729
--- /dev/null
+++ b/tests/output/ob_get_status.phpt
@@ -0,0 +1,33 @@
+--TEST--
+ob_get_status() function basic test
+--CREDITS--
+Sebastian Schürmann
+sebs@php.net
+Testfest 2009 Munich
+--FILE--
+<?php
+ob_start();
+$status = ob_get_status(true);
+ob_end_clean();
+var_dump($status);
+?>
+--EXPECT--
+array(1) {
+ [0]=>
+ array(7) {
+ ["name"]=>
+ string(22) "default output handler"
+ ["type"]=>
+ int(0)
+ ["flags"]=>
+ int(112)
+ ["level"]=>
+ int(0)
+ ["chunk_size"]=>
+ int(0)
+ ["buffer_size"]=>
+ int(16384)
+ ["buffer_used"]=>
+ int(0)
+ }
+}
diff --git a/tests/output/ob_implicit_flush_basic_001.phpt b/tests/output/ob_implicit_flush_basic_001.phpt
new file mode 100644
index 0000000..ab6f6a7
--- /dev/null
+++ b/tests/output/ob_implicit_flush_basic_001.phpt
@@ -0,0 +1,24 @@
+--TEST--
+Test ob_implicit_flush() function : check return value (always null).
+--FILE--
+<?php
+/* Prototype : proto void ob_implicit_flush([int flag])
+ * Description: Turn implicit flush on/off and is equivalent to calling flush() after every output call
+ * Source code: main/output.c
+ * Alias to functions:
+ */
+
+echo "*** Testing ob_implicit_flush() : check return value ***\n";
+
+var_dump(ob_implicit_flush());
+var_dump(ob_implicit_flush(true));
+var_dump(ob_implicit_flush(false));
+
+echo "Done";
+?>
+--EXPECTF--
+*** Testing ob_implicit_flush() : check return value ***
+NULL
+NULL
+NULL
+Done
diff --git a/tests/output/ob_implicit_flush_basic_002.phpt b/tests/output/ob_implicit_flush_basic_002.phpt
new file mode 100644
index 0000000..6b378a7
--- /dev/null
+++ b/tests/output/ob_implicit_flush_basic_002.phpt
@@ -0,0 +1,29 @@
+--TEST--
+Test ob_implicit_flush() function : ensure implicit flushing does not apply to user buffers.
+--FILE--
+<?php
+/* Prototype : proto void ob_implicit_flush([int flag])
+ * Description: Turn implicit flush on/off and is equivalent to calling flush() after every output call
+ * Source code: main/output.c
+ * Alias to functions:
+ */
+
+echo "*** Testing ob_implicit_flush() : ensure implicit flushing does not apply to user buffers. ***\n";
+
+// Start a user buffer
+ob_start();
+// Switch on implicit flushing.
+ob_implicit_flush(1);
+
+echo "This is being written to a user buffer.\n";
+echo "Note that even though implicit flushing is on, you should never see this,\n";
+echo "because implicit flushing affects only the top level buffer, not user buffers.\n";
+
+// Wipe the user buffer. Nothing should have been flushed.
+ob_end_clean();
+
+echo "Done";
+?>
+--EXPECTF--
+*** Testing ob_implicit_flush() : ensure implicit flushing does not apply to user buffers. ***
+Done \ No newline at end of file
diff --git a/tests/output/ob_implicit_flush_error_001.phpt b/tests/output/ob_implicit_flush_error_001.phpt
new file mode 100644
index 0000000..1df38ca
--- /dev/null
+++ b/tests/output/ob_implicit_flush_error_001.phpt
@@ -0,0 +1,29 @@
+--TEST--
+Test ob_implicit_flush() function : wrong number of arguments
+--FILE--
+<?php
+/* Prototype : proto void ob_implicit_flush([int flag])
+ * Description: Turn implicit flush on/off and is equivalent to calling flush() after every output call
+ * Source code: main/output.c
+ * Alias to functions:
+ */
+
+echo "*** Testing ob_implicit_flush() : error conditions ***\n";
+
+
+//Test ob_implicit_flush with one more than the expected number of arguments
+echo "\n-- Testing ob_implicit_flush() function with more than expected no. of arguments --\n";
+$flag = 10;
+$extra_arg = 10;
+var_dump( ob_implicit_flush($flag, $extra_arg) );
+
+echo "Done";
+?>
+--EXPECTF--
+*** Testing ob_implicit_flush() : error conditions ***
+
+-- Testing ob_implicit_flush() function with more than expected no. of arguments --
+
+Warning: ob_implicit_flush() expects at most 1 parameter, 2 given in %s on line 15
+NULL
+Done \ No newline at end of file
diff --git a/tests/output/ob_implicit_flush_variation_001.phpt b/tests/output/ob_implicit_flush_variation_001.phpt
new file mode 100644
index 0000000..ef5a9ef
--- /dev/null
+++ b/tests/output/ob_implicit_flush_variation_001.phpt
@@ -0,0 +1,192 @@
+--TEST--
+Test ob_implicit_flush() function : usage variation
+--FILE--
+<?php
+/* Prototype : void ob_implicit_flush([int flag])
+ * Description: Turn implicit flush on/off and is equivalent to calling flush() after every output call
+ * Source code: main/output.c
+ * Alias to functions:
+ */
+
+echo "*** Testing ob_implicit_flush() : usage variation ***\n";
+
+// Define error handler
+function test_error_handler($err_no, $err_msg, $filename, $linenum, $vars) {
+ if (error_reporting() != 0) {
+ // report non-silenced errors
+ echo "Error: $err_no - $err_msg, $filename($linenum)\n";
+ }
+}
+set_error_handler('test_error_handler');
+
+// Initialise function arguments not being substituted (if any)
+
+//get an unset variable
+$unset_var = 10;
+unset ($unset_var);
+
+// define some classes
+class classWithToString
+{
+ public function __toString() {
+ return "Class A object";
+ }
+}
+
+class classWithoutToString
+{
+}
+
+// heredoc string
+$heredoc = <<<EOT
+hello world
+EOT;
+
+// add arrays
+$index_array = array (1, 2, 3);
+$assoc_array = array ('one' => 1, 'two' => 2);
+
+//array of values to iterate over
+$inputs = array(
+
+ // float data
+ 'float 10.5' => 10.5,
+ 'float -10.5' => -10.5,
+ 'float 12.3456789000e10' => 12.3456789000e10,
+ 'float -12.3456789000e10' => -12.3456789000e10,
+ 'float .5' => .5,
+
+ // array data
+ 'empty array' => array(),
+ 'int indexed array' => $index_array,
+ 'associative array' => $assoc_array,
+ 'nested arrays' => array('foo', $index_array, $assoc_array),
+
+ // null data
+ 'uppercase NULL' => NULL,
+ 'lowercase null' => null,
+
+ // boolean data
+ 'lowercase true' => true,
+ 'lowercase false' =>false,
+ 'uppercase TRUE' =>TRUE,
+ 'uppercase FALSE' =>FALSE,
+
+ // empty data
+ 'empty string DQ' => "",
+ 'empty string SQ' => '',
+
+ // string data
+ 'string DQ' => "string",
+ 'string SQ' => 'string',
+ 'mixed case string' => "sTrInG",
+ 'heredoc' => $heredoc,
+
+ // object data
+ 'instance of classWithToString' => new classWithToString(),
+ 'instance of classWithoutToString' => new classWithoutToString(),
+
+ // undefined data
+ 'undefined var' => @$undefined_var,
+
+ // unset data
+ 'unset var' => @$unset_var,
+);
+
+// loop through each element of the array for flag
+
+foreach($inputs as $key =>$value) {
+ echo "\n--$key--\n";
+ var_dump( ob_implicit_flush($value) );
+};
+
+?>
+--EXPECTF--
+*** Testing ob_implicit_flush() : usage variation ***
+
+--float 10.5--
+NULL
+
+--float -10.5--
+NULL
+
+--float 12.3456789000e10--
+NULL
+
+--float -12.3456789000e10--
+NULL
+
+--float .5--
+NULL
+
+--empty array--
+Error: 2 - ob_implicit_flush() expects parameter 1 to be long, array given, %s(97)
+NULL
+
+--int indexed array--
+Error: 2 - ob_implicit_flush() expects parameter 1 to be long, array given, %s(97)
+NULL
+
+--associative array--
+Error: 2 - ob_implicit_flush() expects parameter 1 to be long, array given, %s(97)
+NULL
+
+--nested arrays--
+Error: 2 - ob_implicit_flush() expects parameter 1 to be long, array given, %s(97)
+NULL
+
+--uppercase NULL--
+NULL
+
+--lowercase null--
+NULL
+
+--lowercase true--
+NULL
+
+--lowercase false--
+NULL
+
+--uppercase TRUE--
+NULL
+
+--uppercase FALSE--
+NULL
+
+--empty string DQ--
+Error: 2 - ob_implicit_flush() expects parameter 1 to be long, %unicode_string_optional% given, %s(97)
+NULL
+
+--empty string SQ--
+Error: 2 - ob_implicit_flush() expects parameter 1 to be long, %unicode_string_optional% given, %s(97)
+NULL
+
+--string DQ--
+Error: 2 - ob_implicit_flush() expects parameter 1 to be long, %unicode_string_optional% given, %s(97)
+NULL
+
+--string SQ--
+Error: 2 - ob_implicit_flush() expects parameter 1 to be long, %unicode_string_optional% given, %s(97)
+NULL
+
+--mixed case string--
+Error: 2 - ob_implicit_flush() expects parameter 1 to be long, %unicode_string_optional% given, %s(97)
+NULL
+
+--heredoc--
+Error: 2 - ob_implicit_flush() expects parameter 1 to be long, %unicode_string_optional% given, %s(97)
+NULL
+
+--instance of classWithToString--
+Error: 2 - ob_implicit_flush() expects parameter 1 to be long, object given, %s(97)
+NULL
+
+--instance of classWithoutToString--
+Error: 2 - ob_implicit_flush() expects parameter 1 to be long, object given, %s(97)
+NULL
+
+--undefined var--
+NULL
+
+--unset var--
+NULL \ No newline at end of file
diff --git a/tests/output/ob_start_basic_001.phpt b/tests/output/ob_start_basic_001.phpt
new file mode 100644
index 0000000..d93a731
--- /dev/null
+++ b/tests/output/ob_start_basic_001.phpt
@@ -0,0 +1,14 @@
+--TEST--
+Test return type and value for ob_start()
+--FILE--
+<?php
+/*
+ * proto bool ob_start([ string|array user_function [, int chunk_size [, bool erase]]])
+ * Function is implemented in main/output.c
+*/
+
+var_dump(ob_start());
+
+?>
+--EXPECT--
+bool(true) \ No newline at end of file
diff --git a/tests/output/ob_start_basic_002.phpt b/tests/output/ob_start_basic_002.phpt
new file mode 100644
index 0000000..92d9069
--- /dev/null
+++ b/tests/output/ob_start_basic_002.phpt
@@ -0,0 +1,55 @@
+--TEST--
+ob_start(): Check behaviour with various callback return values.
+--FILE--
+<?php
+function return_empty_string($string) {
+ return "";
+}
+
+function return_false($string) {
+ return false;
+}
+
+function return_null($string) {
+ return null;
+}
+
+function return_string($string) {
+ return "I stole your output.";
+}
+
+function return_zero($string) {
+ return 0;
+}
+
+// Use each of the above functions as an output buffering callback:
+$functions = get_defined_functions();
+$callbacks = $functions['user'];
+sort($callbacks);
+foreach ($callbacks as $callback) {
+ echo "--> Use callback '$callback':\n";
+ ob_start($callback);
+ echo 'My output.';
+ ob_end_flush();
+ echo "\n\n";
+}
+
+?>
+==DONE==
+--EXPECTF--
+--> Use callback 'return_empty_string':
+
+
+--> Use callback 'return_false':
+My output.
+
+--> Use callback 'return_null':
+
+
+--> Use callback 'return_string':
+I stole your output.
+
+--> Use callback 'return_zero':
+0
+
+==DONE== \ No newline at end of file
diff --git a/tests/output/ob_start_basic_003.phpt b/tests/output/ob_start_basic_003.phpt
new file mode 100644
index 0000000..ebd883a
--- /dev/null
+++ b/tests/output/ob_start_basic_003.phpt
@@ -0,0 +1,18 @@
+--TEST--
+ob_start(): ensure even fatal error test is affected by output buffering.
+--FILE--
+<?php
+
+function f() {
+ return "I have stolen your output";
+}
+
+ob_start('f');
+cause_fatal_error(); // call undefined function
+ob_end_flush();
+
+echo "done (you shouldn't see this)";
+
+?>
+--EXPECTF--
+I have stolen your output \ No newline at end of file
diff --git a/tests/output/ob_start_basic_004.phpt b/tests/output/ob_start_basic_004.phpt
new file mode 100644
index 0000000..16f09e8
--- /dev/null
+++ b/tests/output/ob_start_basic_004.phpt
@@ -0,0 +1,132 @@
+--TEST--
+ob_start() chunk_size: confirm buffer is flushed after any output call that causes its length to equal or exceed chunk_size.
+--FILE--
+<?php
+/*
+ * proto bool ob_start([ string|array user_function [, int chunk_size [, bool erase]]])
+ * Function is implemented in main/output.c
+*/
+// In HEAD, $chunk_size value of 1 should not have any special behaviour (http://marc.info/?l=php-internals&m=123476465621346&w=2).
+function callback($string) {
+ global $callback_invocations;
+ $callback_invocations++;
+ $len = strlen($string);
+ return "f[call:$callback_invocations; len:$len]$string\n";
+}
+
+for ($cs=-1; $cs<10; $cs++) {
+ echo "\n----( chunk_size: $cs, output append size: 1 )----\n";
+ $callback_invocations=0;
+ ob_start('callback', $cs);
+ echo '1'; echo '2'; echo '3'; echo '4'; echo '5'; echo '6'; echo '7'; echo '8';
+ ob_end_flush();
+}
+
+for ($cs=-1; $cs<10; $cs++) {
+ echo "\n----( chunk_size: $cs, output append size: 4 )----\n";
+ $callback_invocations=0;
+ ob_start('callback', $cs);
+ echo '1234'; echo '5678';
+ ob_end_flush();
+}
+
+?>
+--EXPECTF--
+
+----( chunk_size: -1, output append size: 1 )----
+f[call:1; len:8]12345678
+
+----( chunk_size: 0, output append size: 1 )----
+f[call:1; len:8]12345678
+
+----( chunk_size: 1, output append size: 1 )----
+f[call:1; len:1]1
+f[call:2; len:1]2
+f[call:3; len:1]3
+f[call:4; len:1]4
+f[call:5; len:1]5
+f[call:6; len:1]6
+f[call:7; len:1]7
+f[call:8; len:1]8
+f[call:9; len:0]
+
+----( chunk_size: 2, output append size: 1 )----
+f[call:1; len:2]12
+f[call:2; len:2]34
+f[call:3; len:2]56
+f[call:4; len:2]78
+f[call:5; len:0]
+
+----( chunk_size: 3, output append size: 1 )----
+f[call:1; len:3]123
+f[call:2; len:3]456
+f[call:3; len:2]78
+
+----( chunk_size: 4, output append size: 1 )----
+f[call:1; len:4]1234
+f[call:2; len:4]5678
+f[call:3; len:0]
+
+----( chunk_size: 5, output append size: 1 )----
+f[call:1; len:5]12345
+f[call:2; len:3]678
+
+----( chunk_size: 6, output append size: 1 )----
+f[call:1; len:6]123456
+f[call:2; len:2]78
+
+----( chunk_size: 7, output append size: 1 )----
+f[call:1; len:7]1234567
+f[call:2; len:1]8
+
+----( chunk_size: 8, output append size: 1 )----
+f[call:1; len:8]12345678
+f[call:2; len:0]
+
+----( chunk_size: 9, output append size: 1 )----
+f[call:1; len:8]12345678
+
+----( chunk_size: -1, output append size: 4 )----
+f[call:1; len:8]12345678
+
+----( chunk_size: 0, output append size: 4 )----
+f[call:1; len:8]12345678
+
+----( chunk_size: 1, output append size: 4 )----
+f[call:1; len:4]1234
+f[call:2; len:4]5678
+f[call:3; len:0]
+
+----( chunk_size: 2, output append size: 4 )----
+f[call:1; len:4]1234
+f[call:2; len:4]5678
+f[call:3; len:0]
+
+----( chunk_size: 3, output append size: 4 )----
+f[call:1; len:4]1234
+f[call:2; len:4]5678
+f[call:3; len:0]
+
+----( chunk_size: 4, output append size: 4 )----
+f[call:1; len:4]1234
+f[call:2; len:4]5678
+f[call:3; len:0]
+
+----( chunk_size: 5, output append size: 4 )----
+f[call:1; len:8]12345678
+f[call:2; len:0]
+
+----( chunk_size: 6, output append size: 4 )----
+f[call:1; len:8]12345678
+f[call:2; len:0]
+
+----( chunk_size: 7, output append size: 4 )----
+f[call:1; len:8]12345678
+f[call:2; len:0]
+
+----( chunk_size: 8, output append size: 4 )----
+f[call:1; len:8]12345678
+f[call:2; len:0]
+
+----( chunk_size: 9, output append size: 4 )----
+f[call:1; len:8]12345678 \ No newline at end of file
diff --git a/tests/output/ob_start_basic_005.phpt b/tests/output/ob_start_basic_005.phpt
new file mode 100644
index 0000000..4048ad2
--- /dev/null
+++ b/tests/output/ob_start_basic_005.phpt
@@ -0,0 +1,33 @@
+--TEST--
+ob_start(): non-static method as static callbacks.
+--FILE--
+<?php
+/*
+ * proto bool ob_start([ string|array user_function [, int chunk_size [, bool erase]]])
+ * Function is implemented in main/output.c
+*/
+
+Class C {
+ function h($string) {
+ return $string;
+ }
+}
+
+function checkAndClean() {
+ print_r(ob_list_handlers());
+ while (ob_get_level()>0) {
+ ob_end_flush();
+ }
+}
+
+var_dump(ob_start('C::h'));
+checkAndClean();
+
+?>
+--EXPECTF--
+Warning: ob_start(): non-static method C::h() should not be called statically in %s on line 20
+bool(true)
+Array
+(
+ [0] => C::h
+)
diff --git a/tests/output/ob_start_basic_006.phpt b/tests/output/ob_start_basic_006.phpt
new file mode 100644
index 0000000..464e71b
--- /dev/null
+++ b/tests/output/ob_start_basic_006.phpt
@@ -0,0 +1,135 @@
+--TEST--
+ob_start(): ensure multiple buffer initialization with a single call using arrays is not supported on PHP6 (http://bugs.php.net/42641)
+--FILE--
+<?php
+/*
+ * proto bool ob_start([ string|array user_function [, int chunk_size [, bool erase]]])
+ * Function is implemented in main/output.c
+*/
+
+function f($string) {
+ static $i=0;
+ $i++;
+ $len = strlen($string);
+ return "f[call:$i; len:$len] - $string\n";
+}
+
+Class C {
+ public $id = 'none';
+
+ function __construct($id) {
+ $this->id = $id;
+ }
+
+ static function g($string) {
+ static $i=0;
+ $i++;
+ $len = strlen($string);
+ return "C::g[call:$i; len:$len] - $string\n";
+ }
+
+ function h($string) {
+ static $i=0;
+ $i++;
+ $len = strlen($string);
+ return "C::h[call:$i; len:$len; id:$this->id] - $string\n";
+ }
+}
+
+function checkAndClean() {
+ print_r(ob_list_handlers());
+ while (ob_get_level()>0) {
+ ob_end_flush();
+ }
+}
+
+echo "\n ---> Test arrays: \n";
+var_dump(ob_start(array("f")));
+checkAndClean();
+
+var_dump(ob_start(array("f", "f")));
+checkAndClean();
+
+var_dump(ob_start(array("f", "C::g", "f", "C::g")));
+checkAndClean();
+
+var_dump(ob_start(array("f", "non_existent", "f")));
+checkAndClean();
+
+var_dump(ob_start(array("f", "non_existent", "f", "f")));
+checkAndClean();
+
+$c = new c('originalID');
+var_dump(ob_start(array($c, "h")));
+checkAndClean();
+
+var_dump(ob_start(array($c, "h")));
+$c->id = 'changedID';
+checkAndClean();
+
+$c->id = 'changedIDagain';
+var_dump(ob_start(array('f', 'C::g', array(array($c, "g"), array($c, "h")))));
+checkAndClean();
+?>
+--EXPECTF--
+ ---> Test arrays:
+
+Warning: ob_start(): array must have exactly two members in %s on line 44
+
+Notice: ob_start(): failed to create buffer in %s on line 44
+bool(false)
+Array
+(
+)
+
+Warning: ob_start(): class 'f' not found in %s on line 47
+
+Notice: ob_start(): failed to create buffer in %s on line 47
+bool(false)
+Array
+(
+)
+
+Warning: ob_start(): array must have exactly two members in %s on line 50
+
+Notice: ob_start(): failed to create buffer in %s on line 50
+bool(false)
+Array
+(
+)
+
+Warning: ob_start(): array must have exactly two members in %s on line 53
+
+Notice: ob_start(): failed to create buffer in %s on line 53
+bool(false)
+Array
+(
+)
+
+Warning: ob_start(): array must have exactly two members in %s on line 56
+
+Notice: ob_start(): failed to create buffer in %s on line 56
+bool(false)
+Array
+(
+)
+C::h[call:1; len:37; id:originalID] - bool(true)
+Array
+(
+ [0] => C::h
+)
+
+C::h[call:2; len:37; id:changedID] - bool(true)
+Array
+(
+ [0] => C::h
+)
+
+
+Warning: ob_start(): array must have exactly two members in %s on line 68
+
+Notice: ob_start(): failed to create buffer in %s on line 68
+bool(false)
+Array
+(
+)
diff --git a/tests/output/ob_start_basic_unerasable_001.phpt b/tests/output/ob_start_basic_unerasable_001.phpt
new file mode 100644
index 0000000..8e7280e
--- /dev/null
+++ b/tests/output/ob_start_basic_unerasable_001.phpt
@@ -0,0 +1,22 @@
+--TEST--
+ob_start(): Ensure content of unerasable buffer can be accessed by ob_get_contents().
+--FILE--
+<?php
+function callback($string) {
+ static $callback_invocations;
+ $callback_invocations++;
+ return "[callback:$callback_invocations]$string\n";
+}
+
+ob_start('callback', 0, false);
+
+echo "This call will obtain the content:\n";
+$str = ob_get_contents();
+var_dump($str);
+?>
+==DONE==
+--EXPECTF--
+[callback:1]This call will obtain the content:
+string(35) "This call will obtain the content:
+"
+==DONE== \ No newline at end of file
diff --git a/tests/output/ob_start_basic_unerasable_002.phpt b/tests/output/ob_start_basic_unerasable_002.phpt
new file mode 100644
index 0000000..21db1f3
--- /dev/null
+++ b/tests/output/ob_start_basic_unerasable_002.phpt
@@ -0,0 +1,33 @@
+--TEST--
+ob_start(): Ensure unerasable buffer cannot be erased by ob_clean(), ob_end_clean() or ob_end_flush().
+--FILE--
+<?php
+function callback($string) {
+ static $callback_invocations;
+ $callback_invocations++;
+ return "[callback:$callback_invocations]$string\n";
+}
+
+ob_start('callback', 0, false);
+
+echo "All of the following calls will fail to clean/remove the topmost buffer:\n";
+var_dump(ob_clean());
+var_dump(ob_end_clean());
+var_dump(ob_end_flush());
+
+echo "The OB nesting will still be 1 level deep:\n";
+var_dump(ob_get_level());
+?>
+--EXPECTF--
+[callback:1]All of the following calls will fail to clean/remove the topmost buffer:
+
+Notice: ob_clean(): failed to delete buffer of callback (0) in %s on line 11
+bool(false)
+
+Notice: ob_end_clean(): failed to discard buffer of callback (0) in %s on line 12
+bool(false)
+
+Notice: ob_end_flush(): failed to send buffer of callback (0) in %s on line 13
+bool(false)
+The OB nesting will still be 1 level deep:
+int(1) \ No newline at end of file
diff --git a/tests/output/ob_start_basic_unerasable_003.phpt b/tests/output/ob_start_basic_unerasable_003.phpt
new file mode 100644
index 0000000..6eb6418
--- /dev/null
+++ b/tests/output/ob_start_basic_unerasable_003.phpt
@@ -0,0 +1,22 @@
+--TEST--
+ob_start(): Ensure unerasable buffer cannot be accessed or erased by ob_get_clean().
+--FILE--
+<?php
+function callback($string) {
+ static $callback_invocations;
+ $callback_invocations++;
+ return "[callback:$callback_invocations]$string\n";
+}
+
+ob_start('callback', 0, false);
+
+echo "This call will obtain the content, but will not clean the buffer.";
+$str = ob_get_clean();
+var_dump($str);
+?>
+--EXPECTF--
+[callback:1]This call will obtain the content, but will not clean the buffer.
+Notice: ob_get_clean(): failed to discard buffer of callback (0) in %s on line 11
+
+Notice: ob_get_clean(): failed to delete buffer of callback (0) in %s on line 11
+string(65) "This call will obtain the content, but will not clean the buffer." \ No newline at end of file
diff --git a/tests/output/ob_start_basic_unerasable_004.phpt b/tests/output/ob_start_basic_unerasable_004.phpt
new file mode 100644
index 0000000..62d9756
--- /dev/null
+++ b/tests/output/ob_start_basic_unerasable_004.phpt
@@ -0,0 +1,22 @@
+--TEST--
+ob_start(): Ensure unerasable buffer cannot be accessed or flushed by ob_get_flush().
+--FILE--
+<?php
+function callback($string) {
+ static $callback_invocations;
+ $callback_invocations++;
+ return "[callback:$callback_invocations]$string\n";
+}
+
+ob_start('callback', 0, false);
+
+echo "This call will obtain the content, but will not flush the buffer.";
+$str = ob_get_flush();
+var_dump($str);
+?>
+--EXPECTF--
+[callback:1]This call will obtain the content, but will not flush the buffer.
+Notice: ob_get_flush(): failed to send buffer of callback (0) in %s on line 11
+
+Notice: ob_get_flush(): failed to delete buffer of callback (0) in %s on line 11
+string(65) "This call will obtain the content, but will not flush the buffer." \ No newline at end of file
diff --git a/tests/output/ob_start_basic_unerasable_005.phpt b/tests/output/ob_start_basic_unerasable_005.phpt
new file mode 100644
index 0000000..2c52f00
--- /dev/null
+++ b/tests/output/ob_start_basic_unerasable_005.phpt
@@ -0,0 +1,25 @@
+--TEST--
+ob_start(): Ensure unerasable buffer cannot be flushed by ob_flush()
+--FILE--
+<?php
+function callback($string) {
+ static $callback_invocations;
+ $callback_invocations++;
+ return "[callback:$callback_invocations]$string\n";
+}
+
+ob_start('callback', 0, false);
+
+echo "Attempt to flush unerasable buffer - should fail... ";
+var_dump(ob_flush());
+// Check content of buffer after flush - if flush failed it should still contain the string above.
+var_dump(ob_get_contents());
+?>
+--EXPECTF--
+[callback:1]Attempt to flush unerasable buffer - should fail...
+Notice: ob_flush(): failed to flush buffer of callback (0) in %s on line 11
+bool(false)
+string(%d) "Attempt to flush unerasable buffer - should fail...
+Notice: ob_flush(): failed to flush buffer of callback (0) in %s on line 11
+bool(false)
+"
diff --git a/tests/output/ob_start_callbacks.phpt b/tests/output/ob_start_callbacks.phpt
new file mode 100644
index 0000000..da52d85
--- /dev/null
+++ b/tests/output/ob_start_callbacks.phpt
@@ -0,0 +1,39 @@
+--TEST--
+Test ob_start() with callbacks in variables
+--FILE--
+<?php
+
+// Closure in variable
+$a = function ($s) { return strtoupper($s); };
+ob_start($a);
+echo 'closure in variable', "\n";
+ob_end_flush();
+
+// Object (array) in variable
+class foo {
+ static function out($foo) {
+ return strtoupper($foo);
+ }
+}
+$a = array('foo', 'out');
+ob_start($a);
+echo 'object in variable', "\n";
+ob_end_flush();
+
+// Object with static array
+ob_start(array('foo', 'out'));
+echo 'object via static array', "\n";
+ob_end_flush();
+
+function my_strtoupper($foo, $bar) {
+ return strtoupper($foo);
+}
+$a = 'my_strtoupper';
+ob_start($a);
+echo 'function via variable', "\n";
+ob_end_flush();
+--EXPECT--
+CLOSURE IN VARIABLE
+OBJECT IN VARIABLE
+OBJECT VIA STATIC ARRAY
+FUNCTION VIA VARIABLE
diff --git a/tests/output/ob_start_error_001.phpt b/tests/output/ob_start_error_001.phpt
new file mode 100644
index 0000000..b45de83
--- /dev/null
+++ b/tests/output/ob_start_error_001.phpt
@@ -0,0 +1,53 @@
+--TEST--
+Test wrong number of arguments and wrong arg types for ob_start()
+--FILE--
+<?php
+/*
+ * proto bool ob_start([ string|array user_function [, int chunk_size [, bool erase]]])
+ * Function is implemented in main/output.c
+*/
+
+function justPrint($str) {
+ return $str;
+}
+
+$arg_1 = "justPrint";
+$arg_2 = 0;
+$arg_3 = false;
+$extra_arg = 1;
+
+echo "\n- Too many arguments\n";
+var_dump(ob_start($arg_1, $arg_2, $arg_3, $extra_arg));
+
+echo "\n- Arg 1 wrong type\n";
+var_dump(ob_start(1.5));
+
+echo "\n- Arg 2 wrong type\n";
+var_dump(ob_start("justPrint", "this should be an int"));
+
+echo "\n- Arg 3 wrong type\n";
+var_dump(ob_start("justPrint", 0, "this should be a bool"));
+
+?>
+--EXPECTF--
+- Too many arguments
+
+Warning: ob_start() expects at most 3 parameters, 4 given in %s on line 17
+NULL
+
+- Arg 1 wrong type
+
+Warning: ob_start(): no array or string given in %s on line 20
+
+Notice: ob_start(): failed to create buffer in %s on line 20
+bool(false)
+
+- Arg 2 wrong type
+
+Warning: ob_start() expects parameter 2 to be long, string given in %s on line 23
+NULL
+
+- Arg 3 wrong type
+
+Warning: ob_start() expects parameter 3 to be long, string given in %s on line 26
+NULL
diff --git a/tests/output/ob_start_error_002.phpt b/tests/output/ob_start_error_002.phpt
new file mode 100644
index 0000000..38c7899
--- /dev/null
+++ b/tests/output/ob_start_error_002.phpt
@@ -0,0 +1,42 @@
+--TEST--
+Test wrong number of arguments and wrong arg types for ob_start()
+--FILE--
+<?php
+/*
+ * proto bool ob_start([ string|array user_function [, int chunk_size [, bool erase]]])
+ * Function is implemented in main/output.c
+*/
+
+Class C {
+ static function f($str) {
+ return $str;
+ }
+}
+
+var_dump(ob_start(array("nonExistent","f")));
+var_dump(ob_start(array("C","nonExistent")));
+var_dump(ob_start("C::no"));
+var_dump(ob_start("no"));
+echo "done"
+?>
+--EXPECTF--
+Warning: ob_start(): class 'nonExistent' not found in %s on line 13
+
+Notice: ob_start(): failed to create buffer in %s on line 13
+bool(false)
+
+Warning: ob_start(): class 'C' does not have a method 'nonExistent' in %s on line 14
+
+Notice: ob_start(): failed to create buffer in %s on line 14
+bool(false)
+
+Warning: ob_start(): class 'C' does not have a method 'no' in %s on line 15
+
+Notice: ob_start(): failed to create buffer in %s on line 15
+bool(false)
+
+Warning: ob_start(): function 'no' not found or invalid function name in %s on line 16
+
+Notice: ob_start(): failed to create buffer in %s on line 16
+bool(false)
+done
diff --git a/tests/output/ob_start_error_003.phpt b/tests/output/ob_start_error_003.phpt
new file mode 100644
index 0000000..7fa292a
--- /dev/null
+++ b/tests/output/ob_start_error_003.phpt
@@ -0,0 +1,22 @@
+--TEST--
+Test ob_start() with object supplied but no method.
+--FILE--
+<?php
+/*
+ * proto bool ob_start([ string|array user_function [, int chunk_size [, bool erase]]])
+ * Function is implemented in main/output.c
+*/
+
+Class C {
+}
+
+$c = new C;
+var_dump(ob_start(array($c)));
+echo "done"
+?>
+--EXPECTF--
+Warning: ob_start(): array must have exactly two members in %s on line %d
+
+Notice: ob_start(): failed to create buffer in %s on line 11
+bool(false)
+done
diff --git a/tests/output/ob_start_error_004.phpt b/tests/output/ob_start_error_004.phpt
new file mode 100644
index 0000000..7ddf998
--- /dev/null
+++ b/tests/output/ob_start_error_004.phpt
@@ -0,0 +1,22 @@
+--TEST--
+Test ob_start() with non existent callback method.
+--FILE--
+<?php
+/*
+ * proto bool ob_start([ string|array user_function [, int chunk_size [, bool erase]]])
+ * Function is implemented in main/output.c
+*/
+
+Class C {
+}
+
+$c = new C;
+var_dump(ob_start(array($c, 'f')));
+echo "done"
+?>
+--EXPECTF--
+Warning: ob_start(): class 'C' does not have a method 'f' in %s on line %d
+
+Notice: ob_start(): failed to create buffer in %s on line 11
+bool(false)
+done
diff --git a/tests/output/ob_start_error_005.phpt b/tests/output/ob_start_error_005.phpt
new file mode 100644
index 0000000..3e503c6
--- /dev/null
+++ b/tests/output/ob_start_error_005.phpt
@@ -0,0 +1,23 @@
+--TEST--
+ob_start(): ensure buffers can't be added from within callback.
+--FILE--
+<?php
+
+/*
+ * proto bool ob_start([ string|array user_function [, int chunk_size [, bool erase]]])
+ * Function is implemented in main/output.c
+*/
+
+function f($str) {
+ ob_start();
+ echo "hello";
+ ob_end_flush();
+ return $str;
+}
+
+
+var_dump(ob_start('f'));
+echo "done";
+?>
+--EXPECTF--
+Fatal error: ob_start(): Cannot use output buffering in output buffering display handlers in %s on line 9 \ No newline at end of file