File tree Expand file tree Collapse file tree 4 files changed +158
-0
lines changed Expand file tree Collapse file tree 4 files changed +158
-0
lines changed Original file line number Diff line number Diff line change
1
+ --TEST--
2
+ Observer: call_user_func() from root namespace
3
+ --SKIPIF--
4
+ <?php if (!extension_loaded ('zend-test ' )) die ('skip: zend-test extension required ' ); ?>
5
+ --INI--
6
+ zend_test.observer.enabled=1
7
+ zend_test.observer.observe_all=1
8
+ --FILE--
9
+ <?php
10
+ namespace Test {
11
+ final class MyClass
12
+ {
13
+ public static function myMethod ()
14
+ {
15
+ echo 'MyClass::myMethod called ' . PHP_EOL ;
16
+ }
17
+ }
18
+
19
+ function my_function ()
20
+ {
21
+ echo 'my_function called ' . PHP_EOL ;
22
+ }
23
+ }
24
+ namespace {
25
+ call_user_func ('Test \\MyClass::myMethod ' );
26
+ call_user_func ('Test \\my_function ' );
27
+ }
28
+ ?>
29
+ --EXPECTF--
30
+ <!-- init '%s/observer_call_user_func_%d.php' -->
31
+ <file '%s/observer_call_user_func_%d.php'>
32
+ <!-- init Test\MyClass::myMethod() -->
33
+ <Test\MyClass::myMethod>
34
+ MyClass::myMethod called
35
+ </Test\MyClass::myMethod>
36
+ <!-- init Test\my_function() -->
37
+ <Test\my_function>
38
+ my_function called
39
+ </Test\my_function>
40
+ </file '%s/observer_call_user_func_%d.php'>
Original file line number Diff line number Diff line change
1
+ --TEST--
2
+ Observer: call_user_func_array() from root namespace
3
+ --SKIPIF--
4
+ <?php if (!extension_loaded ('zend-test ' )) die ('skip: zend-test extension required ' ); ?>
5
+ --INI--
6
+ zend_test.observer.enabled=1
7
+ zend_test.observer.observe_all=1
8
+ --FILE--
9
+ <?php
10
+ namespace Test {
11
+ final class MyClass
12
+ {
13
+ public static function myMethod (string $ msg )
14
+ {
15
+ echo 'MyClass::myMethod ' . $ msg . PHP_EOL ;
16
+ }
17
+ }
18
+
19
+ function my_function (string $ msg )
20
+ {
21
+ echo 'my_function ' . $ msg . PHP_EOL ;
22
+ }
23
+ }
24
+ namespace {
25
+ call_user_func_array ('Test \\MyClass::myMethod ' , ['called ' ]);
26
+ call_user_func_array ('Test \\my_function ' , ['called ' ]);
27
+ }
28
+ ?>
29
+ --EXPECTF--
30
+ <!-- init '%s/observer_call_user_func_%d.php' -->
31
+ <file '%s/observer_call_user_func_%d.php'>
32
+ <!-- init Test\MyClass::myMethod() -->
33
+ <Test\MyClass::myMethod>
34
+ MyClass::myMethod called
35
+ </Test\MyClass::myMethod>
36
+ <!-- init Test\my_function() -->
37
+ <Test\my_function>
38
+ my_function called
39
+ </Test\my_function>
40
+ </file '%s/observer_call_user_func_%d.php'>
Original file line number Diff line number Diff line change
1
+ --TEST--
2
+ Observer: call_user_func() from namespace
3
+ --SKIPIF--
4
+ <?php if (!extension_loaded ('zend-test ' )) die ('skip: zend-test extension required ' ); ?>
5
+ --INI--
6
+ zend_test.observer.enabled=1
7
+ zend_test.observer.observe_all=1
8
+ --FILE--
9
+ <?php
10
+ namespace Test {
11
+ final class MyClass
12
+ {
13
+ public static function myMethod ()
14
+ {
15
+ echo 'MyClass::myMethod called ' . PHP_EOL ;
16
+ }
17
+ }
18
+
19
+ function my_function ()
20
+ {
21
+ echo 'my_function called ' . PHP_EOL ;
22
+ }
23
+
24
+ call_user_func ('Test \\MyClass::myMethod ' );
25
+ call_user_func ('Test \\my_function ' );
26
+ }
27
+ ?>
28
+ --EXPECTF--
29
+ <!-- init '%s/observer_call_user_func_%d.php' -->
30
+ <file '%s/observer_call_user_func_%d.php'>
31
+ <!-- init Test\MyClass::myMethod() -->
32
+ <Test\MyClass::myMethod>
33
+ MyClass::myMethod called
34
+ </Test\MyClass::myMethod>
35
+ <!-- init Test\my_function() -->
36
+ <Test\my_function>
37
+ my_function called
38
+ </Test\my_function>
39
+ </file '%s/observer_call_user_func_%d.php'>
Original file line number Diff line number Diff line change
1
+ --TEST--
2
+ Observer: call_user_func_array() from namespace
3
+ --SKIPIF--
4
+ <?php if (!extension_loaded ('zend-test ' )) die ('skip: zend-test extension required ' ); ?>
5
+ --INI--
6
+ zend_test.observer.enabled=1
7
+ zend_test.observer.observe_all=1
8
+ --FILE--
9
+ <?php
10
+ namespace Test {
11
+ final class MyClass
12
+ {
13
+ public static function myMethod (string $ msg )
14
+ {
15
+ echo 'MyClass::myMethod ' . $ msg . PHP_EOL ;
16
+ }
17
+ }
18
+
19
+ function my_function (string $ msg )
20
+ {
21
+ echo 'my_function ' . $ msg . PHP_EOL ;
22
+ }
23
+
24
+ call_user_func_array ('Test \\MyClass::myMethod ' , ['called ' ]);
25
+ call_user_func_array ('Test \\my_function ' , ['called ' ]);
26
+ }
27
+ ?>
28
+ --EXPECTF--
29
+ <!-- init '%s/observer_call_user_func_%d.php' -->
30
+ <file '%s/observer_call_user_func_%d.php'>
31
+ <!-- init Test\MyClass::myMethod() -->
32
+ <Test\MyClass::myMethod>
33
+ MyClass::myMethod called
34
+ </Test\MyClass::myMethod>
35
+ <!-- init Test\my_function() -->
36
+ <Test\my_function>
37
+ my_function called
38
+ </Test\my_function>
39
+ </file '%s/observer_call_user_func_%d.php'>
You can’t perform that action at this time.
0 commit comments