php-src/ext/zend_test/tests/zend_forbid_dynamic_call.phpt
twosee b1223ee35f
Use get_active_function_or_method_name() for zend_forbid_dynamic_call() (#8762)
A slight imperfection in https://github.com/php/php-src/pull/7443.
As a zend_API, we should also consider other extensions that may call it in methods. This change will not break the behavior of php-src.
2022-06-16 12:02:53 +01:00

30 lines
611 B
PHP

--TEST--
Zend: Test zend_forbid_dynamic_call() for methods
--EXTENSIONS--
zend_test
--FILE--
<?php
$object = new ZendTestForbidDynamicCall();
$object->call();
ZendTestForbidDynamicCall::callStatic();
try {
$call = [$object, 'call'];
$call();
} catch (Error $error) {
echo $error->getMessage(), "\n";
}
try {
$callStatic = [ZendTestForbidDynamicCall::class, 'callStatic'];
$callStatic();
} catch (Error $error) {
echo $error->getMessage(), "\n";
}
?>
--EXPECT--
Cannot call ZendTestForbidDynamicCall::call() dynamically
Cannot call ZendTestForbidDynamicCall::callStatic() dynamically