1
0
mirror of https://github.com/php/php-src.git synced 2026-03-24 00:02:20 +01:00
Files
archived-php-src/Zend/tests/dynamic_call/dynamic_call_006.phpt
DanielEScherzer 275f63e7fd Zend/tests: organize some tests with subdirectories (2) (#16423)
Move more low-hanging fruit, creating new directories for the tests for:

* comparisons
* dynamic calls
* error messages
* `error_reporting()`
* exceptions
* `foreach()`
* garbage collection
* group `use` statements
* heredoc and nowdoc
* `goto` jumps
* late static binding
* magic methods
* namespaces
* numeric literal separators
* objects
* `settype()`
* cleaning of temporary values
* `unset()`

Additionally, move some tests into the existing subdirectory for `list()`
tests.

Drive-by fixes of some test numbers in the names of the `goto` tests.

Work towards GH-15631
2024-10-14 12:14:42 +01:00

59 lines
1.1 KiB
PHP

--TEST--
Dynamic calls to scope introspection functions are forbidden (function variations)
--FILE--
<?php
function test() {
try {
$func = 'extract';
$func(['a' => 'b']);
} catch (\Error $e) {
echo $e->getMessage() . "\n";
}
try {
$func = 'compact';
$func(['a']);
} catch (\Error $e) {
echo $e->getMessage() . "\n";
}
try {
$func = 'get_defined_vars';
$func();
} catch (\Error $e) {
echo $e->getMessage() . "\n";
}
try {
$func = 'func_get_args';
$func();
} catch (\Error $e) {
echo $e->getMessage() . "\n";
}
try {
$func = 'func_get_arg';
$func(1);
} catch (\Error $e) {
echo $e->getMessage() . "\n";
}
try {
$func = 'func_num_args';
$func();
} catch (\Error $e) {
echo $e->getMessage() . "\n";
}
}
test();
?>
--EXPECT--
Cannot call extract() dynamically
Cannot call compact() dynamically
Cannot call get_defined_vars() dynamically
Cannot call func_get_args() dynamically
Cannot call func_get_arg() dynamically
Cannot call func_num_args() dynamically