Skip to content

Commit 41a1de4

Browse files
author
Jani Taskinen
committed
- Add test for the ob_start($foo); leak/crash bug
1 parent d2263d4 commit 41a1de4

File tree

1 file changed

+39
-0
lines changed

1 file changed

+39
-0
lines changed

tests/output/ob_start_callbacks.phpt

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
--TEST--
2+
Test ob_start() with callbacks in variables
3+
--FILE--
4+
<?php
5+
6+
// Closure in variable
7+
$a = function ($s) { return strtoupper($s); };
8+
ob_start($a);
9+
echo 'closure in variable', "\n";
10+
ob_end_flush();
11+
12+
// Object (array) in variable
13+
class foo {
14+
static function out($foo) {
15+
return strtoupper($foo);
16+
}
17+
}
18+
$a = array('foo', 'out');
19+
ob_start($a);
20+
echo 'object in variable', "\n";
21+
ob_end_flush();
22+
23+
// Object with static array
24+
ob_start(array('foo', 'out'));
25+
echo 'object via static array', "\n";
26+
ob_end_flush();
27+
28+
function my_strtoupper($foo, $bar) {
29+
return strtoupper($foo);
30+
}
31+
$a = 'my_strtoupper';
32+
ob_start($a);
33+
echo 'function via variable', "\n";
34+
ob_end_flush();
35+
--EXPECT--
36+
CLOSURE IN VARIABLE
37+
OBJECT IN VARIABLE
38+
OBJECT VIA STATIC ARRAY
39+
FUNCTION VIA VARIABLE

0 commit comments

Comments
 (0)