1--TEST--
2ob_start(): ensure multiple buffer initialization with a single call using arrays is not supported on PHP6 (http://bugs.php.net/42641)
3--FILE--
4<?php
5/*
6 * proto bool ob_start([ string|array user_function [, int chunk_size [, bool erase]]])
7 * Function is implemented in main/output.c
8*/
9
10function f($string) {
11	static $i=0;
12	$i++;
13	$len = strlen($string);
14	return "f[call:$i; len:$len] - $string\n";
15}
16
17Class C {
18	public $id = 'none';
19
20	function __construct($id) {
21		$this->id = $id;
22	}
23
24	static function g($string) {
25		static $i=0;
26		$i++;
27		$len = strlen($string);
28		return "C::g[call:$i; len:$len] - $string\n";
29	}
30
31	function h($string) {
32		static $i=0;
33		$i++;
34		$len = strlen($string);
35		return "C::h[call:$i; len:$len; id:$this->id] - $string\n";
36	}
37}
38
39function checkAndClean() {
40  print_r(ob_list_handlers());
41  while (ob_get_level()>0) {
42    ob_end_flush();
43  }
44}
45
46echo "\n ---> Test arrays: \n";
47var_dump(ob_start(array("f")));
48checkAndClean();
49
50var_dump(ob_start(array("f", "f")));
51checkAndClean();
52
53var_dump(ob_start(array("f", "C::g", "f", "C::g")));
54checkAndClean();
55
56var_dump(ob_start(array("f", "non_existent", "f")));
57checkAndClean();
58
59var_dump(ob_start(array("f", "non_existent", "f", "f")));
60checkAndClean();
61
62$c = new c('originalID');
63var_dump(ob_start(array($c, "h")));
64checkAndClean();
65
66var_dump(ob_start(array($c, "h")));
67$c->id = 'changedID';
68checkAndClean();
69
70$c->id = 'changedIDagain';
71var_dump(ob_start(array('f', 'C::g', array(array($c, "g"), array($c, "h")))));
72checkAndClean();
73?>
74--EXPECTF--
75 ---> Test arrays:
76
77Warning: ob_start(): array must have exactly two members in %s on line 44
78
79Notice: ob_start(): failed to create buffer in %s on line 44
80bool(false)
81Array
82(
83)
84
85Warning: ob_start(): class 'f' not found in %s on line 47
86
87Notice: ob_start(): failed to create buffer in %s on line 47
88bool(false)
89Array
90(
91)
92
93Warning: ob_start(): array must have exactly two members in %s on line 50
94
95Notice: ob_start(): failed to create buffer in %s on line 50
96bool(false)
97Array
98(
99)
100
101Warning: ob_start(): array must have exactly two members in %s on line 53
102
103Notice: ob_start(): failed to create buffer in %s on line 53
104bool(false)
105Array
106(
107)
108
109Warning: ob_start(): array must have exactly two members in %s on line 56
110
111Notice: ob_start(): failed to create buffer in %s on line 56
112bool(false)
113Array
114(
115)
116C::h[call:1; len:37; id:originalID] - bool(true)
117Array
118(
119    [0] => C::h
120)
121
122C::h[call:2; len:37; id:changedID] - bool(true)
123Array
124(
125    [0] => C::h
126)
127
128
129Warning: ob_start(): array must have exactly two members in %s on line 68
130
131Notice: ob_start(): failed to create buffer in %s on line 68
132bool(false)
133Array
134(
135)
136