File tree Expand file tree Collapse file tree 1 file changed +39
-0
lines changed Expand file tree Collapse file tree 1 file changed +39
-0
lines changed Original file line number Diff line number Diff line change
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
You can’t perform that action at this time.
0 commit comments