Skip to content

Commit f6fec4e

Browse files
committed
Review
1 parent 616a914 commit f6fec4e

File tree

6 files changed

+27
-29
lines changed

6 files changed

+27
-29
lines changed

Zend/tests/partial_application/references_001.phpt

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ function foo($a, $b) {
77
$b = 2;
88
}
99

10-
$a = [];
10+
$a = ['unchanged because foo() doesn\'t take by reference'];
1111
$b = &$a[0];
1212

1313
$foo = foo(1, ?);
@@ -19,6 +19,6 @@ var_dump($a, $b);
1919
--EXPECT--
2020
array(1) {
2121
[0]=>
22-
&NULL
22+
&string(49) "unchanged because foo() doesn't take by reference"
2323
}
24-
NULL
24+
string(49) "unchanged because foo() doesn't take by reference"

Zend/tests/partial_application/reflection_005.phpt

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -3,14 +3,14 @@ Closure application reflection: ReflectionFunction::isClosure() is true for part
33
--FILE--
44
<?php
55

6-
echo (int)(new ReflectionFunction('sprintf'))->isClosure(), "\n";
6+
var_dump((new ReflectionFunction('sprintf'))->isClosure());
77

8-
echo (int)(new ReflectionFunction(function () {}))->isClosure(), "\n";
8+
var_dump((new ReflectionFunction(function () {}))->isClosure());
99

10-
echo (int)(new ReflectionFunction(sprintf(?)))->isClosure(), "\n";
10+
var_dump((new ReflectionFunction(sprintf(?)))->isClosure());
1111

1212
?>
13-
--EXPECTF--
14-
0
15-
1
16-
1
13+
--EXPECT--
14+
bool(false)
15+
bool(true)
16+
bool(true)
Lines changed: 10 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,27 +1,25 @@
11
--TEST--
2-
PFAs forwarded superfluous args iff a '...' placeholder is specified
2+
PFAs forwards superfluous args iff a '...' placeholder is specified
33
--FILE--
44
<?php
55

66
function f($a) {
77
var_dump(func_get_args());
88
}
9+
910
$f = f(?, ...);
1011
$f(1, 2, 3);
1112

13+
$h = f(?);
14+
$h(1, 2, 3);
15+
1216
function g($a, ...$args) {
1317
var_dump(func_get_args());
1418
}
1519

16-
$g = f(?, ...);
20+
$g = g(?, ...);
1721
$g(1, 2, 3);
1822

19-
function h($a) {
20-
}
21-
22-
$h = f(?);
23-
$h(1, 2, 3);
24-
2523
?>
2624
--EXPECT--
2725
array(3) {
@@ -32,6 +30,10 @@ array(3) {
3230
[2]=>
3331
int(3)
3432
}
33+
array(1) {
34+
[0]=>
35+
int(1)
36+
}
3537
array(3) {
3638
[0]=>
3739
int(1)
@@ -40,7 +42,3 @@ array(3) {
4042
[2]=>
4143
int(3)
4244
}
43-
array(1) {
44-
[0]=>
45-
int(1)
46-
}

Zend/tests/partial_application/this_001.phpt

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,7 @@ $bar = $foo->method(new stdClass, ...);
1414

1515
$baz = $bar(new stdClass, ...);
1616

17-
var_dump($baz());
17+
var_dump($foo === $baz());
1818
?>
19-
--EXPECTF--
20-
object(Foo)#%d (0) {
21-
}
19+
--EXPECT--
20+
bool(true)

Zend/tests/partial_application/variation_ex_001.phpt

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,8 @@ function test($a){}
77
try {
88
test(1,...)(?);
99
} catch (Error $ex) {
10-
echo "OK";
10+
echo $ex::class, ": ", $ex->getMessage(), "\n";
1111
}
1212
?>
13-
--EXPECT--
14-
OK
13+
--EXPECTF--
14+
ArgumentCountError: Partial application of {closure:%s:%d}() expects at most 0 arguments, 1 given

Zend/zend_object_handlers.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1677,6 +1677,7 @@ ZEND_API bool zend_check_protected(const zend_class_entry *ce, const zend_class_
16771677
/* }}} */
16781678

16791679
static zend_always_inline zend_arg_info* zend_get_call_trampoline_arginfo(void) {
1680+
// TODO: Move to MINIT
16801681
if (UNEXPECTED(zend_call_trampoline_arginfo[0].name == NULL)) {
16811682
zend_call_trampoline_arginfo[0].name = ZSTR_KNOWN(ZEND_STR_ARGS);
16821683
}

0 commit comments

Comments
 (0)