mirror of
https://github.com/php/php-src.git
synced 2026-03-29 03:32:20 +02:00
This deprecates all callables that are accepted by
call_user_func($callable) but not by $callable(). In particular:
"self::method"
"parent::method"
"static::method"
["self", "method"]
["parent", "method"]
["static", "method"]
["Foo", "Bar::method"]
[new Foo, "Bar::method"]
RFC: https://wiki.php.net/rfc/deprecate_partially_supported_callables
Closes GH-7446.
48 lines
854 B
PHP
48 lines
854 B
PHP
--TEST--
|
|
Bug #66719: Weird behaviour when using get_called_class() with call_user_func()
|
|
--FILE--
|
|
<?php
|
|
|
|
class A
|
|
{
|
|
public static function who()
|
|
{
|
|
var_dump(get_called_class());
|
|
}
|
|
}
|
|
class B extends A
|
|
{
|
|
public static function who()
|
|
{
|
|
parent::who();
|
|
}
|
|
}
|
|
|
|
class C
|
|
{
|
|
public static function test() {
|
|
B::who();
|
|
call_user_func(array(A::class, 'who'));
|
|
call_user_func(array(B::class, 'parent::who'));
|
|
}
|
|
}
|
|
|
|
B::who();
|
|
call_user_func(array(A::class, 'who'));
|
|
call_user_func(array(B::class, 'parent::who'));
|
|
|
|
C::test();
|
|
|
|
?>
|
|
--EXPECTF--
|
|
string(1) "B"
|
|
string(1) "A"
|
|
|
|
Deprecated: Callables of the form ["B", "parent::who"] are deprecated in %s on line %d
|
|
string(1) "A"
|
|
string(1) "B"
|
|
string(1) "A"
|
|
|
|
Deprecated: Callables of the form ["B", "parent::who"] are deprecated in %s on line %d
|
|
string(1) "A"
|