Skip to content

Commit 38547b9

Browse files
committed
Merge branch 'PHP-8.0' into PHP-8.1
* PHP-8.0: Don't use CE for by-ref arguments
2 parents f1814e6 + 5d07257 commit 38547b9

File tree

2 files changed

+10
-0
lines changed

2 files changed

+10
-0
lines changed

Zend/Optimizer/zend_inference.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2979,6 +2979,7 @@ static zend_always_inline int _zend_update_type_info(
29792979
tmp = zend_fetch_arg_info_type(script, arg_info, &ce);
29802980
if (ZEND_ARG_SEND_MODE(arg_info)) {
29812981
tmp |= MAY_BE_REF;
2982+
ce = NULL;
29822983
}
29832984

29842985
if (opline->opcode == ZEND_RECV_VARIADIC) {

Zend/tests/assign_obj_to_ref_inference.phpt

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,10 +24,19 @@ function test2($o) {
2424
}
2525
}
2626

27+
function test3(Test &$o) {
28+
$GLOBALS['r'] = new stdClass;
29+
$GLOBALS['r']->x = 3.141;
30+
var_dump(is_float($o->x));
31+
}
32+
2733
test1();
2834
test2(new Test);
35+
$r = new Test;
36+
test3($r);
2937

3038
?>
3139
--EXPECT--
3240
bool(true)
3341
bool(true)
42+
bool(true)

0 commit comments

Comments
 (0)