123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134 |
- --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
- /*
- * 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 %d
- Notice: ob_start(): Failed to create buffer in %s on line %d
- bool(false)
- Array
- (
- )
- Warning: ob_start(): class "f" not found in %s on line %d
- Notice: ob_start(): Failed to create buffer in %s on line %d
- bool(false)
- Array
- (
- )
- 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 %d
- bool(false)
- Array
- (
- )
- 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 %d
- bool(false)
- Array
- (
- )
- 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 %d
- 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 %d
- Notice: ob_start(): Failed to create buffer in %s on line %d
- bool(false)
- Array
- (
- )
|