1
0
mirror of https://github.com/php/php-src.git synced 2026-03-29 03:32:20 +02:00
Files
archived-php-src/Zend/tests/bug37138.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

25 lines
593 B
PHP

--TEST--
Bug #37138 (autoloader tries to load callback'ed self and parent)
--FILE--
<?php
spl_autoload_register(function ($CN) { var_dump ($CN); });
class st {
public static function e () {echo ("EHLO\n");}
public static function e2 () {call_user_func (array ('self', 'e'));}
}
class stch extends st {
public static function g () {call_user_func (array ('parent', 'e'));}
}
st::e ();
st::e2 ();
stch::g ();
?>
--EXPECTF--
EHLO
Deprecated: Use of "self" in callables is deprecated in %s on line %d
EHLO
Deprecated: Use of "parent" in callables is deprecated in %s on line %d
EHLO