Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- --TEST--
- ob_start with comma delimited strings
- --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 checkAndClean() {
- print_r(ob_list_handlers());
- while (ob_get_level()>0) {
- ob_end_flush();
- }
- }
- echo "\n ---> Test comma delimited strings: \n";
- var_dump(ob_start("f"));
- checkAndClean();
- var_dump(ob_start("f,f"));
- checkAndClean();
- var_dump(ob_start("f,C::g,f,C::g"));
- checkAndClean();
- ?>
- --EXPECTF--
- ---> Test comma delimited strings:
- f[call:1; len:34] - bool(true)
- Array
- (
- [0] => f
- )
- f[call:3; len:68] - f[call:2; len:47] - bool(true)
- Array
- (
- [0] => f
- [1] => f
- )
- f[call:5; len:150] - C::g[call:2; len:125] - f[call:4; len:103] - C::g[call:1; len:79] - bool(true)
- Array
- (
- [0] => f
- [1] => C::g
- [2] => f
- [3] => C::g
- )
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement