Skip to content

Commit 025fe84

Browse files
committed
Add broken test for __call behavior
1 parent f06df98 commit 025fe84

File tree

1 file changed

+27
-0
lines changed

1 file changed

+27
-0
lines changed

Zend/tests/named_params/__call.phpt

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
--TEST--
2+
Check that __invoke() works with named parameters
3+
--FILE--
4+
<?php
5+
6+
class Test {
7+
public function __call(string $method, array $args) {
8+
$this->{'_'.$method}(...$args);
9+
}
10+
11+
private function _method($a = 'a', $b = 'b') {
12+
echo "a: $a, b: $b\n";
13+
}
14+
}
15+
16+
$test = new Test;
17+
$test->method('A', 'B');
18+
$test->method(a: 'A', b: 'B');
19+
20+
?>
21+
--EXPECTF--
22+
a: A, b: B
23+
24+
Fatal error: Uncaught Error: Unknown named parameter $a in %s:%d
25+
Stack trace:
26+
#0 {main}
27+
thrown in %s on line %d

0 commit comments

Comments
 (0)