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