php-src/Zend/tests/lsb_022.phpt
Nikita Popov ee510eed68 Deprecate partially supported callables
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.
2021-10-22 10:15:24 +02:00

48 lines
1.2 KiB
PHP

--TEST--
ZE2 Late Static Binding parent::/self:: forwarding and __callStatic
--FILE--
<?php
class A {
static function test() {
echo "A\n";
}
static function __callstatic($name, $args) {
call_user_func("static::test");
}
}
class B extends A {
static function test() {
echo "B\n";
}
static function __callstatic($name, $args) {
parent::__callstatic($name, $args);
call_user_func_array("parent::__callstatic", array($name, $args));
parent::foo();
call_user_func_array("parent::foo", $args);
call_user_func_array(array("parent","foo"), $args);
}
}
B::foo();
?>
--EXPECTF--
Deprecated: Use of "static" in callables is deprecated in %s on line %d
B
Deprecated: Use of "parent" in callables is deprecated in %s on line %d
Deprecated: Use of "static" in callables is deprecated in %s on line %d
B
Deprecated: Use of "static" in callables is deprecated in %s on line %d
B
Deprecated: Use of "parent" in callables is deprecated in %s on line %d
Deprecated: Use of "static" in callables is deprecated in %s on line %d
B
Deprecated: Use of "parent" in callables is deprecated in %s on line %d
Deprecated: Use of "static" in callables is deprecated in %s on line %d
B