1
0
mirror of https://github.com/php/php-src.git synced 2026-03-24 16:22:37 +01:00
Files
archived-php-src/ext/spl/tests/bug65006.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

45 lines
837 B
PHP

--TEST--
Bug #65006: spl_autoload_register fails with multiple callables using self, same method
--FILE--
<?php
class first {
public static function init() {
spl_autoload_register(array('self','load'));
}
public static function load($class) {}
}
class second {
public static function init() {
spl_autoload_register(array('self','load'));
}
public static function load($class){}
}
first::init();
second::init();
var_dump(spl_autoload_functions());
?>
--EXPECTF--
Deprecated: Use of "self" in callables is deprecated in %s on line %d
Deprecated: Use of "self" in callables is deprecated in %s on line %d
array(2) {
[0]=>
array(2) {
[0]=>
string(5) "first"
[1]=>
string(4) "load"
}
[1]=>
array(2) {
[0]=>
string(6) "second"
[1]=>
string(4) "load"
}
}