xref: /php-src/Zend/tests/dynamic_call_006.phpt (revision 675e9751)
1--TEST--
2Dynamic calls to scope introspection functions are forbidden (function variations)
3--FILE--
4<?php
5function test() {
6
7    try {
8        $func = 'extract';
9        $func(['a' => 'b']);
10    } catch (\Error $e) {
11        echo $e->getMessage() . "\n";
12    }
13
14    try {
15        $func = 'compact';
16        $func(['a']);
17    } catch (\Error $e) {
18        echo $e->getMessage() . "\n";
19    }
20
21    try {
22        $func = 'get_defined_vars';
23        $func();
24    } catch (\Error $e) {
25        echo $e->getMessage() . "\n";
26    }
27
28    try {
29        $func = 'func_get_args';
30        $func();
31    } catch (\Error $e) {
32        echo $e->getMessage() . "\n";
33    }
34
35    try {
36        $func = 'func_get_arg';
37        $func(1);
38    } catch (\Error $e) {
39        echo $e->getMessage() . "\n";
40    }
41
42    try {
43        $func = 'func_num_args';
44        $func();
45    } catch (\Error $e) {
46        echo $e->getMessage() . "\n";
47    }
48}
49test();
50
51?>
52--EXPECT--
53Cannot call extract() dynamically
54Cannot call compact() dynamically
55Cannot call get_defined_vars() dynamically
56Cannot call func_get_args() dynamically
57Cannot call func_get_arg() dynamically
58Cannot call func_num_args() dynamically
59