Skip to content

Commit 5d07257

Browse files
committed
Don't use CE for by-ref arguments
1 parent 41f33b9 commit 5d07257

File tree

2 files changed

+10
-0
lines changed

2 files changed

+10
-0
lines changed

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)

ext/opcache/Optimizer/zend_inference.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2936,6 +2936,7 @@ static zend_always_inline int _zend_update_type_info(
29362936
tmp = zend_fetch_arg_info_type(script, arg_info, &ce);
29372937
if (ZEND_ARG_SEND_MODE(arg_info)) {
29382938
tmp |= MAY_BE_REF;
2939+
ce = NULL;
29392940
}
29402941

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

0 commit comments

Comments
 (0)