Skip to content

Commit 01996d1

Browse files
committed
Merge branch 'PHP-8.1'
* PHP-8.1: Don't use CE for by-ref arguments
2 parents bc24c62 + 38547b9 commit 01996d1

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
@@ -3005,6 +3005,7 @@ static zend_always_inline zend_result _zend_update_type_info(
30053005
tmp = zend_fetch_arg_info_type(script, arg_info, &ce);
30063006
if (ZEND_ARG_SEND_MODE(arg_info)) {
30073007
tmp |= MAY_BE_REF;
3008+
ce = NULL;
30083009
}
30093010

30103011
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)