mirror of
https://github.com/php/php-src.git
synced 2024-11-23 18:04:36 +08:00
af15923bc3
Implements https://wiki.php.net/rfc/partially-supported-callables-expand-deprecation-notices so that uses of "self" and "parent" in is_callable() and callable type constraints now raise a deprecation notice, independent of the one raised when and if the callable is actually invoked. A new flag is added to the existing check_flags parameter of zend_is_callable / zend_is_callable_ex, for use in internal calls that would otherwise repeat the notice multiple times. In particular, arguments to internal function calls are checked first based on arginfo, and then again during ZPP, so the former suppresses the deprecation notice. Some existing tests which raised this deprecation have been updated to avoid the syntax, but the existing version retained for maximum regression coverage until it is made an error. With thanks to Juliette Reinders Folmer for the RFC and initial investigation. Closes GH-8823.
31 lines
527 B
PHP
31 lines
527 B
PHP
--TEST--
|
|
Bug #71622 (Strings used in pass-as-reference cannot be used to invoke C::$callable())
|
|
--FILE--
|
|
<?php
|
|
|
|
function getMethodName(&$methodName) {
|
|
$methodName = Abc::METHOD_NAME;
|
|
}
|
|
|
|
class Abc {
|
|
const METHOD_NAME = "goal";
|
|
|
|
private static function goal() {
|
|
echo "success\n";
|
|
}
|
|
|
|
public static function run() {
|
|
$method = "foobar";
|
|
getMethodName($method);
|
|
var_dump(is_callable("Abc::$method"));
|
|
self::$method();
|
|
}
|
|
}
|
|
|
|
Abc::run();
|
|
|
|
?>
|
|
--EXPECT--
|
|
bool(true)
|
|
success
|