php-src/Zend/tests/call_user_func_005.phpt
Nikita Popov afc4d67c8b Consistently treat optional-before-required as required
There was a loophole here when it came to usage with named arguments,
which was not intended. Close the loophole thoroughly by actually
dropping the default value from the signature entirely. The default
is still used to make the type nullable, but not for anything else.
2021-05-18 12:40:58 +02:00

36 lines
692 B
PHP

--TEST--
Passing Closure as parameter to an non-existent function
--FILE--
<?php
class foo {
public static function __callstatic($x, $y) {
var_dump($x,$y);
return 1;
}
public static function teste() {
return foo::x(function &($a=1,$b) { });
}
}
var_dump(call_user_func(array('foo', 'teste')));
?>
--EXPECTF--
Deprecated: Optional parameter $a declared before required parameter $b is implicitly treated as a required parameter in %s on line %d
string(1) "x"
array(1) {
[0]=>
object(Closure)#%d (1) {
["parameter"]=>
array(2) {
["$a"]=>
string(10) "<required>"
["$b"]=>
string(10) "<required>"
}
}
}
int(1)